react-photo-gallery
react-photo-gallery copied to clipboard
Add on load callback parameter
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.
Coverage increased (+0.2%) to 86.755% when pulling c7cb7420f38cc90b42206cbab34cbd08c80ca8b4 on wmsiddiqui:master into 0bb8e4c4a027c021f8a5a06de71e89026596fd95 on neptunian:master.
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.
This is what it looks like as is, with images that take a while to load.
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.