undefined 不是一个对象(评估 'RNGestureHandlerModule.State' [英] undefined is not an object (evaluating 'RNGestureHandlerModule.State'

查看:36
本文介绍了undefined 不是一个对象(评估 'RNGestureHandlerModule.State'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 React Native 项目中安装了 react-navigation.它的入门项目没有任何代码.但是在运行项目时,我遇到了这样的错误.

I have installed react-navigation in my React Native project. Its a starter project doesn't have any codes. But while running project I am facing error like this.

这是我的导航代码

import { createStackNavigator } from 'react-navigation';

import Home from './screens/Home';
import WeatherDetail from './screens/WeatherDetail';


const Navigation = createStackNavigator({
  Home: { screen: Home },
  WeatherDetail: {
  screen: WeatherDetail
 } 
});

export default Navigation;

这里是 App.js 代码

And here is the App.js codes

 import Navigator from './Router';


 export default class App extends Component {
   render() {
     return (
       <View style={styles.container}>
         <Navigator />
       </View>
     );
    }
  }

如果我从 App.js 中删除导航器组件并将其替换为 Text,则应用程序运行时不会出现任何错误.

If I remove the navigator component from the App.js and replace it with a Text the application runs without any error.

推荐答案

  1. 删除 node_modules 和 package-lock.json
  2. npm install
  3. npm install --save react-navigation
  4. npm install --save react-native-gesture-handler
  5. react-native 链接

这篇关于undefined 不是一个对象(评估 'RNGestureHandlerModule.State'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆