question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preload does not seem to be working

See original GitHub issue

Hi everyone, I need to preload 6 images (probably more in the future) when my app opens. 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. I know other issues have been opened in the past but I feel like none of them solved my problem.

Thanks very much in advance.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
amitbravocommented, Mar 25, 2019

its sad that FastImage.preload() does not return a promise , as I need to download 100 images and I do not know if they are loaded or not .

0reactions
twillstudiocommented, Mar 29, 2019

Hi @amitbravo, This a tricky situation. Does your questionaire is changing dynamically ? If no you can just hardcode your Images with require and store them locally. I’m not a massive of this solution to be honest.

Otherwise you can have a look at this module (https://github.com/kfiroo/react-native-cached-image) which is a bit faster than FastImage to load and you can make your images FadesIn in order to make it smooth.

Hope it helped, good luck man!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common problems with rel="preload" - DebugBear
First, let's look at how preload is supposed to work. ... A CSS file references a font, but this font doesn't start loading...
Read more >
css - rel=preload for stylesheet isn't applying the styles once ...
I'm testing in Chrome 61, and I can see that the stylesheets are downloaded as expected, however they're never actually applied, and I...
Read more >
'Preload now' doesn't seem to work properly - WordPress.org
Hello,. As i say in the title, the preload now function doesn't seem to work properly. It supposedly simulates the 'visit' of a...
Read more >
Question - Preload table does not seem to work - Unity Forum
Hi all, I have a simple StringTable containing one single string entry translated in only one locale. I have checked the "Preload All ......
Read more >
IIS Preload feature doesn't work when "SSL Settings" is set to ...
Upon further diagnosis I found out that as long as I set my application to be "SSL Required" , which I initially did,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found