Created
December 15, 2018 18:27
-
-
Save jgeraerts/045d7a9bc5d250fcb8952fdce2aafa2b 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
import React from 'react'; | |
import { | |
StyleSheet, | |
Text, | |
View, | |
Button, | |
} from 'react-native'; | |
class Ready extends React.Component { | |
render() { | |
return ( | |
<Text>Ik ben ready</Text> | |
) | |
} | |
} | |
class NotReady extends React.Component { | |
render() { | |
return ( | |
<View> | |
<Text>ik ben niet ready. Druk op de knop</Text> | |
<Button title="klaar" onPress={this.props.klikfunctie} /> | |
</View> | |
) | |
} | |
} | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state={ | |
ready: false, | |
}; | |
this.opDeKnopGeduwd = this.opDeKnopGeduwd.bind(this); | |
}; | |
opDeKnopGeduwd() { | |
this.setState({ready: true}); | |
} | |
render() { | |
let component = this.state.ready ? | |
<Ready/> : | |
<NotReady klikfunctie={this.opDeKnopGeduwd} />; | |
return ( | |
<View style={styles.container}> | |
{component} | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment