ldn0x7dc / react-native-gallery

A pure JavaScript image gallery component for react-native apps with common gestures like pan, pinch and doubleTap, supporting both iOS and Android.
331 stars 116 forks source link

Add optional loader prop #21

Closed Exilz closed 7 years ago

Exilz commented 8 years ago

I feel like this is an important missing feature. Here you go, I didn't update the demo, though.

msageryd commented 8 years ago

That could be useful, thanks.

I store thumbnail versions of all of my images and I would like to implement something like this: https://medium.com/the-react-native-log/progressive-image-loading-in-react-native-ecc88e724343#.vj4xz04b4

Do you know if there is any way to supply a custom render function for the images? Another solution would be to provide an array of thumbnails and let the gallery component do the trick internally. I'll probably look into this in a couple of weeks.

Question: On line 248 you set loadingView = false if there is no loader. Will RN treat {false} the same way as {null} when rendering?

Exilz commented 8 years ago

@michaelswe I don't like this kind of "medium-like" effect where images are blurred before being displayed. But adding an option to supply a custom render function for images is actually a great idea.

That's what I had in mind before making this PR, but the dependency allowing us to play around with images (transformable-images) made this harder than it looks.

It's totally doable, though but I'm not sure the maintainer of this repo would like this component to become much more complex if it came to handle thumbnails too.

On line 248, RN will not render anything if it encounters false 😄 It's the easiest way of writing it I guess.

Exilz commented 8 years ago

@ldn0x7dc ping

jeffhtli commented 8 years ago

It's great that show progress bar when image is loading, waiting merge this PR. @ldn0x7dc

nickw444 commented 7 years ago

Also would really benefit from this PR being merged. Is there anything blocking this in particular?

Exilz commented 7 years ago

@nickw444 looks like this module isn't maintained anymore, in the meantime, you can still use our maintained version : https://github.com/archriss/react-native-image-gallery