首页 > 解决方案 > React Navigation - 即使安装并链接了手势处理程序,“无法读取未定义的属性‘状态’”

问题描述

问题

尝试在 React Navigation 中使用堆栈导航器时出现错误“无法读取未定义的属性‘状态’”。Switch 和 bottomTabNavs 运行良好。

如果有人知道如何解决这个问题,那就太棒了!

我试过的

我已经检查以确保 react-native-gesture-handler 已正确安装和链接。

我的 Package.json:

{
  "name": "app",
  "version": "5.1.0",
  "private": true,
  "devDependencies": {
    "babel-jest": "23.6.0",
    "fs-extra": "^6.0.1",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.49.2",
    "react-test-renderer": "16.7.0",
    "reactotron-react-native": "^3.2.0",
    "replace-in-file": "^3.4.2"
  },
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios --simulator=\"iPhone X\"",
    "apk": "cd android && ./gradlew assembleRelease",
    "rename": "node ./bin/rename.js",
    "start": "react-native start",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "lodash": "^4.17.11",
    "react": "16.6.3",
    "react-native": "0.58.0-rc.2",
    "react-native-firebase": "^5.2.0",
    "react-native-gesture-handler": "^1.1.0",
    "react-native-rate": "^1.1.6",
    "react-native-sensitive-info": "5.2.9",
    "react-native-splash-screen": "^3.2.0",
    "react-native-status-bar-height": "^2.3.1",
    "react-native-table-component": "^1.2.0",
    "react-navigation": "^3.3.2"
  }
}

在此处输入图像描述

标签: iosreact-nativereact-navigation

解决方案


问题是即使 react-native 链接表明包已成功链接,也没有安装 pod 文件。

要解决此问题,请执行以下步骤:

  1. 光盘
  2. 吊舱安装
  3. 清理ios文件夹
  4. 运行应用程序

推荐阅读