skip to Main Content

I am building my first react-native app for both android and IOS. In order for my app to function, I need to use RNPickerSelect. But for some reason when I try to do

<RNPickerSelect 
              onValueChange={(value) => setOrgin(value)}
              value={orgin}
              useNativeAndroidPickerStyle={false}
              items={countries} placeholder={{label: "Country of Orgin", value: null}} style={pickerSelectStyles}
          />

on android I get "Invalid hook call. Hooks can only be called inside of the body of a function component. " How can I solve this issue

3

Answers


  1. I have re-install the module with this command => npm i react-native-picker-select –legacy-peer-deps

    Login or Signup to reply.
  2. Same issue is here, I have tried with npm i react-native-picker-select --legacy-peer-deps as turkun mentioned and it seems working me too.
    Node version may have effect for the fix, I have v12.22.12.

    Login or Signup to reply.
  3. re-install the module with this command => npm i react-native-picker-select –legacy-peer-deps … works for me also.
    Probably a conflict on expo dependencies.
    It works with Expo but no more when creating de app bundle with eas.
    This module is no longer supported. I change by using this : https://github.com/ouroboroscoding/react-native-picker

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search