Skip to content
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

Cannot read property 'complete' of undefined #216

Closed
lkazberova opened this issue Feb 28, 2018 · 8 comments
Closed

Cannot read property 'complete' of undefined #216

lkazberova opened this issue Feb 28, 2018 · 8 comments

Comments

@lkazberova
Copy link
Contributor

Steps to reproduce the behavior:
Set images & isOpen=true in one step. Please take a look at this https://codesandbox.io/s/k04jp5y447
Expected behavior:
Galllery is open
Actual behavior:
Gallery crash with error "Cannot read property 'complete' of undefined"

Why:
In this code we call preloadImage https://github.com/jossmac/react-images/blob/master/src/Lightbox.js#L89, but in preloadImage method we try to access "old" state of this.props.images https://github.com/jossmac/react-images/blob/master/src/Lightbox.js#L112

@rimatla
Copy link

rimatla commented Feb 28, 2018

Any update? Same boat here.

@dsaco
Copy link

dsaco commented Mar 6, 2018

0.5.17 not working either

@mushkab
Copy link

mushkab commented Mar 6, 2018

plus one

@arielgefen
Copy link

+1

@thg303
Copy link

thg303 commented Mar 13, 2018

is this repo alive??

@lkazberova
Copy link
Contributor Author

If someone would like to get the react-images without this error please free to use

"react-images": "git://github.com/lkazberova/react-images.git#libs",

in your package.json, because we don't know when an author of this repo will accept the pull-request.

@corydeppen
Copy link

@jossmac Understanding v1 is around the corner, is there anything specific that prevents this PR from being merged and released?

@LukeLin
Copy link

LukeLin commented Jun 29, 2018

According to the source code, the error happens when you set images props as an empty array, my fix way is:
this.state = { // This is important lightboxImages: [{ src: '' }], lightboxIsOpen: false, currentImage: 0 }

neptunian added a commit that referenced this issue Jul 18, 2018
Fix #216 Cannot read property 'complete' of undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants