TypeError: undefined is not a function..... 但错误在节点模块中(React Native / Navigation / Expo issue)

问题描述 投票:0回答:0

我正在寻求有关 React Native 应用程序的帮助。它已经很多年没有被触及了,现在我什至无法在不出错的情况下打开它。

我认为错误源于新旧依赖项的冲突,因为错误出现在节点模块中,除了输入 npm i 之外我从未接触过它。

我已经尝试更新所有内容,但这会导致更多错误,并且需要重写大量代码。我希望以前见过这个的人或有经验的开发人员可以告诉我什么是冲突的。如果有帮助,我很乐意分享更多代码!

PS:我有点自信它与反应导航有关。

感谢您的帮助!

PACKAGE.JSON

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "flow": "flow"
  },
  "dependencies": {
    "@react-native-firebase/app": "^17.3.2",
    "deprecated-react-native-prop-types": "^4.1.0",
    "expo": "^48.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "^0.71.7",
    "react-native-elements": "^3.4.3",
    "react-native-email-link": "^1.13.1",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-hyperlink": "0.0.19",
    "react-native-ionicons": "^4.6.4",
    "react-native-map-link": "^2.7.0",
    "react-native-material-bottom-navigation-performance": "^0.7.8",
    "react-native-modal-dropdown": "^1.0.2",
    "react-native-safe-area-context": "^4.5.2",
    "react-native-screens": "^3.20.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-viewport-units": "0.0.5",
    "react-native-web": "^0.19.4",
    "react-navigation": "^3.11.0",
    "sharp": "^0.32.1",
    "tcomb-form-native": "^0.6.20"
  },
  "devDependencies": {
    "@babel/cli": "^7.21.5",
    "@babel/core": "^7.21.8",
    "@babel/preset-env": "^7.21.5",
    "@babel/preset-flow": "^7.21.4",
    "@babel/preset-react": "^7.18.6",
    "@bam.tech/react-native-make": "^1.0.3",
    "babel-preset-expo": "9.0.2",
    "flow-bin": "^0.205.1",
    "react-native-clean-project": "^3.3.0"
  },
  "private": true
}

错误

TypeError: undefined is not a function

This error is located at:
    in withOrientation (at StackView.tsx:103)
    in RCTView (created by View)
    in View (at Transitioner.tsx:267)
    in Transitioner (at StackView.tsx:40)
    in StackView (at createNavigator.js:61)
    in Navigator (created by KeyboardAwareNavigator)
    in KeyboardAwareNavigator (at SceneView.js:9)
    in SceneView (at SwitchView.js:12)
    in SwitchView (at createNavigator.js:61)
    in Navigator (created by NavigationContainer)
    in NavigationContainer (created by withDevTools(NavigationContainer))
    in withDevTools(NavigationContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:102:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:148:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:52:19 in showErrorDialog
at node_modules/react/cjs/react.development.js:354:30 in Component.prototype.setState
at node_modules/@react-navigation/native/src/createAppContainer.js:393:21 in NavigationContainer#dispatch
at node_modules/@react-navigation/core/lib/module/getChildNavigation.js:1:1528 in actionHelpers.actionName
at Login.js:139:38 in fetch.then.then$argument_0
- ... 8 more stack frames from framework internals

TypeError: undefined is not a function

This error is located at:
    in NavigationContainer (created by withDevTools(NavigationContainer))
    in withDevTools(NavigationContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:102:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:148:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:52:19 in showErrorDialog
at node_modules/react/cjs/react.development.js:354:30 in Component.prototype.setState
at node_modules/@react-navigation/native/src/createAppContainer.js:393:21 in NavigationContainer#dispatch
at node_modules/@react-navigation/core/lib/module/getChildNavigation.js:1:1528 in actionHelpers.actionName
at Login.js:139:38 in fetch.then.then$argument_0
- ... 8 more stack frames from framework internals

错误出现的例子:

    componentWillUnmount() {
      this._isMounted = false;
      Linking.removeEventListener('url', this._handleOpenURL);
                                 ^
      this.subs && this.subs.remove();

      if (this._isStateful()) {
        _statefulContainerCount--;
      }
    }

我尝试更新我所有的依赖项,但它给我带来了更多麻烦并且没有修复最初的错误。我假设新/旧包之间存在冲突

现在,我更关心启动应用程序,而不是将所有内容更新到最新版本。

react-native compiler-errors dependencies node-modules react-native-navigation
© www.soinside.com 2019 - 2024. All rights reserved.