Skip to content

Instantly share code, notes, and snippets.

@helloworldsmart
Created January 19, 2018 10:42
Show Gist options
  • Select an option

  • Save helloworldsmart/5278d5b9d0f68950f0b42537d0bfa738 to your computer and use it in GitHub Desktop.

Select an option

Save helloworldsmart/5278d5b9d0f68950f0b42537d0bfa738 to your computer and use it in GitHub Desktop.
class YellowButton extends Component {
constructor(props) {
super(props)
this.state = { isClicked: false }
}
touchableHandlePress() {
this.setSate({
isClicked: !this.state.isClicked
})
}
render() {
let wordings = this.props.wordings || {
isClickedName: 'Done',
noClickedName: ' '
}
return (
<Button
style={{fontSize: 20, color: 'green'}}
styleDisabled={{color: 'red'}}
onPress={this.touchableHandlePress.bind(this)}
title="Press me"
>
{ this.state.isClicked ? wordings.isClickedName : wordings.noClickedName }
</Button>
)
}
}
//<YellowButton wordings={{ isClickedName: "Done", noClickedName: "遊戲規則" }} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment