Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {
  3. View,
  4. Text,
  5. TouchableOpacity
  6. } from 'react-native';
  7.  
  8.  
  9. class MyComponent extends Component {
  10. componentWillMount() {
  11. this.doSomething = this.doSomething.bind(this);
  12. }
  13.  
  14. onButtonPress() {
  15. this.doSomething();
  16. }
  17.  
  18. doSomething() {
  19. console.log('doing something');
  20. }
  21.  
  22. render() {
  23. return (
  24. <TouchableOpacity onPress={this.onButtonPress}>
  25. <View style={{height: 48, width: 96, padding : 10, backgroundColor : 'green'}}>
  26. <Text>Press Me</Text>
  27. </View>
  28. </TouchableOpacity>
  29. );
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement