Skip to content

Instantly share code, notes, and snippets.

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