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 issueExplain 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)
- Configure a sample screen using react-navigation/stack -> “5.6.2” and react-native-elements -> “2.3.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'} />}
/>
)
- Upgrade
react-native-elements
to version 3.0.0 - You should be faced with Exception - “Tried to register two views with the same name RNCSafeAreaProvider”
Screenshots (Required)
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:
- Created 3 years ago
- Comments:17 (3 by maintainers)
Top GitHub Comments
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.@CKitisak
In
yarn.lock
I searched forreact-native-elements
and looked at its dependencies list to see what version ofreact-native-safe-area-context
it depends on.In my case
react-native-elements
depends onreact-native-safe-area-context@3.1.9
but I also hadreact-native-safe-area-context@3.1.4
installed. So I just deleted the 3.1.4 from myyarn.lock
,package.json
andnode_modules
and reinstalled it@3.1.9
.