Last active
June 30, 2016 14:46
-
-
Save stan229/24ee10a682f5c160fdcb4ed2b34fdb20 to your computer and use it in GitHub Desktop.
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, { Component } from 'react'; | |
import { | |
View, | |
Text, | |
TouchableOpacity | |
} from 'react-native'; | |
class MyComponent extends Component { | |
componentWillMount() { | |
this.onButtonPress = this.onButtonPress.bind(this); | |
} | |
onButtonPress() { | |
this.doSomething(); | |
} | |
doSomething() { | |
console.log('doing something'); | |
} | |
render() { | |
return ( | |
<TouchableOpacity onPress={this.onButtonPress}> | |
<View style={{height: 48, width: 96, padding : 10, backgroundColor : 'green'}}> | |
<Text>Press Me</Text> | |
</View> | |
</TouchableOpacity> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment