简体   繁体   中英

React Native images do not show when android device is not connected to PC

So, I only work on my phone since my PC is to slow so it could run emulator... And everything works just fine, my app works just fine when the phone is connected to PC but then, when disconnected again everything works like it should only the images are partially shown. Example sometimes 50% of images are shown , sometimes 20% etc...

All of the images are local, located src/assets/img/img.jpg . I am using them this way {require("../../assets/img/casper/casperLogo.jpg")} .

I have maybe 50-60 up to 50kb images, I plan to have much more of them...

Is this some cash memory problem or what? Is this because app is still in the development? Sometimes when the phone is disconnected, all images are shown for maybe couple of hours, but then they are gonne again, until I build the app once again...

Any suggestion?

Thanks in advance.

I assume this has something to do with the bundling of react native. So did you test it in production?

If I am not wrong it should work when both devices (PC and phone) are in the same network.

The background is that your App is bundled on your computer and provided as an service for your phone. So when your phone is connected with the metro (the bundle service) it is downloading the bundle and starting the App. Good for debugging ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM