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

"RNCSafeAreaProvider" was not found in the UIManager.] #422

Closed
crukundo opened this issue Feb 2, 2023 · 3 comments
Closed

"RNCSafeAreaProvider" was not found in the UIManager.] #422

crukundo opened this issue Feb 2, 2023 · 3 comments

Comments

@crukundo
Copy link

crukundo commented Feb 2, 2023

Describe the bug

This error is located at:
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider
    in Unknown (created by StorybookUIRoot)
    in StorybookUIRoot (created by withDevTools(StorybookUIRoot))
    in withDevTools(StorybookUIRoot)
    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)
 ERROR  Unhandled promise rejection [Invariant Violation: requireNativeComponent: "RNCSafeAreaProvider" was not found in the UIManager.]

To Reproduce
Please attempt to run the example app here:

Expected behavior
This looks like a new error. I have tried to install react-native-safe-area-context with yarn and via expo and it won't budge. However, I am running an expo managed app so pod install wasn't necessary before. But nonetheless when I run expo run:ios, the pods are installed. No dice with android either. The error stays.

Screenshots
This is exactly the error here #383 (comment)

**Additional context **
I am currently working with v6.0.1-beta.12 and I notice there's a new dependency for react-native-safe-area-context in v6.

@crukundo
Copy link
Author

crukundo commented Feb 2, 2023

What I have done so far:

  • Install react-native-safe-area-context with expo: npx expo install react-native-safe-area-context
  • run expo run:ios then cancel
  • Go to ios folder, run npx pod-install
  • run expo run:android then cancel
  • Remove react-native-safe-area-context: yarn remove react-native-safe-area-context
  • run yarn start -c.

Had to uninstall react-native-area-context because there's a new error: Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider. The second last step was important. I am still not sure why this workaround works and it's possible it's just me but I'm unblocked

@dannyhw
Copy link
Member

dannyhw commented Feb 6, 2023

@crukundo this usually happens when you have multiple versions of react-native-safe-area-context installed so it might be some sort of metro module resolution issue, its most common in a mono-repo where metro is resolving the package from another folder in the repo.

I've gotten past this in my projects by using rnx-kit to de-dupe modules https://microsoft.github.io/rnx-kit/docs/tools/metro-config#ensuring-a-single-instance-of-a-package

@flexbox
Copy link
Contributor

flexbox commented Mar 31, 2023

hey @crukundo If your problem is solved can you please close the issue?
It sparks joy for maintainers ✨

@crukundo crukundo closed this as completed Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants