Advertisement
thibthibaut

Untitled

Jan 4th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import React from 'react-native';
  2.  
  3.  
  4. var {View,
  5. Text,
  6. StyleSheet,
  7. TouchableOpacity,
  8. AppRegistry,
  9. Component} = React;
  10.  
  11. class HelloThere extends Component {
  12. props.prenom = 'Thomas';
  13.  
  14. clickMe() {
  15. alert('coucou');
  16. }
  17. render() {
  18. return (
  19. <View style={styles.container}>
  20. <TouchableOpacity onPress={this.clickMe.bind(this)}>
  21. <View style={styles.box}>
  22. <Text>Hello {this.props.prenom}. Please click me.</Text>
  23. </View>
  24. </TouchableOpacity>
  25. </View>
  26. );
  27. }
  28. }
  29.  
  30. var styles = StyleSheet.create({
  31. container: {
  32. flex: 1,
  33. justifyContent: 'center',
  34. alignItems: 'center'
  35. },
  36. box: {
  37. borderColor: 'red',
  38. backgroundColor: '#fff',
  39. borderWidth: 1,
  40. padding: 10,
  41. width: 100,
  42. height: 100
  43. }
  44. });
  45.  
  46.  
  47.  
  48. AppRegistry.registerComponent('SampleApp', function() {
  49. return MainComponent;
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement