Skip to content

Instantly share code, notes, and snippets.

@stan229
Last active June 30, 2016 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stan229/24ee10a682f5c160fdcb4ed2b34fdb20 to your computer and use it in GitHub Desktop.
Save stan229/24ee10a682f5c160fdcb4ed2b34fdb20 to your computer and use it in GitHub Desktop.
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