Last active
August 1, 2017 19:49
-
-
Save JodusNodus/bf8d76f44617ed32b0857634b8545e37 to your computer and use it in GitHub Desktop.
Declarative logic React components
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
| class SomeView extends Component { | |
| static propTypes = { | |
| showNav: PropTypes.func.isRequired, | |
| hideNav: PropTypes.func.isRequired | |
| } | |
| componentDidMount(){ | |
| this.props.showNav() | |
| BackHandler.addEventListener('hardwareBackPress', this.handleBack) | |
| } | |
| componentWillUnmount(){ | |
| this.props.hideNav() | |
| BackHandler.removeEventListener('hardwareBackPress', this.handleBack) | |
| } | |
| handleBack = () => {}// ? Do some navigation logic ? | |
| render = () => ( | |
| <View> | |
| <Text>Some text</Text> | |
| </View> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment