Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[13], "@react-navigation/elements").SafeAreaProviderCompat') #11006

Open
3 of 11 tasks
mahdinjim opened this issue Nov 16, 2022 · 6 comments

Comments

@mahdinjim
Copy link

mahdinjim commented Nov 16, 2022

Current behavior

I upgraded to react native 0.70.5 and also upgraded react-navigation/native to version 6.0.13 and react-navigation/native-stack to version 6.9.1, after successfully running the project on ios I get the following exceptions:
TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[13], "@react-navigation/elements").SafeAreaProviderCompat')
Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install.
Error: Requiring module "node_modules/@react-navigation/elements/src/index.tsx", which threw an exception: Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install.
I cleaned the project and re install everything but the issue persisted
Simulator Screen Shot - iPhone 14 Pro - 2022-11-16 at 16 02 54
Simulator Screen Shot - iPhone 14 Pro - 2022-11-16 at 16 03 15
Simulator Screen Shot - iPhone 14 Pro - 2022-11-16 at 16 03 21

Expected behavior

run normally

Reproduction

//

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/​bottom-tabs
  • @react-navigation/​drawer
  • @react-navigation/​material-bottom-tabs
  • @react-navigation/​material-top-tabs
  • @react-navigation/​stack
  • @react-navigation/​native-stack

Environment

  • [] I've removed the packages that I don't use
package version
@react-navigation/native ^6.0.13
@react-navigation/bottom-tabs ^6.4.0
@react-navigation/native-stack ^6.9.1
react-native-safe-area-context 4.4.1
react-native-screens 3.18.2
react-native-gesture-handler 2.8.0
react-native-reanimated 2.12.0
react-native 0.70.5
node 16.14.0
npm 8.3.1
@github-actions
Copy link

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link, a www.typescriptlang.org/play link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

A repro will help us debug the issue. The issue will be closed automatically after a while if you don't provide a repro.

@renchap
Copy link
Contributor

renchap commented Nov 22, 2022

I am seeing a similar issue after upgrading from:

    "@react-navigation/bottom-tabs": "6.3.2",
    "@react-navigation/devtools": "6.0.8",
    "@react-navigation/native": "6.0.11",
    "@react-navigation/native-stack": "6.7.0",
    "@react-navigation/stack": "6.2.2",

to any later version.

I tried commenting everything from my app except a simple screen, and I am still getting this.

When I switch the navigator to a non-native stack navigator, I am getting this error:

 ERROR  TypeError: Cannot read property 'SafeAreaProviderCompat' of undefined

This error is located at:
    in StackView (created by StackNavigator)
    in Unknown (created by StackNavigator)
    in StackNavigator (created by RootScreen)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
…

@mahdinjim I see you provided a repro repository, but for me it builds and run correctly. Is it supposed to reproduce the issue?

@marcuzgabriel
Copy link

marcuzgabriel commented Nov 24, 2022

I updated everything to lates. I experienced the same error at first but found a fix.

While troubleshooting and looking at above pictures i noticed two modules which @react-navigation requires but are undefined:

  "@react-native-masked-view/masked-view": "^0.2.8",
  "@react-navigation/elements": "^1.3.7",

I included them in my package.json, yarn install, cleaned build folder and rebuild. Everything now works as expected. Guess @react-navigation should either update documentation to tell users that these two packages are required or include them in the @react-navigation package node_modules automatically.

My packages:

    "@react-native-masked-view/masked-view": "^0.2.8",
    "@react-navigation/bottom-tabs": "6.3.2",
    "@react-navigation/devtools": "6.0.8",
    "@react-navigation/elements": "^1.3.7",
    "@react-navigation/native": "6.0.11",
    "@react-navigation/native-stack": "6.7.0",
    "@react-navigation/stack": "6.2.2",

@cleandevcode
Copy link

Same issue.
But I see this error with my customized components.

Work environment:

macOS: Ventura
Xcode: 14
Ruby: 3.0.0
node: v16
React Native: 0.66

I remember it works fine before, but happened recently.

@ashankaushalya97
Copy link

I updated everything to lates. I experienced the same error at first but found a fix.

While troubleshooting and looking at above pictures i noticed two modules which @react-navigation requires but are undefined:

  "@react-native-masked-view/masked-view": "^0.2.8",
  "@react-navigation/elements": "^1.3.7",

I included them in my package.json, yarn install, cleaned build folder and rebuild. Everything now works as expected. Guess @react-navigation should either update documentation to tell users that these two packages are required or include them in the @react-navigation package node_modules automatically.

My packages:

    "@react-native-masked-view/masked-view": "^0.2.8",
    "@react-navigation/bottom-tabs": "6.3.2",
    "@react-navigation/devtools": "6.0.8",
    "@react-navigation/elements": "^1.3.7",
    "@react-navigation/native": "6.0.11",
    "@react-navigation/native-stack": "6.7.0",
    "@react-navigation/stack": "6.2.2",

Worked for me. Thanks a lot.

@mahdinjim
Copy link
Author

"@react-native-masked-view/masked-view": "^0.2.8",
"@react-navigation/bottom-tabs": "6.3.2",
"@react-navigation/devtools": "6.0.8",
"@react-navigation/elements": "^1.3.7",
"@react-navigation/native": "6.0.11",
"@react-navigation/native-stack": "6.7.0",
"@react-navigation/stack": "6.2.2",

That worked for me as well thank you very much

Artotim added a commit to Artotim/maps that referenced this issue May 31, 2023
When starting app without masked-vew dependency it causes an error importing SafeAreaProviderCompat as stated on this thread: react-navigation/react-navigation#11006

This commit applies the fix suggested here:
react-navigation/react-navigation#11006 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants