3

I'm using the Camera Roll library that comes with react native to load a grid of all a user's local images. However, the api call is slow to not only grab the local data (pulling in a couple hundred images) and it is also slow to render the images.

I'm wondering how apps like Photos and Instagram are able to pull your library so quickly and render them all immediately at the same time, and if it's possible with react native yet... Seems like a simple use case.

I'd like to be able to use a lower quality version of these camera roll images, but the camera roll only seems to give me the full scale images.

SingularJon
  • 31
  • 1
  • 3
  • Faced the very same issue so I switched to native where you can preheat the collection view. That’s how apps do it quickly. Plus NsCacheImageManager. – agibson007 Nov 26 '17 at 14:10

1 Answers1

0

How are you retrieving the photos? I've used this API much myself yet, so this isn't coming from experience, but I took a look at the CameraRoll Docs and certainly seems like the right approach is to limit the number of photos you retrieve to just the number you can display in one screen full (plus/minus a buffer)

getPhotos({first: 20}) // retrieve the first 20 photos

From there, use a windowing technique when you're scrolling to fetch more. You can learn more about windowing from Michael Jackson's Talk on Windowing (and more)

This is how I'd try to tackle the problem. Good luck!

Chris Geirman
  • 9,474
  • 5
  • 37
  • 70