Remote Dimension Resolution and Capping
In Expo, the dimension cap does not apply before the remote URL is resolved. The Image component must first fetch the remote asset's metadata or the asset itself to determine its intrinsic dimensions. The configured dimension cap (typically enforced via style properties or resizeMode) is applied after the remote URL resolution and image download have occurred, governing how the image is scaled or clipped within the layout.
Cache Retention and Storage Quotas
When an app restarts, the in-memory cache for remote asset metadata is cleared. However, the physical image data may persist in the platform's disk cache unless the device's storage quota has been exceeded. If the storage quota is reached, the operating system or the underlying native image loader may discard cached assets to free space, forcing a fresh network request upon the next render.
Placeholder Rendering Consistency
The placeholder component is rendered consistently across build types (Development, Preview, and Production) when a remote image exceeds size limits or is still loading. The sequence is as follows:
- The
placeholder (or a custom loading component) is displayed initially.
- The remote asset is fetched and its dimensions are resolved.
- If the image successfully loads, it replaces the placeholder.
- If the image fails to load due to storage quota exhaustion or network errors, the
onError callback is triggered, and the image may remain as a placeholder or transition to a fallback image.
Verification Steps
To verify how dimensions are being applied in your specific SDK version, use the following approach:
<Image
source={{ uri: 'https://example.com/large-image.jpg' }}
onLoadStart={() => console.log('Loading started...')}
onLoadEnd={() => console.log('Loading ended. Dimensions applied.')}
style={{ width: 200, height: 200 }}
/>
Use a debugger (such as React Native Debugger or Flipper) to inspect the computed layout properties after onLoadEnd fires to confirm the cap is active.
Diagnostic Requirement
To provide a more precise answer regarding the Image.resolveAssetSource interaction, please specify your Expo SDK version, as asset resolution logic has evolved significantly between SDK 49 and SDK 51.