question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Misleading error after upgrading from 2.3.2 to 3.0.0 - "Tried to register two views with the same name RNCSafeAreaProvider"

See original GitHub issue

Explain what you did (Required)

I work on upgrading react-native-elements from 2.0.2 to the latest stable version (3.0.0). Update to 3.0.0 yielded the following Exception - “Tried to register two views with the same name RNCSafeAreaProvider” Stack trace got me to the line import { Icon, Input } from 'react-native-elements' (Upgrading just to the previous version 2.3.3 was successful)

Expected behavior (Required)

Obviously, after such a major update I expected to be faced with plenty of errors. However, I expected to see more errors such as “no such import”, “invalid props” allowing me to easier spot the error and adjust code.

Describe the bug (Required)

It seems that there is some unobvious imports collision causing this error or just some misleading error message.

To Reproduce (Required)

  1. Configure a sample screen using react-navigation/stack -> “5.6.2” and react-native-elements -> “2.3.2”
  2. On aforementioned screen use Input and render Icon as a leftIcon prop. Example:
import { Icon, Input } from 'react-native-elements'
const SignInScreen = (props) => (
               <Input
                leftIcon={<Icon name={'mail'} />}
              />
)

  1. Upgrade react-native-elements to version 3.0.0
  2. You should be faced with Exception - “Tried to register two views with the same name RNCSafeAreaProvider”

Screenshots (Required) image

Your Environment (Required):

software version
react-native-elements 3.0.0
react-native 0.63.3

Thanks in advance for taking a look

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
flyingcirclecommented, Dec 22, 2020

I’m guessing that the issue is that you have 2 different versions of react-native-safe-area-view installed? Try seeing if that is the issue in your lock file.

3reactions
bpoloniacommented, Jan 5, 2021

@CKitisak

In yarn.lock I searched for react-native-elements and looked at its dependencies list to see what version of react-native-safe-area-context it depends on.

In my case react-native-elements depends on react-native-safe-area-context@3.1.9 but I also had react-native-safe-area-context@3.1.4 installed. So I just deleted the 3.1.4 from my yarn.lock, package.json and node_modules and reinstalled it @3.1.9.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invariant Violation: Tried to register two views with the same ...
Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider error with @react-navigation/stack.
Read more >
Invariant Violation: Tried to register two views with the ... - GitHub
In my case, I'm starting a new expo project and simply installing react navigation (following the official guide). I can see that simply ......
Read more >
Invariant Violation: Tried to register two views with the same ...
[Solved]-Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider error with @react-navigation/stack-Reactjs.
Read more >
Tried to register two views with the same name RNSVGSvgView
I want to use svg, and if I use it I get the error message. I use expo and have installed expo install...
Read more >
Upgrading from 3.x - React Navigation
This will install versions of these libraries that are compatible. Installing dependencies into a bare React Native project​. In your project directory, run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found