question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: Failed prop type: Invalid prop `children` supplied to `Picker`

See original GitHub issue

Warning: Failed prop type: Invalid prop children supplied to Picker

How to reproduce

<Picker>
  <Picker.Item label="test" />
</Picker>

Simplified test case:

Steps to reproduce:

  1. React Native 0.58+
  2. 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 screen shot 2019-03-02 at 12 13 17 pm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
d4rky-plcommented, Apr 10, 2019

Uhhhhh, it took me an hour to debug this!

The reason this is happening is because of react-hot-loader wrapping the Picker.Item in it’s ProxyComponent via ES6ProxyComponentFactory. When it happens, the child.type !== Picker.Item check is no longer true because child.type has been wrapped.

This is the Picker.Item: Screenshot 2019-04-10 16 07 11

And this is child.type: Screenshot 2019-04-10 16 07 21

Notice different [[FunctionLocation]] which points to VM97:4 in the latter case, which is react-hot-loader’s proxy:

Screenshot 2019-04-10 16 08 52

@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 😜

0reactions
NishargShahcommented, Oct 2, 2020

Ohk, I just found out https://github.com/react-native-community/react-native-picker, I am using the deprecated picker, thanks for the reply 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found