Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 17664

Synchronous image loading warning in React Native - How to fix using URLSession?

$
0
0

I'm encountering a warning in Xcode's log when testing my React Native app:

Synchronous URL loading of http://localhost:8081/assets/assets/image/ImageUser.png?platform=ios&hash=c7acd2e8e0e1768b55d4ee625fb73ffb should not occur on this application's main thread as it may lead to UI unresponsiveness. Please switch to an asynchronous networking API such as URLSession.

My code:

import {Image} from 'react-native'const Images = {  user: require('../image/ImageUser.png'),}const AppImage = () => {<Image source={Images.user} />}

My app displays the image normally despite the warning.

How can I resolve this warning and implement asynchronous image loading using URLSession (or another recommended approach)?


Viewing all articles
Browse latest Browse all 17664

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>