Last active
February 2, 2016 07:39
-
-
Save kmagiera/f2af6d6b9217fcacfea6 to your computer and use it in GitHub Desktop.
This file contains 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
var REMOVE_CLIPPED=true; | |
var DO_NOT_COLLAPSE=false; | |
var Example = React.createClass({ | |
getInitialState: function() { | |
return { cnt: 0 }; | |
}, | |
render: function() { | |
var style = { | |
width: 300, | |
height: this.state.cnt === 2 ? 300 : 1, | |
backgroundColor: 'red', | |
}; | |
var collapsable = { | |
position: 'relative', | |
top: 10, | |
left: 10, | |
width: 200, | |
height: 200, | |
backgroundColor: this.state.cnt === 1 && 'yellow' | |
} | |
return ( | |
<View> | |
<TouchableHighlight onPress={() => this.setState({cnt: this.state.cnt+1})}> | |
<View style={{width: 300, height: 80, position: 'relative', top: 10, alignItems: 'center', justifyContent: 'center', backgroundColor: 'yellow'}}> | |
<Text>Tap me twice</Text> | |
</View> | |
</TouchableHighlight> | |
<View style={style} removeClippedSubviews={REMOVE_CLIPPED}> | |
<View style={collapsable} collapsable={!DO_NOT_COLLAPSE}> | |
<View style={{position: 'relative', top: 10, left: 10, width: 100, height: 100, backgroundColor: 'yellow'}} removeClippedSubviews={REMOVE_CLIPPED}> | |
<View style={{position: 'relative', top: 10, left: 10, width: 20, height: 20, backgroundColor: 'black'}}/> | |
</View> | |
</View> | |
</View> | |
</View> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment