Skip to content

Instantly share code, notes, and snippets.

@adrian-afergon
Created August 17, 2018 16:19
Show Gist options
  • Save adrian-afergon/e3c96babc9f9dd90774710f390ce28be to your computer and use it in GitHub Desktop.
Save adrian-afergon/e3c96babc9f9dd90774710f390ce28be to your computer and use it in GitHub Desktop.
Change method
import React from 'react';
import { StyleSheet, Text, View, Button, TextInput } from 'react-native';
export default class App extends React.Component {
constructor(props) {
super(props);
}
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}/>
<TextInput onChangeText={this.props.changeText}/>
</View>
);
}
handlerPress = () => {
this.props.myMethod();
}
}
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