Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. import {StackNavigator, DrawerNavigator} from 'react-navigation';
  2.  
  3. export default class HomeScreen extends React.Component {
  4. constructor(props) {
  5. super(props)
  6. this.clicked = this.clicked.bind(this)
  7. }
  8.  
  9. static navigationOptions = {
  10. drawerLabel: 'Home',
  11. };
  12.  
  13. clicked = ()=> {
  14. this.props.navigator.navigate('DrawerOpen'); // open drawer
  15. }
  16.  
  17. render() {
  18. // const {navigate} = this.props.navigation;
  19. return (
  20. <ScrollView>
  21. <View style={styles.container}>
  22.  
  23. <View style={styles.header}>
  24. <View style={{width: 50}}>
  25. <TouchableHighlight onPress={()=> {
  26. this.clicked("DrawerOpen")
  27. }}>
  28. <Image source={require('./img/hamburger_icon.png')}/>
  29. </TouchableHighlight>
  30. </View>
  31. </View>
  32. </View>
  33. </ScrollView >
  34. )
  35. }
  36. }
  37.  
  38. undefined is not an object (evaluating '_this.props.navigator.navigate')
  39. clicked
  40.  
  41. import {StackNavigator, DrawerNavigator} from 'react-navigation';
  42.  
  43. export default class HomeScreen extends React.Component {
  44.  
  45. static navigationOptions = {
  46. drawerLabel: 'Home',
  47. };
  48.  
  49. clicked = () => {
  50. this.props.navigator.navigate('DrawerOpen'); // open drawer
  51. }
  52.  
  53. render() {
  54. // const {navigate} = this.props.navigation;
  55. return (
  56. <ScrollView>
  57. <View style={styles.container}>
  58.  
  59. <View style={styles.header}>
  60. <View style={{width: 50}}>
  61. <TouchableHighlight onPress={()=>
  62. this.clicked()
  63. }>
  64. <Image source={require('./img/hamburger_icon.png')}/>
  65. </TouchableHighlight>
  66. </View>
  67. </View>
  68. </View>
  69. </ScrollView >
  70. )
  71. }
  72. }
  73.  
  74. clicked = ()=> {
  75. this.props.navigation.navigate('DrawerOpen');
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement