react-native-fast-image icon indicating copy to clipboard operation
react-native-fast-image copied to clipboard

Preload seem to not do anything?

Open joecaraccio opened this issue 8 years ago • 22 comments

It could be just me, or does the Preload function not seem to really assist? Its hard to tell but it feels like you still have to see the load times regardless, wether you ran a preload or not!

anyone else feel this way?

joecaraccio avatar Jan 12 '18 02:01 joecaraccio

You talking about ios or android or both?

Also I would like to have FastImage.preload return a Promise that resolves once the image is loaded. This would make it easier to implement something like progressive image loading.

n1ru4l avatar Jan 12 '18 09:01 n1ru4l

@n1ru4l Talking about Android. I changed FastImage.preload to return a promise when all the images are preloaded, but even when doing that the preload dosen't seem to do much

I preloaded on 1 view, and then opened that same uri on a different view, and there was still some load time that seemed like it was just pulling down from the web

joecaraccio avatar Jan 12 '18 13:01 joecaraccio

+1 for this @joecaraccio . Doesn't work on my end on iOS or Android.

[email protected] [email protected]

wkoutre avatar Jan 13 '18 06:01 wkoutre

Thanks for the comment @joecaraccio I was hoping to use this to preload images in one view and have them instantly render in a different view. Have you had any luck with that with other packages or methodologies?

ewalti avatar Jan 17 '18 02:01 ewalti

my solution was kinda specific to my use case where i just used absolute position off to the side, and rendered the image using FastImage, and then brough it back onto screen when done.. that probably dosen't work for a lot of people unfortunatly

joecaraccio avatar Jan 17 '18 18:01 joecaraccio

The issue was the same for me, at least on Android. I recall that it did the job on iOS.

Kouznetsov avatar Jan 25 '18 16:01 Kouznetsov

You're right, it definitely was not working on Android. I setup a server for testing and an example and could see it was making a new request when showing a preloaded image.

It did work on iOS.

This fixes it: https://github.com/DylanVann/react-native-fast-image/commit/de4f40a3a30a95fb8cdab714735501650e335dd9

A new version is published now. Let me know if you have any issues with it.

DylanVann avatar Jan 31 '18 02:01 DylanVann

i preload images but i still see a lag when they are rendered on the next view for the first time. Am i missing anything ?

ghost avatar Feb 24 '18 05:02 ghost

It's still not working on Android :disappointed: Please reopen issue until complete fix.

mnlbox avatar Mar 08 '18 07:03 mnlbox

@togusa2017 @mnlbox Can the preloading issue on android be reproduced in a minimal example?

The preloading seems to be working in the example application in this repo:

preload_02

DylanVann avatar Mar 08 '18 08:03 DylanVann

@joecaraccio Hey, can you share how you'v managed to make FastImage.preload to return a promise? preload to return a promise would completely solve my issue.

tomerono avatar Mar 19 '18 08:03 tomerono

@ewalti (or anyone else in this thread) did you end up finding a way to do this?

Using preload in an iOS simulator seems to have no effect. When navigating to a screen that contains the actual <FastImage> with the uri, it just pulls down the image at that point in time.

isaachinman avatar Jul 02 '18 16:07 isaachinman

@DylanVann Why is this closed? Been testing it on iOS, the preload doesn't work. Preload on one screen, on a later screen the images still are loading.

RN: 0.54.0-rc3 RNFastImage: 4.0.4 React: 16.3.1

Any idea how to fix/what's wrong?

roycclu avatar Jul 31 '18 13:07 roycclu

Hi everyone, I am using the following code in the componentDidMount method of my App.js:

await FastImage.preload([{ uri: 'https://app.box.com/shared/static/dz6tvgka56ub8xfii6v4516zco0bmvwq.jpg' }])
      await FastImage.preload([{ uri: 'https://app.box.com/shared/static/8e43tmaproz9psvch4s7de5tyff9i71k.jpg' }])
      await FastImage.preload([{ uri: 'https://app.box.com/shared/static/udiaehxve4tjunnhe40wtvddvp8h3hdo.jpg' }])
      await FastImage.preload([{ uri: 'https://app.box.com/shared/static/6rbqggrctvsjgebxmr2u630u081w3rrz.jpg' }])
      await FastImage.preload([{ uri: 'https://app.box.com/shared/static/n4fym1ck83nmlo0uo20clpwidipr3e56.jpg' }])
      await FastImage.preload([{ uri: 'https://app.box.com/shared/static/e1fiqrjwqhm5vh77znjr1gfiy5kclw94.jpg' }])

It does not seems to do anything because i can see blank space while the image are being loaded after my app launched. I am using react native on my ios simulator.

Thanks very much in advance.

twillstudio avatar Mar 19 '19 03:03 twillstudio

This is still not working for me on android: RNFastImage: 6.0.3 React-Native: 0.59

Please fix this!

FrankGoortani avatar Jun 04 '19 23:06 FrankGoortani

@twillstudio that's not going to work because the preload function returns void - therefore, in the sense of a promise, it will resolve immediately.

twhoff avatar Jun 11 '19 16:06 twhoff

This is still not working on android: RNFastImage: 8.1.5 React-Native: 0.61.2

avet-m avatar Mar 25 '20 22:03 avet-m

Why was this issue closed? It‘s still not working for me on RN0.61.5 using the latest version of reach-native-fast-image. Thanks for some insights

skizzo avatar Sep 22 '20 09:09 skizzo

can you updatei to to return promise so I can't disable loading spinner when it done

punjasin avatar Oct 20 '20 15:10 punjasin

Why was this issue closed? It‘s still not working for me on RN0.61.5 using the latest version of reach-native-fast-image. Thanks for some insights

did u find any solution?

mohity777 avatar Mar 23 '21 07:03 mohity777