reactjsreact-nativereact-hooksreact-native-picker-select

Invalid hook call on RNPickerSelect


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


Solution

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