Created
February 9, 2020 14:02
-
-
Save TheBojda/5ae25361ed930453fb4251ea5fcc44f0 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, { Component } from 'react'; | |
import { StyleSheet, Text, View, Button } from 'react-native'; | |
export default class App extends Component { | |
constructor() { | |
super() | |
this.state = {text: 'Hello World!'} | |
} | |
clickHandler = () => { | |
this.setState({text: 'Button clicked!'}); | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text>{this.state.text}</Text> | |
<Button title="Push me!" onPress={this.clickHandler}></Button> | |
</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