Last active
February 4, 2016 14:26
-
-
Save arathunku/f8b4a966d73920cafa07 to your computer and use it in GitHub Desktop.
https://youtu.be/605C8l_g5fo | After expanding the list, scrolling down and clicking on an element to close the list, the height of the ScrollView is not recalculated and there's a blank screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import React, { | |
AppRegistry, | |
Component, | |
StyleSheet, | |
Text, | |
View, | |
ScrollView, | |
TouchableOpacity | |
} from 'react-native'; | |
var items = []; | |
var i = 50; | |
while(i -= 1) { | |
items.push("Test data"); | |
} | |
class DebugAndro extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
show: false | |
} | |
} | |
toggle() { | |
this.setState({show: !this.state.show}) | |
} | |
renderItems() { | |
return items.map(function(item) { | |
return ( | |
<TouchableOpacity onPress={this.toggle.bind(this)}> | |
<Text style={{height: 50}}>item</Text> | |
</TouchableOpacity> | |
) | |
}.bind(this)) | |
} | |
render() { | |
return ( | |
<ScrollView style={styles.container}> | |
<TouchableOpacity onPress={this.toggle.bind(this)}> | |
<Text>toggle list</Text> | |
</TouchableOpacity> | |
<View style={{flex: 1}}> | |
{ this.state.show && this.renderItems() } | |
</View> | |
</ScrollView> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1 | |
} | |
}); | |
AppRegistry.registerComponent('DebugAndro', () => DebugAndro); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment