Files
Alex Hunt 715eeaad69 Deprecate @react-native/assets-registry (#57370)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57370

**Context**

This stack intends to relocate the `AssetRegistry` API from `react-native/assets-registry` into `react-native` — addressing runtime safety and public deep imports issues (1.0 and JS Stable API blockers).

**This diff**

Deprecate the `react-native/assets-registry` package, replaced by changes in the last two diffs:

- `react-native/assets-registry/registry` → use `AssetRegistry` from `react-native` (or the `react-native/asset-registry` build entry point).
- `react-native/assets-registry/path-support` → use `react-native/asset-utils`.

**Deprecation plan**

The package will be deprecated for **two release cycles** (0.87 + 0.88) and deleted in 0.89.

Changelog:
[General][Deprecated] - Deprecate `react-native/assets-registry`. Use `AssetRegistry` from `react-native` and `react-native/asset-utils` instead.

Reviewed By: cortinico

Differential Revision: D110053924

fbshipit-source-id: 877a8f1b155232ccca037db6834fbcd9e0b0cc68
2026-07-06 10:32:14 -07:00
..

@react-native/assets-registry

npm package

Warning

This package is deprecated (since 0.87) and will be removed in a future release. Use AssetRegistry from react-native (or the react-native/asset-registry build entry point) instead of @react-native/assets-registry/registry, and @react-native/asset-utils instead of @react-native/assets-registry/path-support.

Runtime registry that maps asset IDs generated in a Metro bundle to asset metadata. It backs <Image>, Image.resolveAssetSource(), and any code that resolves require('./img.png') on native.

Most apps never import this directly — assets are handled through <Image>.

API

@react-native/assets-registry/registry (DEPRECATED)

Warning

Deprecated: Aliases to AssetRegistry (since 0.87).

Please use:

  • import { AssetRegistry } from 'react-native'; (apps/library code)
  • 'react-native/asset-registry' (entrypoint for Metro/build configs)
Export Signature Notes
registerAsset (asset: PackagerAsset) => number Stores the asset; returns a numeric ID
getAssetByID (assetId: number) => PackagerAsset Looks an asset back up by ID

@react-native/assets-registry/path-support (DEPRECATED)

Warning

Deprecated: Use @react-native/asset-utils (since 0.87).

Android resource-path helpers, used when copying assets into drawable-* folders.

Export Signature Notes
getAndroidResourceFolderName (asset: PackagerAsset, scale: number) => string e.g. drawable-xhdpi; non-drawable types resolve to raw
getAndroidResourceIdentifier (asset: PackagerAsset) => string Sanitised resource name
getBasePath (asset: PackagerAsset) => string httpServerLocation without the leading slash