Skip to content

Instantly share code, notes, and snippets.

@adrian-afergon
Created August 15, 2018 17:38
Show Gist options
  • Save adrian-afergon/3b9ac992ca59cc01869893d4b250acb0 to your computer and use it in GitHub Desktop.
Save adrian-afergon/3b9ac992ca59cc01869893d4b250acb0 to your computer and use it in GitHub Desktop.
Add button to App.js
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>Changes you make will automatically reload.</Text>
<Text>Shake your phone to open the developer menu.</Text>
<Button title='This is my button' onPress={this.handlerPress}/>
</View>
);
}
handlerPress = () => {
console.log('It works');
}
}
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