Skip to content

Commit

Permalink
Improve documentation for AssetSourceResolver (#48532)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #48532

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D67942309

fbshipit-source-id: 0f3901bfcd58863adf6dc8466bb5d587438e0d2c
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Jan 8, 2025
1 parent 6feb90b commit dc5535c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-native/Libraries/Image/AssetSourceResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ function getAssetPathInDrawableFolder(asset: PackagerAsset): string {

/**
* Returns true if the asset can be loaded over the network.
*
* This prevents an issue loading XML assets on Android. XML asset types like
* vector drawables can only be loaded from precompiled source. Android does
* not support loading these over the network, and AAPT precompiles data by
* breaking path data and resource information apart into multiple files,
* stuffing it all into the resource table. As a result, we should only attempt
* to load resources as we would in release builds: by the resource name.
*
* For more information, see:
* https://issuetracker.google.com/issues/62435069
* https://issuetracker.google.com/issues/68293189
*/
function assetSupportsNetworkLoads(asset: PackagerAsset): boolean {
return !(asset.type === 'xml' && Platform.OS === 'android');
Expand Down

0 comments on commit dc5535c

Please sign in to comment.