A remote image in React Native shows nothing, or only for some URLs
The Image takes no space, or an empty box appears where the picture should beShort answer
A network image in React Native is blank for four reasons. It has no width and height, because remote images are never sized for you. The URL is plain http and the platform blocks it. The file is a format Image cannot decode, such as SVG. The server wants a header such as Authorization. Log onError first.
Fix it fast
1Find out which cause you have
Give the Image a visible border and a fixed size, and print what the native side reports. onError hands you the error, onLoad tells you the file arrived. Run the app and watch the Metro log: whether you see the failed line, the loaded line, or nothing at all points to one of the causes below.
<Image source={{ uri: url }} style={{ width: 200, height: 200, borderWidth: 1 }} onError={(e) => console.log('image failed:', url, e.nativeEvent.error)} onLoad={() => console.log('image loaded:', url)} />2Match what you see, then jump to its fix
- 1
The border from the first step does not appear, or the box has zero height. Neither onLoad nor onError is logged.The image has no width and heightFix - 2
onError is logged, and the same file loads once you switch the URL to https.The URL is plain http and the platform blocks itFix - 3
onError is logged for one kind of URL only, for example every address ending in .svg, or every .webp on iOS.The file is in a format Image cannot decodeFix - 4
The URL opens in a browser where you are signed in, and the app gets a failure. A request without credentials returns 401 or 403.The server wants a header the app does not sendFix
- 1
What does the error look like?
The Image takes no space, or an empty box appears where the picture should beThe same component works with one URL and stays blank with anotherThe image loads on Android and not on iOS, or the reverse
Cause 1 of 4
The image has no width and height
1Check
Look at the style on the Image. A picture from require() is measured at build time, so a local image can go without a size. A remote image is not measured for you, and the React Native docs say so on purpose: you must write the dimensions down.
grep -rn "uri:" src/ | head2Fix
Put a width and a height in the style of the Image. If the real size is only known later, you can pass width and height inside the source object too, and the docs say they then become the default size.
<Image
source={{ uri: url }}
style={{ width: 300, height: 200 }}
/>3Verify
Reload the app. The bordered box from the first step is now visible and the picture fills it.
npx react-native startConfirmed by reactnative.dev
Cause 2 of 4
The URL is plain http and the platform blocks it
1Check
Open the URL scheme in the failing source. iOS enforces App Transport Security, which wants https. Android blocks cleartext traffic from API level 28 on.
grep -rn "http://" src/
curl -sI https://example.com/photo.jpg | head -n 12Fix
Serve the image over https. Only when you cannot, allow that one domain: an NSExceptionDomains entry in Info.plist on iOS, and android:usesCleartextTraffic in the manifest on Android. Avoid switching ATS off for the whole app.
<!-- android/app/src/main/AndroidManifest.xml -->
<application android:usesCleartextTraffic="true" ... >3Verify
Rebuild the native app, because both settings live in native files, then check that onLoad is logged.
npx react-native run-androidConfirmed by reactnative.dev
Cause 3 of 4
The file is in a format Image cannot decode
1Check
Ask the server what it actually sends. The Image docs list the supported formats: png, jpg, jpeg, bmp, gif, webp, and psd on iOS only. They add that webp on iOS works only when it is bundled with the JavaScript code, so a remote webp can fail on iOS and still work on Android.
curl -sI https://example.com/logo.svg | grep -i content-type2Fix
Ask for a supported format. If you host the file yourself, export it as png or jpg. If a service hosts it, request a png or jpg version of the same picture.
// before: an svg the Image component cannot draw
// after: a png of the same artwork
const url = 'https://example.com/logo.png';3Verify
The Content-Type header now names a supported type, and onLoad is logged on both platforms.
curl -sI https://example.com/logo.png | grep -i content-typeConfirmed by reactnative.dev
Cause 4 of 4
The server wants a header the app does not send
1Check
Request the URL without your credentials and read the status code.
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/private/photo.jpg2Fix
The source object accepts headers, which are sent along with the request for the remote image. Pass the token there.
<Image
source={{
uri: url,
headers: { Authorization: `Bearer ${token}` },
}}
style={{ width: 200, height: 200 }}
/>3Verify
The same request with the Authorization header returns 200, and onLoad is logged in the app.
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer $TOKEN" https://example.com/private/photo.jpgConfirmed by reactnative.dev
How do I stop it coming back?
- Wrap remote images in one small component that always sets a size and an onError fallback, so no screen forgets either.
- Use https for every image host from the start, including development servers.
- Serve remote pictures as png or jpg and keep svg and other formats out of an Image.
- Log onError in development builds so a failing URL names itself in Metro.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
fetch fails with TypeError: Network request failed in React Native
Network request failed
Network request failed means the request never got an HTTP response, so there is no status code to read.
3 causes, each with a fixMobile apps
Axios request works on iOS or in a browser but fails on Android with Network Error
AxiosError: Network Error
A React Native app has no CORS, so on Android a Network Error usually means the request never reached the server.
3 causes, each with a fixMobile apps
Axios returns Network Error in a React Native app on iPhone or the iOS Simulator
error.code is ERR_NETWORK and error.response is undefined
A Network Error means iOS stopped the request before any HTTP answer came back.
3 causes, each with a fixMobile apps
backgroundImage: url(...) does nothing in a React Native view
ImageBackground renders an empty area
In React Native the backgroundImage style draws linear and radial gradients, not pictures, so url(...) is ignored.
3 causes, each with a fixMobile apps
A custom font in React Native falls back to the system font
Unrecognized font family 'MyFont'
React Native does not report a missing font, it just draws the system font.
6 causes, each with a fixMobile apps
react-native-geolocation-service getCurrentPosition fails or never returns
Location provider not available
Read the error code in the callback.
5 causes, each with a fix