Comments (64)
I Fix this probleme by :
Removing import { Picker } from '@react-native-community/picker';
And use import { Picker } from 'react-native'
from picker.
Fixed for me:
Remove import { Picker } from '@react-native-community/picker';
And use import { Picker } from 'react-native'
from picker.
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
from picker.
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.
from picker.
Same issue here. using import { Picker } from 'react-native'
is not a solution as suggested by @haocse
from picker.
I have same issue.
"react-native": "0.62.2",
"@react-native-community/picker": "^1.3.0",
please solve this proble
from picker.
"@react-native-community/picker": "^1.8.1", same issue.
from picker.
+1
Library version: 0.59.9
from picker.
+1. Did ANYONE get rid of this?
"react-native": "0.62.0",
"@react-native-community/picker": "^1.3.0"
from picker.
On my code setup...
<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>
Issue is related to field accessibilityLabel... If key is setup with any value = err!
from picker.
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
from picker.
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
.
from picker.
@chakrihacker Probably it does, the bug is caused when a dependency imports the picker from react-native and you import the picker from react-native-community/picker
from picker.
Is this happening in new rn versions?
yes i am using RN 0.62 app is not running and getting crashed,
and also using native base 2.13.12 version and rn picker ver 1.3.0
from picker.
@haocse the issue comes when we use { Picker }
from @react-native-community/picker
With react-native
this issue doesnot arise. But with react-native
does the {Picker}
work in iOS ?
from picker.
Hi @danieljgp2, thanks for the report. Will look into it. It will be great if you could share some code snippet, through which it is easily reproducible
from picker.
@danieljgp2 The Android native view name is changed to RNCPicker from RCTPicker but previous versions have name RCTPicker. I think by updating dependency this issue will be solved.
from picker.
In my case, I used @react-native-community/picker": "^1.3.0 and "react-native-google-places-autocomplete": "^1.4.1" in my project.
"react-native-google-places-autocomplete": "^1.4.1" used picker from react-native.
so, occured this error.
Perhaps, there are another pakage using picker from react-native like this in your project.
from picker.
if anyone still has this issue, make sure that you don't use "Picker" from an other package in my case it was "styled-components"
from picker.
anybody found any solution except importing from RN!
from picker.
In my case, I used @react-native-community/picker": "^1.3.0 and "react-native-google-places-autocomplete": "^1.4.1" in my project.
"react-native-google-places-autocomplete": "^1.4.1" used picker from react-native.
so, occured this error.
Perhaps, there are another pakage using picker from react-native like this in your project.
Makes sense, but could you please help to understand that how we can know exactly which dependency is in clash with the picker library and how to solve the issue.
from picker.
I am also facing the same issue may be for temporary basis I will use it from the react-native or native base. I am using only one picker in one of my components and the moment I import it from '@react-native-community/picker' it throws that error.
Anyways, if anybody come across the solution, please please let us know.
from picker.
Yo tenía el mismo problema. Lo solucione desinstalando react-native-picker-select. Esté tiene conflicto con native-base.
from picker.
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"
},
from picker.
Uninstall old @react-native-community/picker
and install latest @react-native-picker/picker
solve this problem for me.
from picker.
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
from picker.
+1
from picker.
Im facing this error too, this error seems to be related with the dependencies, there is probably a dependency working with the picker of react-native.
Any idea about how to fix it @jainkuniya ?
from picker.
@jainkuniya which react native version are you using as a dependecy ? i dont know if the problem is related to any dependecy of my project or any dependency of the library but im pretty sure that problem is related with the changes of RN version after 0.59 and the deprecation of the Picker.
from picker.
I ran into this issue. For me it was caused by a wrong import on my project, which was looking for react-native Picker. But what I noticed is that even on react-native 0.61.2 package, this PR was not included. It's probably not a bug just some libraries would need to update their imports.
from picker.
Any news on this? I have the same problem and cannot get rid of it :/ @sofiageo How did you manage to figure out where offending react-native Picker import was? I check my whole app and there are no usages of Picker. Tried to search in node_nodules to check if some lib uses it but no luck
from picker.
Any news on this? I have the same problem and cannot get rid of it :/ @sofiageo How did you manage to figure out where offending react-native Picker import was? I check my whole app and there are no usages of Picker. Tried to search in node_nodules to check if some lib uses it but no luck
It was easy for me because I only had 2 imports of Picker. How are you searching in node_modules? If it is a multi-import from react-native you will have to only search for the word Picker.
The correct import should be import {Picker} from '@react-native-community/picker';
from picker.
Is this bug still exists??
from picker.
Is this happening in new rn versions?
from picker.
I found why this error occurs.
from picker.
Can you share your package.json file?
from picker.
+1
from picker.
@danieljgp2 The Android native view name is changed to RNCPicker from RCTPicker but previous versions have name RCTPicker. I think by updating dependency this issue will be solved.
how to update dependency ?
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.
I am using class component and using a single dropdown, still getting error. Then i added accessibility as you suggested, still getting same error
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.I am using class component and using a single dropdown, still getting error. Then i added accessibility as you suggested, still getting same error
If your error like me is "Tried to resgister two views with the same name AndroidDropdowPicker" like above in screenshoot uploaded by @sislovesmedotcom, you should have at least 2 Pickers because this error is about having the same name (accessibilityLabel) for two or more Pickers. Make sure if you have only one Picker in all Project or atributte diferents values to accessibilityLabel in case you have more than one dropdown. The reason why you have to attibute diferents values to accessibilityLabel is because react native attribute a default value that is equal for every Pickers.
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.I am using class component and using a single dropdown, still getting error. Then i added accessibility as you suggested, still getting same error
If your error like me is "Tried to resgister two views with the same name AndroidDropdowPicker" like above in screenshoot uploaded by @sislovesmedotcom, you should have at least 2 Pickers because this error is about having the same name (accessibilityLabel) for two or more Pickers. Make sure if you have only one Picker in all Project or atributte diferents values to accessibilityLabel in case you have more than one dropdown. The reason why you have to attibute diferents values to accessibilityLabel is because react native attribute a default value that is equal for every Pickers.
As soon as i import Picker it show error even if i am not using a single drop-down. I think problem lies within the npm package because i get this error just after importing. I am using RN 0.62. Hence it supports autolinking but after getting error several times i thought may be issue is due to bad linking hence tried manual linking. But it didn't help
from picker.
I have 3 Pickers in one screen and I solve the same problem as you by adding accessibilityLabel={'pickername'} in all 3 Pickers, with diferent values.
But what when we have to show picker item dynamically through api...
You should use "accessibilityLabel={'pickername'}" in Picker atributes and generate picker items dinamycally unless you have to generate picker dinamically as well.
could you attach a screenshot of your solution ?
PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.I am using class component and using a single dropdown, still getting error. Then i added accessibility as you suggested, still getting same error
If your error like me is "Tried to resgister two views with the same name AndroidDropdowPicker" like above in screenshoot uploaded by @sislovesmedotcom, you should have at least 2 Pickers because this error is about having the same name (accessibilityLabel) for two or more Pickers. Make sure if you have only one Picker in all Project or atributte diferents values to accessibilityLabel in case you have more than one dropdown. The reason why you have to attibute diferents values to accessibilityLabel is because react native attribute a default value that is equal for every Pickers.
As soon as i import Picker it show error even if i am not using a single drop-down. I think problem lies within the npm package because i get this error just after importing. I am using RN 0.62. Hence it supports autolinking but after getting error several times i thought may be issue is due to bad linking hence tried manual linking. But it didn't help
I assume you import "@react-native-community/picker" because the same problem as I, receiving a warning telling that Picker will be descontinued from react-native. I installed this library and I didn't need to linking manually. Then became this error and I fixed by implement the solution that I shared here.
So, my advice to you is reinstall the library and check if you are getting that error yet.
from picker.
Finally i found my fixes, I am using styled component in my project, hence to customize picker I used picker into styled to add styling
After removing this, i get rid of error
from picker.
Finally i found my fixes, I am using styled component in my project, hence to customize picker I used picker into styled to add styling
After removing this, i get rid of error
I'm glad you fixed the error.
I wish you a good work and nice coding.
from picker.
+1
from picker.
@mrinal-roy-au2 Yes, iOS app works, this problem happens on the Android app
from picker.
@haocse Picker in React-Native is deprecated. And they are suggesting this one. So need to sort this out within it.
from picker.
+1
from picker.
Same Here.
Is there any solution?
I think my error comes from Picker from @react-native-community/picker and react-native-country-picker-modal
from picker.
May be you all still are using Picker from 'react-native' somewhere in your project.
Be sure to not import from 'react-native'
Even I can use {Picker} from '@react-native-community/picker' inside styled-components this way:
const MyPicker = styled(Picker)...
This was my case.
from picker.
For now, I have started using Picker from native base library and the issue appears fixed for me albeit few design issue I needed to address in such.
from picker.
So, I ran into this issue and got it working by changing the name of AndroidDropdownPicker to RNCAndroidDropdownPicker, did the same for dialogpicker.
I opened up a PR for the changes, you can see them here: #99
from picker.
In my case, here is the way I found to temporarily solve the problem. It is obviously not the best way, but it was the one I found at the time.
GeekyAnts/NativeBase#3114 (comment)
from picker.
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
from picker.
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.
from picker.
#45 (comment) - Was stuck on this for a bit and came across this comment.
from picker.
#15 (comment) and #15 (comment)
Thanks, it worked for me.
from picker.
<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!
from 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
from picker.
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!
from picker.
Related Issues (20)
- Do not use this repo HOT 2
- bug: don't work: no label and no value HOT 8
- TypeError: Cannot read property 'Picker' of undefined HOT 2
- Picker 2.6+ transforms numeric values to strings HOT 4
- Selected value jumps back to first value when "Done" is tapped - Picker library v2.6.1, iOS only HOT 3
- @react-native-picker/picker could not be found within the project or in these directories
- react-native 0.71.8 with @react-native-picker/picker HOT 3
- can't remove gray background on IOS picker HOT 1
- On iOS, the value selected in onValueChange comes in null
- Picker Item is not listed on IOS HOT 9
- Border styles is not working HOT 1
- the problem of selectionColor HOT 3
- New version(2.7.0) compile time issue in android | Keeps app crashing HOT 3
- Facing Error when create debug app build: public record ReactPickerLocalData(int height) { ^ (use -source 16 or higher to enable records) HOT 4
- Error after npm run android HOT 2
- Run Android triggers Execution failed for task ':app:mergeLibDexDebug'
- how to disable font scaling of @react-native-picker/picker HOT 1
- Attempt to invoke interface method 'com.facebook.react.bridge.ReadableNativeMap com.facebook.react.uimanager.StateWrapper.getStateData()' on a null object reference HOT 2
- onValueChange callback has its arg only accepting string type now HOT 5
- enabled={false} not working on ios
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picker.