首页 > 解决方案 > TypeError:未定义不是函数(评估“addListener”)

问题描述

感觉有很多类似的问题就像这个一样,但似乎没有一个适合我的解决方案。这绝对不是与代码相关的问题,一切正常,我运行了更新,现在我无法通过这个错误,一些包显然不能一起工作。

这是我的堆栈跟踪:

TypeError: undefined is not a function (evaluating 'addListener')

This error is located at:
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:71)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at Router.js:70)
    in App (at Router.js:91)
    in Router (at Router.js:10)
    in RouterComponent (at App.js:41)
    in Provider (at App.js:40)
    in App (at registerRootComponent.js:35)
    in RootErrorBoundary (at registerRootComponent.js:34)
    in ExpoRootComponent (at renderApplication.js:35)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)
- node_modules\react-native-router-flux\node_modules\react-navigation\src\getChildEventSubscriber.js:72:60 in <unknown>
- node_modules\react-native-router-flux\node_modules\react-navigation\src\getChildEventSubscriber.js:72:45 in getChildEventSubscri
ber
- ... 28 more stack frames from framework internals

这是我当前的依赖项:

"dependencies": {
    "expo": "^25.0.1",
    "firebase": "^4.13.1",
    "lodash": "^4.17.10",
    "react": "16.2.0",
    "react-native": "^0.52.3",
    "react-native-router-flux": "^4.0.0-beta.30",
    "react-native-scripts": "^1.14.0",
    "react-navigation-redux-helpers": "^1.0.6",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.0",
    "jest-expo": "^25.1.0",
    "react-test-renderer": "16.2.0"
  },

希望有人遇到过和我一样的依赖问题!

非常感谢,

亚当

标签: javascriptreactjsreact-native

解决方案


找到对我有用的东西:

rm -rf node_modules
yarn cache clean
yarn install

如评论中所见:https ://github.com/aksonov/react-native-router-flux/issues/2799


推荐阅读