Skip to content
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

Tried to register two views with the same name #15

Closed
enzzoperez opened this issue Aug 15, 2019 · 64 comments
Closed

Tried to register two views with the same name #15

enzzoperez opened this issue Aug 15, 2019 · 64 comments
Assignees

Comments

@enzzoperez
Copy link

enzzoperez commented Aug 15, 2019

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:

 // Tried to register two views with the same name AndroidDropdownPicker

Library version: 0.59.9

@Akhnaten972
Copy link

+1

@jainkuniya jainkuniya self-assigned this Aug 20, 2019
@danieljgp2
Copy link

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 ?

@jainkuniya
Copy link
Collaborator

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

@danieljgp2
Copy link

@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.

@sofiageo
Copy link

sofiageo commented Oct 31, 2019

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.

@Sroka
Copy link

Sroka commented Dec 18, 2019

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

@sofiageo
Copy link

sofiageo commented Dec 18, 2019

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';

@chakrihacker
Copy link
Contributor

Is this bug still exists??

@danieljgp2
Copy link

@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

@chakrihacker
Copy link
Contributor

@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.

@johnjoshuadablo
Copy link

+1

Library version: 0.59.9

Screen Shot 2020-04-22 at 4 31 07 PM

@orion151
Copy link

I have same issue.
"react-native": "0.62.2",
"@react-native-community/picker": "^1.3.0",

please solve this proble

@chakrihacker
Copy link
Contributor

Is this happening in new rn versions?

@orion151
Copy link

I found why this error occurs.

@orion151
Copy link

Can you share your package.json file?

@orion151
Copy link

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.

@khalednailigit
Copy link

+1

@KawaljeetSBagga
Copy link

KawaljeetSBagga commented Apr 27, 2020

+1. Did ANYONE get rid of this?

"react-native": "0.62.0",
"@react-native-community/picker": "^1.3.0"

@hussainhspl
Copy link

@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 ?

@hussainhspl
Copy link

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

@rpCal
Copy link

rpCal commented Apr 30, 2020

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!

@jafar-jabr
Copy link

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"

@MrNoino
Copy link

MrNoino commented May 6, 2020

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.

@MrNoino
Copy link

MrNoino commented May 7, 2020

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.

@iYahya
Copy link

iYahya commented May 7, 2020

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 ?

@MrNoino
Copy link

MrNoino commented May 7, 2020

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 ?

Picker

PS: I use functions to render the elements so if you use class to render, you should realize that "onValueChange" and "selectedValue" work diferent.

@mrinal-roy
Copy link

mrinal-roy commented May 22, 2020

@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 ?

@haocse
Copy link

haocse commented May 25, 2020

@mrinal-roy-au2 Yes, iOS app works, this problem happens on the Android app

@rassemdev
Copy link

@haocse Picker in React-Native is deprecated. And they are suggesting this one. So need to sort this out within it.

@sfarkas1988
Copy link

Same issue here. using import { Picker } from 'react-native' is not a solution as suggested by @haocse

@rassemdev
Copy link

anybody found any solution except importing from RN!

@introin
Copy link

introin commented Jun 7, 2020

+1

@zouhairjabiri
Copy link

zouhairjabiri commented Jun 10, 2020

I Fix this probleme by :
Removing import { Picker } from '@react-native-community/picker';
And use import { Picker } from 'react-native'

@ovidiumunteanu
Copy link

Same Here.
Is there any solution?
I think my error comes from Picker from @react-native-community/picker and react-native-country-picker-modal

@adrian1388
Copy link

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.

@LohanaPawan
Copy link

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.

@introin
Copy link

introin commented Jun 16, 2020

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.

@saim1309
Copy link

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.

@raymochi
Copy link
Contributor

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

@kesha-antonov
Copy link

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

@diogoaltoe
Copy link

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)

@hengkx
Copy link

hengkx commented Oct 13, 2020

"@react-native-community/picker": "^1.8.1", same issue.

@grekosys
Copy link

grekosys commented Nov 7, 2020

Yo tenía el mismo problema. Lo solucione desinstalando react-native-picker-select. Esté tiene conflicto con native-base.

@altany
Copy link

altany commented Dec 8, 2020

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

@MehmetKaplan
Copy link

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"
	 },

@Wei102193
Copy link

Wei102193 commented Jan 7, 2021

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.

@MehmetKaplan
Copy link

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.

@nandorojo
Copy link
Contributor

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.

@gluons
Copy link

gluons commented Jan 14, 2021

Uninstall old @react-native-community/picker and install latest @react-native-picker/picker solve this problem for me.

@jdoherty61
Copy link

jdoherty61 commented Jan 16, 2021

#45 (comment) - Was stuck on this for a bit and came across this comment.

@guicompeng
Copy link

guicompeng commented Jan 20, 2021

#15 (comment) and #15 (comment)
Thanks, it worked for me.

@iguilhermeluis
Copy link

 <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!

@DimanshaMalrindu
Copy link

DimanshaMalrindu commented Jan 25, 2021

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

@nayookyaw
Copy link

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

@vijaychouhan-rails
Copy link

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

@dan-fein
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests