Warning: Failed prop type: Invalid prop `children` supplied to `Picker`
See original GitHub issueWarning: Failed prop type: Invalid prop children
supplied to Picker
How to reproduce
<Picker>
<Picker.Item label="test" />
</Picker>
Simplified test case:
Steps to reproduce:
- React Native 0.58+
- Add
<Picker.Item>
and child of<Picker>
Expected behavior No warning shows up.
Environment (include versions). Did this work in previous versions?
- React Native for Web (version): 0.10.0
- React (version): 16.8.3
- Browser: Chrome
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Warning: Failed prop type: Invalid prop `children` supplied to ...
I'm trying to render certain inputs if a variable is true but when the component render displays the warning ...
Read more >Warning: Failed prop type: Invalid prop `children ... - Medium
Warning : Failed prop type: Invalid prop `children` supplied to `ForwardRef(Typography)`, expected a ReactNode. */<Typography key={item.id}>
Read more >Failed prop type: Invalid prop children supplied to ForwardRef ...
Hi i've noticed in my case the issue was that the tableData had boolean field values, which caused the error. This can be...
Read more >[Solved]-Failed prop type: Invalid prop `children` supplied to ...
Coding example for the question Failed prop type: Invalid prop `children` supplied to `ForwardRef(Select)`, expected a ReactNode-Reactjs.
Read more >warning: failed prop type: invalid prop children supplied to route
The problem to me is the use of {input} props. Both knob component and DatePicker component has issue with it. Knob component has...
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 FreeTop 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
Top GitHub Comments
Uhhhhh, it took me an hour to debug this!
The reason this is happening is because of
react-hot-loader
wrapping thePicker.Item
in it’sProxyComponent
viaES6ProxyComponentFactory
. When it happens, thechild.type !== Picker.Item
check is no longer true becausechild.type
has been wrapped.This is the
Picker.Item
:And this is
child.type
:Notice different
[[FunctionLocation]]
which points to VM97:4 in the latter case, which is react-hot-loader’s proxy:@necolas I know I’m supposed to provide a codesandbox test case but this one is super tricky and I’ve already spent way too much time on this. Would it be possible for you to loosen this check without this test case or should I spend another hour or two creating something reproducible? I have very strong opinions about code failing propTypes in development, even if it’s ultimately the library not us 😜
Ohk, I just found out https://github.com/react-native-community/react-native-picker, I am using the deprecated picker, thanks for the reply 😃