-
Notifications
You must be signed in to change notification settings - Fork 491
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
Invariant Violation: Tried to register two views with the same name RNCPicker #403
Comments
+1 - I believe I've dealt with this same bug months ago... I uninstalled it and used another package. This isn't a new bug though. |
@jeremyablong What package did you used? |
If you have "@react-native-community/picker" installed in your package.json, please replace it to "@react-native-picker/picker". The dependency changed its npm repository name and it creates this issue if you have the old one still installed |
Any solution? |
In my case the problem was being caused by react-native-picker-select and NativeBase both using different versions of the same react native picker package. NativeBase was using the previously named "@react-native-community/picker" and react-native-picker-select was using the newly named respository "react-native-picker/picker". I resolved this issue by uninstalling the "@react-native-community/picker" and changing any imports of that package in NativeBase. |
@pm-sharma look in your package-lock.json (or yarn.lock) file for the dependency still using "@react-native-community/picker". |
The comment of @TDDEL was helpful for me. Thanks Tyler. I made another fix after read the comment of Tyler. I change the version of native-base and the app come back to work. |
How did you uninstall @react-native-community/picker? in my case it shows "error This module isn't specified in a package.json file" when i try to yarn remove. |
@nrlnv If that's the case then that means you didn't manually install @react-native-community/picker. Either way, to resolve this issue, go to your yarn.lock file and locate any packages that are using react-native-community/picker (in my case it was solely NativeBase), and then replace all imports of @react-native-community/picker within these packages with react-native-picker-select In the event that NativeBase is your only package using @react-native-community/picker, you can use this patch to resolve the issue. |
same issue here, using native base is why the issue is happening |
my working together versions
|
@stereodenis Using those specific versions worked for me. Does anyone have any idea why it seems like there are two versions of @react-native-picker/picker active if you use the latest version of @react-native-picker/picker (which is 1.9 right now) ? |
Which native-base version did you choose? |
@progerchai I resolved the issue by removing an existing native-base package. I have the following: I hope this helps |
I have react-native-picker-select 8.0.4 installed since a few months ago With that combination I had the same issue When i had a look at yarn.lock, to my surprise I saw the following:
What is up with the second line of each block pointing to a different version?! Very strange, but that's what's happening to me and I'm not sure how to fix this in a most correct manner. Update: After that, this particular problem went away, but now I have another problem
|
I have just tried that and it did not work, same two views with the same name error. |
This step by step article helped me out a lot: https://blog.logrocket.com/how-to-use-the-react-native-picker-select/ |
if you are using package "native-base", remove that from your project completely before it is too late. |
In my case, |
Thank you, I also deleted yarn.lock and removed node_modules, after doing yarn install it's working correctly again. |
I faced the same issue and it took me a while to figure out the root cause.
The issue is because "react-native-community/picker" was replaced by "react-native-picker/picker". Make sure you get rid of "react-native-community/picker" completely - as long as you don't find it in your "yarn lock" everything should work like a charm. |
Thank you! I did an
|
Just import the Picker component from your favourite library (in my case it is 'Native Base'). |
No libraries are 100% best. Even I found issues with 'react native paper' . |
This issue will be solved in this currently open PR by @Rehubbard: In the meantime, if you are using In package.json, add:
Thank you @ebaynaud, who suggested this originally here: |
an npm solution is to add an override for in package.json:
|
I was with the same issue and this solved my problem! Ty! |
In my case, the issue was with native-base. I was using an older version 2.0. The error was prompted after updating expo SDK from 41 to 42 to 43. Here is the solution that worked for me:
I don't know why, but the problem was solved. |
Crazy, this worked for me. After upgrading my native-base version it worked. Thanks |
in my case worked to use @react-native-community/picker instead of @react-native-picker/picker |
The issue is you have another package that is using @react-native-picker/picker . . in my case it was native base package . . so what I did was I utilize the native base picker since it is dominantly used in the app the I uninstalled @react-native-picker/picker |
In my case I just had to remove native-base (yarn remove native-base), then reinstall it (yarn add native-base) |
I get the same error when I trying to run the app on the Android simulator on Mac OS (with iPhone simulator everything is ok). The app an very simple, created with npx init AA --template react-native-template-typescript on Mac OS, without any other component, someone can help me?. |
It is August 2023 and the error is still present. No contributer has comment this issue. I highly recommend switching to https://github.com/talut/react-native-picker-module it works very well. |
if you are using Native base V2 and @react-native-picker/picker and Yarn as dependency manager add this to package.json
|
Describe the bug
I am trying to implement this
react-native-picker-select
in thereact-native
app but after npm install, tried to run the app but Invariant Violation: Tried to register two views with the same name RNCPickerScreenshots
Additional details
The text was updated successfully, but these errors were encountered: