You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Load packager image assets from a compiled asset catalog instead of loose
files in the app bundle. At build time react-native-xcode.sh has the CLI emit
imagesets into a staging catalog (--asset-catalog-dest, already in
@react-native/community-cli-plugin), compiles it with actool into an
RNAssets.bundle inside the app, and the native image loader resolves images
by name from that bundle with [UIImage imageNamed:inBundle:].
The feature is opt-in via the RCTUseAssetCatalog Info.plist key, which is the
single source of truth: the native loader reads it (a build-time constant,
read once) and react-native-xcode.sh reads the same key to decide whether to
bundle images into the catalog, so build and runtime cannot disagree on where
image assets live. The script owns the catalog end to end, so migrating an
app is adding the one Info.plist key: no .xcassets to create and no Xcode
project changes. The app's own asset pipeline (Images.xcassets, asset symbol
generation, CompileAssetCatalog) is untouched, and apps that have not
migrated are unaffected.
The catalog path is a single lookup with no filesystem fallback; a mis-bundled
asset logs an RCTLogError instead of failing silently. The native side only
resolves catalog names for what the CLI actually emits into the catalog
(png/jpg/jpeg under main-bundle assets/, mirroring isCatalogAsset), so
gif/webp packager assets, sub-bundles and OTA assets outside the main bundle
fall through to the existing loader. jpeg is also added to
RCTIsImageAssetsPath so jpeg assets are routed to the bundle-asset loaders.
rn-tester and private/helloworld opt in via their Info.plists. helloworld's
bundle phase now also substitutes REACT_NATIVE_PATH in CONFIG_JSON, which any
bundling build requires.
Cold image loads in RNTester are ~15x faster (median 47us vs 719us).
Copy file name to clipboardExpand all lines: packages/rn-tester/RNTester/Info.plist
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,8 @@
48
48
<string>You need to add NSPhotoLibraryUsageDescription key in Info.plist to enable photo library usage, otherwise it is going to *fail silently*!</string>
0 commit comments