Closed enzzoperez closed 4 years ago
Yo tenía el mismo problema. Lo solucione desinstalando react-native-picker-select. Esté tiene conflicto con native-base.
We are importing two pickers in one scene, made sure to only import from @react-native-community/picker and not "react-native" and tried the trick with adding accessibility labels but I still get this error.
Can someone help with this as we currently have a broken app because of this.
Update: for some reason 1.9.4 was installed in our app. Downgrading to 1.9.3 for all dependencies (which was tested and working before) fixed the issue
In my case I had 2 versions in yarn.lock
Added
"resolutions": { "@react-native-community/picker": "^1.8.0" },
to package.json to fix this
A similar approach solved my case within Expo 40 and for datetimepicker, not picker:
"resolutions": {
"@react-native-community/datetimepicker": "3.0.4"
},
In my case I am using "@react-native-picker/picker": "^1.9.2", and "native-base": "^2.13.14". Somehow the latest version of "native-base" is using picker from "@react-native-community/picker" which has been deprecated. I believe this is what caused the problem on my side. So I downgrade "native-base" to version 2.13.14 where they still import picker from "react native", and It works fine. Seriously "native-base" caused too much problems, I am thinking remove it completely from my project. Hope this helps someone.
Seriously "native-base" caused too much problems, I am thinking remove it completely from my project.
Even though I respect the developers of the native-base, I could not have agreed more to above comment. It is generating more problems than it solves, especially with pickers.
I got a similar error upgrading from Expo SDK 39 -> 40. I solved it by uninstalling @react-native-community/picker
and instead installing @react-native-picker/picker
.
Uninstall old @react-native-community/picker
and install latest @react-native-picker/picker
solve this problem for me.
https://github.com/react-native-picker/picker/issues/45#issuecomment-633163973 - Was stuck on this for a bit and came across this comment.
<Picker selectedValue={formik.values.gender} accessibilityLabel={'gender'} onValueChange={(itemValue, itemIndex) => { formik.setFieldValue('gender', itemValue); }}> <Picker.Item label="Male" value="MALE" /> <Picker.Item label="Female" value="FEMALE" /> </Picker>
it work for me!
The Author renamed the library to @react-native-picker/picker. See the GitHub new repository: https://github.com/react-native-picker/picker It will resolve the issue after uninstalling the @react-native-community-picker library and rename the imported pickers to @react-native-picker/picker. If you use some other features in the @react-native-community, just rename the imported react-native-community/picker to react-native-picker/picker
I changed react-native-community/datetimepicker version from
2.4.0 to 3.0.9
"@react-native-community/datetimepicker": "^3.0.9"
We can assume the old version will get error
I installed the NativeBase version that installed "@react-native-picker/picker" "^1.9.7" as dependency and by mistake, I install @react-native-picker/picker too. So to solve this issue: remove the @react-native-picker/picker that you installed because of NativeBase already installed @react-native-picker/picker as a dependency, if you are using yarn then check on yarn.lock file
I actually realized I didn't need native-base so I just deleted it (which I know isn't possible for everyone) and that worked. I did a little more research after and it looks like I could have upgraded native-base to the latest version and it would have worked. Hope that helps anybody struggling with this one!
Bug
I tried to add the picker, the compilation is fine, but when the app is open appears a red screen with the message: Tried to register two views with the same name AndroidDropdownPicker
Update: I also use Native base in the project Can you help me please?
Environment info
React Native Environment Info: System: OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver) CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz Memory: 696.37 MB / 7.68 GB Shell: 4.4.19 - /bin/bash Binaries: Node: 8.9.0 - ~/.nvm/versions/node/v8.9.0/bin/node Yarn: 1.15.2 - /usr/bin/yarn npm: 5.5.1 - ~/.nvm/versions/node/v8.9.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: Android SDK: API Levels: 20, 22, 23, 25, 26, 27, 28 Build Tools: 23.0.1, 25.0.1, 25.0.2, 25.0.3, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.3, 28.0.3 System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64 IDEs: Android Studio: 3.4 AI-183.5429.30.34.5452501 npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.9 => 0.59.9 npmGlobalPackages: react-native-cli: 2.0.1
React native info output:
Library version: 0.59.9