picker icon indicating copy to clipboard operation
picker copied to clipboard

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

Open CaptainJeff opened this issue 5 years ago • 75 comments

Bug

I am unable to get this to work. I'm receiving the following error

`Violation: requireNativeComponent: "RNCPicker" was not found in the UIManager.

This error is located at: in RNCPicker (at PickerIOS.ios.js:107) in RCTView (at View.js:35) in View (at PickerIOS.ios.js:106) in PickerIOS (at Picker.js:142) in Picker (at edit-exercise.modal.tsx:54) in EditExerciseModal (created by inject-with-exerciseStore(EditExerciseModal)) in inject-with-exerciseStore(EditExerciseModal) (at SceneView.js:9) in SceneView (at StackViewLayout.tsx:909) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewCard.tsx:106) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at screens.native.js:71) in Screen (at StackViewCard.tsx:93) in Card (at createPointerEventsContainer.tsx:95) in Container (at StackViewLayout.tsx:984) in RCTView (at View.js:35) in View (at screens.native.js:101) in ScreenContainer (at StackViewLayout.tsx:393) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewLayout.tsx:383) in PanGestureHandler (at StackViewLayout.tsx:376) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.tsx:104) in RCTView (at View.js:35) in View (at Transitioner.tsx:267) in Transitioner (at StackView.tsx:41) in StackView (at createNavigator.js:80) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (at SceneView.js:9) in SceneView (at StackViewLayout.tsx:909) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewCard.tsx:106) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at screens.native.js:71) in Screen (at StackViewCard.tsx:93) in Card (at createPointerEventsContainer.tsx:95) in Container (at StackViewLayout.tsx:984) in RCTView (at View.js:35) in View (at screens.native.js:101) in ScreenContainer (at StackViewLayout.tsx:393) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at StackViewLayout.tsx:383) in PanGestureHandler (at StackViewLayout.tsx:376) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.tsx:104) in RCTView (at View.js:35) in View (at Transitioner.tsx:267) in Transitioner (at StackView.tsx:41) in StackView (at createNavigator.js:80) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (at SceneView.js:9) in SceneView (at SwitchView.js:12) in SwitchView (at createNavigator.js:80) in Navigator (at createAppContainer.js:430) in NavigationContainer (at root-component.tsx:73) in RCTView (at View.js:35) in View (at createAnimatedComponent.js:151) in AnimatedComponent (at react-native-safe-area-view/index.js:163) in SafeView (at withOrientation.js:54) in withOrientation (at root-component.tsx:71) in BackButtonHandler (at root-component.tsx:70) in MobXProvider (at root-component.tsx:69) in RootComponent (at renderApplication.js:40) in RCTView (at View.js:35) in View (at AppContainer.js:98) in RCTView (at View.js:35) in View (at AppContainer.js:115) in AppContainer (at renderApplication.js:39)`

Environment info

OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 18.22 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash

Binaries: Node: 12.12.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 11.2/11B52 - /usr/bin/xcodebuild npmPackages: @react-native-community/cli: ^2.9.0 => 2.9.0 react: 16.8.6 => 16.8.6 react-native: 0.60.5 => 0.60.5 npmGlobalPackages: react-native-cli: 2.0.1

Describe what you expected to happen:

I expected the spinner to show but i received this error. I used the sample code in the readme

CaptainJeff avatar Jan 09 '20 19:01 CaptainJeff

Hi, The same here. It is working on android but on iOS it returns the error. I am using expo 34.

freeworlder avatar Jan 11 '20 11:01 freeworlder

Hi, it will be great if you could share some demo project or expo link, where this is reproducible.

jainkuniya avatar Jan 11 '20 21:01 jainkuniya

Same issue here. Expo SDK 36

alexhoo avatar Jan 17 '20 12:01 alexhoo

Restart your simulator after pod install

flatcoke avatar Jan 20 '20 05:01 flatcoke

Restart your simulator after pod install

Same error. I tried this and it still doesn't work for me.

emmanuel-cbqa avatar Feb 13 '20 16:02 emmanuel-cbqa

Getting this as well. Ejected from expo a month ago.

john-harding avatar Feb 18 '20 05:02 john-harding

Hi there. Any news regarding this issue?

cornelRaiu avatar Mar 15 '20 00:03 cornelRaiu

Picker component is indeed deprecated but still exists in the react-native core repository. Until the picker component is fully removed from the core, usage of react-native-picker on a managed workflow of expo will probably not be supported.

If you are using bare workflow with expo eject, you may need to run pod install to install this package for iOS.

Naturalclar avatar Mar 17 '20 08:03 Naturalclar

Picker component is indeed deprecated but still exists in the react-native core repository. Until the picker component is fully removed from the core, usage of react-native-picker on a managed workflow of expo will probably not be supported.

If you are using bare workflow with expo eject, you may need to run pod install to install this package for iOS.

Any idea when this will happen?

sebastianknopp avatar Apr 24 '20 07:04 sebastianknopp

In XCode, in the project navigator, select your project. Add libRNCPicker.a to your project's Build Phases ➜ Link Binary With Libraries Then Build your project

JiaqiGuo avatar Apr 26 '20 03:04 JiaqiGuo

In XCode, in the project navigator, select your project. Add libRNCPicker.a to your project's Build Phases ➜ Link Binary With Libraries Then Build your project

I suppose this is for ejected projects. Mine was non-ejected expo project.

freeworlder avatar May 01 '20 12:05 freeworlder

Same issue here. Using Expo SDK 37.

tills98 avatar May 06 '20 17:05 tills98

Getting this issue on iPhone XS, Expo SDK 37.

karimcambridge avatar May 07 '20 06:05 karimcambridge

Same here Expo SDK 37

SixStringsCoder avatar May 11 '20 19:05 SixStringsCoder

Same problem Expo SDK 37

mutavdzicm avatar May 12 '20 11:05 mutavdzicm

I solved this deleting the app from simulator and installing again with react-native run-ios

MorgadoKnivet avatar May 12 '20 22:05 MorgadoKnivet

Not sure this is the case for you, but I imported it using "import {Picker} from '@react-native-community/picker';". And had the same problem for days now. But after changing to "import {Picker} from 'react-native';" it works fine now.

Mariussuv avatar May 13 '20 07:05 Mariussuv

Not sure this is the case for you, but I imported it using "import {Picker} from '@react-native-community/picker';". And had the same problem for days now. But after changing to "import {Picker} from 'react-native';" it works fine now.

That's because react-native has their own picker but It is deprecated so they say to use this one

digaso avatar May 13 '20 07:05 digaso

Same here with non-ejected app

Expo CLI 3.20.1 environment info: System: OS: macOS Mojave 10.14.6 Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.1 - /usr/local/bin/node npm: 6.9.0 - /usr/local/bin/npm IDEs: Android Studio: 3.5 AI-191.8026.42.35.5977832 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: expo: ^37.0.0 => 37.0.7 react: 16.9.0 => 16.9.0 react-dom: 16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz => 0.61.4 react-native-web: ^0.11.7 => 0.11.7 npmGlobalPackages: expo-cli: 3.20.1

mritzman-dg avatar May 13 '20 21:05 mritzman-dg

Hi, it will be great if you could share some demo project or expo link, where this is reproducible.

You can have a look at it in my project here. The specific file in question is here.

Let me know if I can provide any other information to help resolve the issue.

sbirkmyre avatar May 20 '20 14:05 sbirkmyre

same problem - latest expo.

ax0n-pr1me avatar May 23 '20 23:05 ax0n-pr1me

As far as I know, this component is still not available in the managed workflow of expo 37. In order to use this component, you would have to eject into a bare workflow, so that other native modules can be used. If you want to use the Picker Component in managed workflow of expo, please import the Picker component directly from `react-native.

import { Picker } from 'react-native'

you may see a deprecated warning, but the component is still usable as it lives in the core.

Naturalclar avatar May 24 '20 01:05 Naturalclar

As far as I know, this component is still not available in the managed workflow of expo 37. In order to use this component, you would have to eject into a bare workflow, so that other native modules can be used. If you want to use the Picker Component in managed workflow of expo, please import the Picker component directly from `react-native.

import { Picker } from 'react-native'

you may see a deprecated warning, but the component is still usable as it lives in the core.

Thanks for your comment. Will work with the picker directly from React Native. Do you know if/when this component will become available in the managed workflow of Expo 37?

sbirkmyre avatar May 24 '20 12:05 sbirkmyre

I too had this issue. This stackoverflow answer solved mine.

tometo-dev avatar Jun 08 '20 15:06 tometo-dev

doing a new pod install fixed it for me

natural411 avatar Jun 08 '20 20:06 natural411

Here are some steps that helped on solving it:

  • Make sure you install new pods
  • Uninstall the app on your emulator
  • Clean a build your app again (I did using Xcode)
  • Redeploy your app on the emulator

Hope this helps someone :). Pura vida!

lcruz09 avatar Jun 18 '20 10:06 lcruz09

The same problem here, hope this gets supported soon for expo users. Thank you.

AhmedAbuelenin avatar Jul 02 '20 13:07 AhmedAbuelenin

Expo 38 sdk is out and part of its new features is the Picker https://blog.expo.io/expo-sdk-38-is-now-available-ab6cd30ca2ee?gi=39cbe20deef6

have you tried this upgrade?

alexhoo avatar Jul 02 '20 13:07 alexhoo

Expo 38 sdk is out and part of its new features is the Picker https://blog.expo.io/expo-sdk-38-is-now-available-ab6cd30ca2ee?gi=39cbe20deef6

have you tried this upgrade?

Further down the page under "Third-Party Modules", they state that @react-native-community/picker is now available. So should definitely be a solution out there, depending what route you want to go down.

I previously just opted to go for the deprecated Picker from the React Native library. With this release I'll look into both the Expo Picker and the RN Community Picker. Will report back when I have.

sbirkmyre avatar Jul 02 '20 13:07 sbirkmyre

I have already upgraded to Expo 38 sdk, and as far as i know, there are 2 options: 1.- Use the deprecated version: import { Picker} from "react-native";

2.- Use the updated community version, which I can confirm it works in Expo 38 . import { Picker } from "@react-native-community/picker";

Oakshiro avatar Jul 03 '20 08:07 Oakshiro