-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Allow iterables to pass node prop type check #4209
Conversation
lgtm, cc @spicyj |
|
||
var iteratorFn = getIteratorFn(propValue); | ||
if (iteratorFn) { | ||
if (iteratorFn !== propValue.entries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to check the values when iteratorFn === propValue.entries
.
I don't completely understand what is going on here, but will this pull values out of generators, thereby meaning they won't have any next values when they are used within the component? Also, how does this deal with infinite iterators? |
check that the value is a node for map iterables
Hey @spicyj, I've added scenario for when iteratorFn === propValue.entries Now checks that value in each key-value pair of an entry iterable is a node. |
ping @spicyj |
Looks good to me, @spicyj's comments have been addressed, no complaints from anyone in almost two weeks, so let's ship it. |
Allow iterables to pass node prop type check
@camspiers Did you ever get your question addressed? This same scenario came up in #7536, and in doing some research I stumbled upon this PR. |
#2376 add support for iterables as children. However if a component adds React.PropTypes.node validation to children, validation fails. This pull request adds an iterable check to ReactPropTypes.isNode()