Created
August 16, 2018 15:36
-
-
Save adrian-afergon/b741132ee48dc4f5ac83e78a70637bc7 to your computer and use it in GitHub Desktop.
Add injectable method
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
import React from 'react'; | |
import { StyleSheet, Text, View, Button } 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}/> | |
</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