Invalid hook call
See original GitHub issueDescribe the bug
const repeats = [
{
label: 'Never',
value: 'none',
},
{
label: 'Daily',
value: 'daily',
},
{
label: 'Weekly',
value: 'weekly',
},
{
label: 'Monthly',
value: 'monthly',
},
];
<RNPickerSelect
placeholder={{}}
useNativeAndroidPickerStyle={false}
items={repeats}
value={"daily"}
/>
I’m getting the following error:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
This happened after upgrading the library to v8.0.4 and RN to 0.69.5.
To Reproduce
Steps to reproduce the behavior:
- Create a React component
- Put the code inside the render function
- Notice error
Expected behavior
The app shouldn’t crash.
Screenshots
N/A
Additional details
- Device: Android
- OS: Android 12
- react-native-picker-select version: 8.0.4
- react-native version: 0.69.5
- expo sdk version: N/A
Reproduction and/or code sample
Not using expo.
Issue Analytics
- State:
- Created a year ago
- Comments:8
Top Results From Across the Web
Invalid Hook Call Warning - React
Hooks can only be called inside the body of a function component. There are three common reasons you might be seeing it: You...
Read more >Invalid hook call. Hooks can only be called inside of the body ...
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the...
Read more >Invalid hook call - How to resolve multiple versions of React ...
I noticed that whenever I link each individually, the former unlinks. So by doing npm link ./path-to-app/node_modules/react ./path-to-app/ ...
Read more >Invalid hook call. Hooks can only be called inside of the body ...
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of...
Read more >Invalid hook call. Hooks can only be called ... - Datainfinities
React error “Invalid hook call. Hooks can only be called inside the body of a function component” occurs due to many reasons. Learn...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The issue is coming from
@react-native-picker/picker
I just downgraded that package and it worked for me
Working Version -
"@react-native-picker/picker": "^1.16.0",
I ended up switching to another library which didn’t break.