Closed SijieCai closed 8 years ago
:+1: I just spent 3 hours debugging my app just to find that there's already a PR for the fix.
Thanks for this awesome library!
BTW, here's my workaround:
// guarantees that items will never have exactly one element
items.unshift(<div key='a workaround until https://github.com/heilhead/react-bootstrap-validation/pull/24 lands'></div>);
items.unshift(<div key='b workaround until https://github.com/heilhead/react-bootstrap-validation/pull/24 lands'></div>);
return (<Form ...>
{items}
</Form>);
For anyone encountering the same issue, here was the error message that showed up:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
My workaround was just to add an empty div tag inside the Form before mapping/rendering my ValidatedInput elements. This insured that the Form had more than 1 child element.
Hi guys! Thanks for your feedback and PR. I didn't have much time recently, but I took a proper look at this PR and will merge/deploy it very soon. Thanks again for your contribution.
I've pushed a new version with 'beta' tag. Can any of you please try it with npm install react-bootstrap-validation@beta
and confirm that the problem's gone? If it's working correctly, I'll publish a production release.
It works. Thanks!
Steve Gaetjens Director of Application Architecture | PartsSource
Direct 330.954.1461 sgaetjens@partssource.commailto:sgaetjens@partssource.com | www.partssource.comhttp://www.partssource.com
Stay Updated:http://www.partssource.com/category/news/ Sign up to receive the latest PartsSource news. Confidentiality Note: This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify me immediately. From: Ivan Reshetnikov [mailto:notifications@github.com] Sent: Tuesday, January 5, 2016 3:45 PM To: heilhead/react-bootstrap-validation react-bootstrap-validation@noreply.github.com Cc: Steve Gaetjens sgaetjens@partssource.com Subject: Re: [react-bootstrap-validation] Fix bug children is array of length 1 (#24)
I've pushed a new version with 'beta' tag. Can any of you please try it with npm install react-bootstrap-validation@beta and confirm that the problem's gone? If it's working correctly, I'll publish a production release.
— Reply to this email directly or view it on GitHubhttps://github.com/heilhead/react-bootstrap-validation/pull/24#issuecomment-169127672.
Thanks for pulling this in. I was able to verify that it worked for me, too!
We always do data.map with data coming from backend, when the length of data is 1 (rare case), _renderChildren treat it as a element !! then it goes to React.cloneElement( array(element), {}, ....) which cause the render stop completely in our case.