From dc5535cf88fe25cc7c8ade3eeefd271aecc17ec0 Mon Sep 17 00:00:00 2001 From: Peter Abbondanzo Date: Wed, 8 Jan 2025 14:54:17 -0800 Subject: [PATCH] Improve documentation for AssetSourceResolver (#48532) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48532 Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D67942309 fbshipit-source-id: 0f3901bfcd58863adf6dc8466bb5d587438e0d2c --- .../Libraries/Image/AssetSourceResolver.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-native/Libraries/Image/AssetSourceResolver.js b/packages/react-native/Libraries/Image/AssetSourceResolver.js index c37fbe1fceb..93f71702acd 100644 --- a/packages/react-native/Libraries/Image/AssetSourceResolver.js +++ b/packages/react-native/Libraries/Image/AssetSourceResolver.js @@ -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');