Failed to install @react-native-picker/picker in SDK46

Please provide the following:

  1. SDK Version: 46
  2. Platforms(Android/iOS/web/all): Android

I’m trying to upgrade to SDK46 from SDK44 but have an issue with pickers. I have been using react-native-picker-select but cannot get it to work in Android in SDK46 because of this issue Invalid Hook Call, inside react-native-picker-select · Issue #486 · lawnstarter/react-native-picker-select · GitHub.

However, in attempting to switch to using a more standard picker I started with react-native/picker but got…

Invariant Violation: Picker has been removed from React Native. It can now be installed and imported from ‘@react-native-picker/picker’ instead of ‘react-native’. See GitHub - react-native-picker/picker: Picker is a cross-platform UI component for selecting an item from a list of options.

Fair enough but in attempting that I get…

Installing 1 SDK 46.0.0 compatible native module using npm.

npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: fringeapp44@1.0.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR! react@“18.0.0” from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@“16 || 17” from @react-native-picker/picker@2.4.2
npm ERR! node_modules/@react-native-picker/picker
npm ERR! @react-native-picker/picker@“2.4.2” from the root project

I tried a workaround …

npm install @react-native-picker/picker --legacy-peer-deps

but that then failed at runtime with…

UnexpectedNativeTypeException
Value for label cannot be cast from ReadableNativeMap to String

com.facebook.react.bridge.ReadableNativeMap in checkInstance at line 140
com.facebook.react.bridge.ReadableNativeMap in getNullableValue at line 128
com.facebook.react.bridge.ReadableNativeMap in getString at line 162
com.reactnativecommunity.picker.ReactPickerManager$ReactPickerAdapter in getView at line 268
com.reactnativecommunity.picker.ReactPickerManager$ReactPickerAdapter in getView at line 235

Any suggestions of how to address this would be most welcome

Dan

I’m going to skip SDK46 but wonder if I should go straight to SDK48 or is it best to go through all versions individually?

I’m up and running locally with SDK47 - I think the problem was with the use of legacy-peer-deps for react-native-picker-select - I’ve switched to react-native-picker/picker, deleted node_modules and reinstalled.

Next I’ll do an eas build and check it in testflight & internal testing but it is looking promising :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.