2

I get this error and it's driving me insane, I cannot even start a simple application on React Native. I am using the most basic example, with a fresh project and still throws this error. I use react-navigation v3xx Someone please help because I am losing my mind, thank you. Here is the code I have:

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Button, TouchableHighlight} from 'react-native';
import { createAppContainer, createStackNavigator, StackActions, NavigationActions } from 'react-navigation'; // Version can be specified in package.json


class Home extends React.Component {
  static navigationOptions = {
    title: "Home",
  }
  render() {
    return (
      <View style={styles.container}>
        <Text>Home Page</Text>
        <Button onPress={() => this.props.navigation.navigate('About')} title="All about me" />
      </View>
    );
  }
}

class AboutMeMe extends React.Component {
  static navigationOptions = {
    title: "All Me",
  }
  render() {
    return (
      <View style={styles.container}>
        <Text>Home Page</Text>
        <Button onPress={() => this.props.navigation.goBack()} title="<< Back" />
      </View>
    );
  }
}

const AppScreens = createStackNavigator({
  Home: Home,
  About: AboutMeMe
})

const App = createAppContainer(AppScreens);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});


export default App;
squeekyDave
  • 918
  • 2
  • 16
  • 35
  • Possible duplicate of: https://stackoverflow.com/questions/52861437/undefined-is-not-an-object-evaluating-rngesturehandlermodule-state?rq=1 – Matt Aft Nov 20 '18 at 21:14

2 Answers2

5

Hellow

As react navigation now depends on gesture so you must install an additional library to go after you have installed the react-navigation library

Run this command inside your project from your terminal

npm install --save react-native-gesture-handler

Then run this one

react-native link react-native-gesture-handler

These instructions are well explained here

https://reactnavigation.org/docs/en/getting-started.html#installation

for new react navigation version

Best regards

Last Breath
  • 530
  • 2
  • 12
2
npm install --save react-native-gesture-handler
react-native link react-native-gesture-handler
user987339
  • 10,519
  • 8
  • 40
  • 45
  • 1
    Please try to provide a nice description about how your solution works. See: [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer) Thanks – Rajesh Pandya Nov 27 '18 at 07:12