lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.76k stars 499 forks source link

Invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager. #402

Open ravi-poonia opened 3 years ago

ravi-poonia commented 3 years ago

Describe the bug
Followed all the steps mentioned in Readme. Throws error in android : Invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager.

To Reproduce
Steps to reproduce the behavior:

Install and run the package with the default config on android.

Expected behavior
The app should not crash for android

Screenshots

Additional details

Reproduction and/or code sample
Provide a link to a reproduction of this issue on https://snack.expo.io or an explanation why you can not. Not including a snack link will result in a significant delay in our ability to address this issue.

ravi-poonia commented 3 years ago

Downgrading @react-native-picker/picker to 1.8.3 worked for me. 💯

raldred commented 3 years ago

Not really closed, as this is an issue, out the box the Picker fails. Due to this issue image

prasad456 commented 3 years ago

Having this issue in iOS Simulator, but after installing this @react-native-picker/picker : ^1.9.4" package issue fixed.

raldred commented 3 years ago

Maybe fixed by 1.9.6 then https://github.com/react-native-picker/picker/pull/190

ajoykarmakar459 commented 3 years ago

This fixed the issue for me -

npx react-native link
android -
re-run react-native run-android command

ios - 
cd ios
pod install
re-run react-native run-ios command
mustapha-ghlissi commented 3 years ago

The solution is to install correctly the lib and its dependency:


npm install react-native-picker-select
npm install @react-native-picker/picker

If the error always persists, just enter this command line to link manually the lib: npx react-native link

Enjoy !

zoultrex commented 3 years ago

The solution is to install correctly the lib and its dependency:


npm install react-native-picker-select
npm install @react-native-picker/picker

If the error always persists, just enter this command line to link manually the lib: npx react-native link

Enjoy !

Doing this I get Invariant Violation: Tried to register two views with the same name RNCAndroidDropdownPicker Did you have this problem too and managed to solve it somehow?

dustinyoste commented 3 years ago

Took quite a few gathered steps to get the update working for me, you might not require all of these, but maybe they can help.

Firstly, I did update to react-native v0.63.4 (probably not necessary).

These steps come after upgrading this, react-native-picker-select, package to 8.0.3

  1. npm install @react-native-picker/picker@1.8.3

  2. Add to package.json

    "resolutions": {
        "react-native-picker-select/**/@react-native-picker/picker": "1.8.3"
    },
  3. react-native link @react-native-picker/picker

  4. Add to android/app/build.gradle

    dependencies {
    ... 
    implementation project(':@react-native-picker_picker')
    }
  5. watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache

  6. cd android && ./gradlew clean

  7. cd ios && pod install

akash-bhadani commented 3 years ago

Hello Everyone!

I was facing the same issue

Invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager.

when I installed npm install react-native-picker-select and used their Basic Usage example in React Native CLI.

import RNPickerSelect from 'react-native-picker-select';

export const Dropdown = () => {
    return (
        <RNPickerSelect
            onValueChange={(value) => console.log(value)}
            items={[
                { label: 'Football', value: 'football' },
                { label: 'Baseball', value: 'baseball' },
                { label: 'Hockey', value: 'hockey' },
            ]}
        />
    );
};

I tried installing another package named @react-native-community/picker using npm install @react-native-community/picker in your project's root directory. This helped me solve the error.

Try Installing the same package and link it with your project (if required).

Enjoy!

ahsan-abrar commented 2 years ago

The solution is to install correctly the lib and its dependency:


npm install react-native-picker-select
npm install @react-native-picker/picker

If the error always persists, just enter this command line to link manually the lib: npx react-native link

Enjoy !

thanks fixed issue through this method in "react-native": "0.70.1",

zagros commented 1 year ago

got this error as well but if you stop the simulator (weather it's expo simulator or ios or whatever) and restart it it may go away - if you npm / yarn install while simulator is running in some other terminal, and just navigate to the window you added the Picker to this error will come up

fbele commented 4 months ago

I'm still getting this issue today. I installed the @react-native-picker/picker separately, even though it shouldn't be necessary, since react-native-picker-selectmodule has it declared as a peer dependency, but I still get this error. Is there any solution to it?

sergio-alifano commented 1 month ago

I'm still getting this issue today. I installed the @react-native-picker/picker separately, even though it shouldn't be necessary, since react-native-picker-selectmodule has it declared as a peer dependency, but I still get this error. Is there any solution to it?

I still have the same issue as well. I have installed using npx expo install @react-native-picker/picker first, and then I also tried npm install react-native-picker-select npm install @react-native-picker/picker

mustapha-ghlissi commented 1 month ago

Hi

You can try this package 📦

https://www.npmjs.com/package/@mustapha-ghlissi/react-native-select-picker

Idaapayo commented 1 week ago

The solution is to install correctly the lib and its dependency:


npm install react-native-picker-select
npm install @react-native-picker/picker

If the error always persists, just enter this command line to link manually the lib: npx react-native link Enjoy !

Doing this I get Invariant Violation: Tried to register two views with the same name RNCAndroidDropdownPicker Did you have this problem too and managed to solve it somehow?

The solution for this is import { Picker as SelectPicker } from '@react-native-picker/picker' instead of import { Picker } from '@react-native-picker/picker';

KevinDaniel18 commented 1 day ago

If you are using EAS Build, to include any additional native dependencies that are not part of the standard Expo runtime. Until you create a new build, these dependencies will not be available in the app installed on your device.

steps to create a build