sambernard / react-preload

Component to preload images before showing content
MIT License
148 stars 48 forks source link

TypeError: Cannot read property 'element' of undefined #29

Closed Slyke closed 6 years ago

Slyke commented 7 years ago

Getting:

/node_modules/react-preload/lib/Preload.js:27
children: _react.PropTypes.element.isRequired,
TypeError: Cannot read property 'element' of undefined

With Code:

const loadingIndicator = (<div>Loading...</div>)
const imagesL = [
  'img1.png',
  'img2.png',
  'img3.png'
]
<Preload
loadingIndicator={loadingIndicator}
images={imagesL}
autoResolveDelay={5000}
mountChildren={true}
resolveOnError={true}
>
  {<div>Hi</div>}
</Preload>
Gsiete commented 6 years ago

It seems to be an issue with newer versions of React: https://reactjs.org/docs/typechecking-with-proptypes.html (see the note) It was fixed in: https://github.com/sambernard/react-preload/pull/23 But not merged...

nuclearspike commented 6 years ago

+1.

remeddy commented 6 years ago

+1

hiradyazdan commented 6 years ago

+1 can this be merged please?

lucasconstantino commented 6 years ago

@sambernard do you still maintain this project? If not so, I would recommend providing access to others ;)

Jlevett commented 6 years ago

can you please merge the fix.

sambernard commented 6 years ago

Fixed, and new version has been published