Skip to content

Instantly share code, notes, and snippets.

@souhe
Last active January 24, 2017 08:37
Show Gist options
  • Save souhe/c48a1e97785d4ebaa3faa21276a388d7 to your computer and use it in GitHub Desktop.
Save souhe/c48a1e97785d4ebaa3faa21276a388d7 to your computer and use it in GitHub Desktop.
export default class Buttons extends Component {
state = {
color: 'white',
}
render() {
return (
<View style={styles.container}>
<Button title="Button 1" onPress={() => this.setState({ color: 'red' })} color="red"/>
<Button title="Button 2" onPress={() => this.setState({ color: 'green' })} color="green"/>
<Button title="Button 3" onPress={() => this.setState({ color: 'blue' })} color="blue"/>
<View style={[styles.view, { backgroundColor: this.state.color }]} />
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment