Skip to content

Conversation

wmsiddiqui
Copy link

Added a callback parameter which will be called when all images in the gallery have finished loading.

This can allow the parent component of Gallery to implement things such as spinners or other mechanisms for smoother transitions when the images are taking too long to load.

* Added on load callback parameter.

* Fixed tests

* Add callback as an example
@coveralls
Copy link

coveralls commented Oct 16, 2019

Coverage Status

Coverage increased (+0.2%) to 86.755% when pulling c7cb742 on wmsiddiqui:master into 0bb8e4c on neptunian:master.

@wmsiddiqui
Copy link
Author

I'm not quite sure how to mock out the onLoad on the img for the jest tests. I will look into this later, unless someone else has a good idea and can contribute or point me in the right direction.

This fix is very open ended, but it gives the calling component a lot of control over what can be done to make the UX a lot smoother.

* Added on load callback parameter.

* Fixed tests

* Add callback as an example

* Added test
@wmsiddiqui
Copy link
Author

This is what it looks like as is, with images that take a while to load.
GalleryWithoutCallback

With a callback, it allows the parent component to handle the loading to make it smoother. Of course, this is up to the parent component on how this is implemented, but adding this functionality enables many possibilities.
GalleryWithCallback

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

Successfully merging this pull request may close these issues.

2 participants