Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Android #509

Open
OmarKhanfer opened this issue May 20, 2023 · 6 comments
Open

Bug in Android #509

OmarKhanfer opened this issue May 20, 2023 · 6 comments

Comments

@OmarKhanfer
Copy link

Describe the bug

I have the following packages

"@react-native-picker/picker": "^2.4.10",
"react": "18.2.0",
"react-native": "0.69",
"react-native-picker-select": "^8.0.4",

its giving me error "Invalid hook call. Hooks can only be called inside the body of a function component. this could happen for one of the following reasons ..."

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

To Reproduce

Steps to reproduce the behavior:

  1. Run Android version to 'npm run android'
  2. Display Android Emulator
  3. Showing in the main page
  4. See error
Screen Shot 2023-05-20 at 12 42 26 PM

Expected behavior

to see the behavior as the documentation

Screenshots

Add screenshots to help explain your problem. If screenshots aren't applicable to this issue, write "n/a".

Additional details

  • Device: [e.g. Android Emulator Pixel 4 API 28]
  • OS: [e.g. Android]
  • react-native-picker-select version: [8.04]
  • react-native version: [0.71.8]
  • react: [18.2.0]
  • expo sdk version: [n/a]

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.

@ShivamEviView
Copy link

Run this command npm i react-native-picker-select --legacy-peer-deps

@OmarKhanfer
Copy link
Author

OmarKhanfer commented May 25, 2023

the solution working fine but I have to flush the cache by using npm start -- --reset-cache

@nympheastudio
Copy link

Thanks Shivam, it s working for me too

@vijaykhandal1290
Copy link

Thanks @ShivamEviView

@benib3
Copy link

benib3 commented Jul 6, 2023

Thanks @ShivamEviView i was struggling for a while :)

@stef1103
Copy link

stef1103 commented Aug 10, 2023

A better solution that does not involve installing peer legacy dependencies can be found here: Issue 486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants