Typescript TypeError:undefined不是一个对象(计算';this.\u callListeners.bind';)

Typescript TypeError:undefined不是一个对象(计算';this.\u callListeners.bind';),typescript,react-native,react-navigation,Typescript,React Native,React Navigation,我有一个react native应用程序,带有typescript,不使用Expo。在iOS中运行时,我在启动屏幕后出现以下错误。我知道这可能与react导航正在使用react原生手势处理程序有关,但这也包含在我的应用程序中并链接在一起。这也可能是因为缺少typescript类型,但添加@types/react导航也没有帮助 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (eval

我有一个react native应用程序,带有typescript,不使用Expo。在iOS中运行时,我在启动屏幕后出现以下错误。我知道这可能与
react导航
正在使用
react原生手势处理程序
有关,但这也包含在我的应用程序中并链接在一起。这也可能是因为缺少typescript类型,但添加
@types/react导航
也没有帮助

[error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'this._callListeners.bind')

This error is located at:
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.js:79)
    in RCTView (at View.js:45)
    in View (at Transitioner.js:215)
    in Transitioner (at StackView.js:22)
    in StackView (created by Navigator)
    in Navigator (at createKeyboardAwareNavigator.js:12)
    in KeyboardAwareNavigator (at createAppContainer.js:388)
    in NavigationContainer (at App.tsx:69)
    in Provider (at App.tsx:68)
    in App (at renderApplication.js:34)
    in RCTView (at View.js:45)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:45)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:33)
我尝试了react-native链接、清理react-native缓存、删除节点\ U模块文件夹并重新安装、清理npm缓存、从头重新安装应用程序、重置iOS模拟器内容

以下是我的package.json供参考:

  "dependencies": {
    "autobind-decorator": "^2.4.0",
    "axios": "^0.18.0",
    "base64-js": "^1.3.0",
    "bluebird": "^3.5.3",
    "crypto-js": "^3.1.9-1",
    "firebase": "^5.8.2",
    "firebase-nest": "^0.7.1",
    "i18next": "^12.1.0",
    "jsc-android": "^236355.1.1",
    "lodash": "^4.17.11",
    "mobx": "^5.6.0",
    "mobx-firebase-store": "^1.2.1",
    "mobx-react": "^5.3.6",
    "moment": "^2.22.2",
    "native-base": "^2.11.0",
    "react": "16.6.3",
    "react-native": "^0.58.5",
    "react-native-gesture-handler": "^1.0.15",
    "react-native-splash-screen": "^3.2.0",
    "react-native-swift": "^1.2.2",
    "react-native-swiper": "^1.5.13",
    "react-native-track-player": "^1.1.2",
    "react-native-vector-icons": "^6.3.0",
    "react-navigation": "^3.0.9",
    "@types/bluebird": "^3.5.24",
    "@types/react": "^16.8.3",
    "@types/react-native": "^0.57.36",
    "@types/react-navigation": "^3.0.3",
    "@types/react-test-renderer": "^16.0.3"
  },
  "devDependencies": {
    "@babel/plugin-proposal-class-properties": "^7.3.3",
    "@babel/plugin-proposal-decorators": "^7.1.6",
    "@babel/preset-typescript": "^7.3.3",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "24.1.0",
    "babel-preset-mobx": "^2.0.0",
    "jest": "24.1.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-native-typescript-transformer": "^1.2.11",
    "react-test-renderer": "16.6.3",
    "tslint": "^5.11.0",
    "tslint-config-prettier": "^1.16.0",
    "tslint-config-standard": "^8.0.1",
    "tslint-react": "^3.6.0",
    "typescript": "^3.3.3"
  },
这里还有我的LRC内容:

{
  "presets": [
    "module:metro-react-native-babel-preset",
    "mobx"
  ],
  "plugins": [
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    [
      "@babel/plugin-proposal-class-properties",
      {
        "loose": true
      }
    ]
  ]
}

那些没有解决这个问题的人。在react native运行android或ios之前,请尝试在终端中运行react native start。在我的例子中,都是关于节点js窗口的

尝试将
@babel/plugin转换流条类型
添加到您的
babel.config.js

{
  "presets": [
    "module:metro-react-native-babel-preset",
    "mobx"
  ],
  "plugins": [
    ['@babel/plugin-transform-flow-strip-types'],
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    [
      "@babel/plugin-proposal-class-properties",
      {
        "loose": true
      }
    ]
  ]
}

查看并

我通过安装这些devdependency:
“@babel/core”:“^7.3.4”,“@babel/plugin转换流条类型”:“^7.3.4”
并将这一行添加到babel.config.js:
插件:['@babel/plugin转换流条类型'],['@babel/plugin建议类属性',{'loose':true}]
我不得不承认,使用最新版本的react-native及其依赖项是个坏主意。对于我发现的其他问题,我恢复了一切,以作出反应。虫子太多了!!更新:当我更新到RN 59和RN 60时,这个问题就完全消失了。这个解决方案对我有效。我没有包括“mobx”预设,否则我的babel配置如上所述。一个重要的细节是插件的顺序@babel/plugin转换流条类型必须是第一个。我在RN@0.63.4, RNN@7.11.3, mobx@3.6.2,mobx-react@4.4.3.