Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react-native';
- var {View,
- Text,
- StyleSheet,
- TouchableOpacity,
- AppRegistry,
- Component} = React;
- class HelloThere extends Component {
- props.prenom = 'Thomas';
- clickMe() {
- alert('coucou');
- }
- render() {
- return (
- <View style={styles.container}>
- <TouchableOpacity onPress={this.clickMe.bind(this)}>
- <View style={styles.box}>
- <Text>Hello {this.props.prenom}. Please click me.</Text>
- </View>
- </TouchableOpacity>
- </View>
- );
- }
- }
- var styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: 'center',
- alignItems: 'center'
- },
- box: {
- borderColor: 'red',
- backgroundColor: '#fff',
- borderWidth: 1,
- padding: 10,
- width: 100,
- height: 100
- }
- });
- AppRegistry.registerComponent('SampleApp', function() {
- return MainComponent;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement