Description
Description
Since NativeWind v5 / react-native-css redirects every non-internal import ... from "react-native" to react-native-css/components, anything that reads a React Native export missing from components/index.cjs gets undefined.
AssetRegistry became part of the public react-native API in RN 0.88 (index.js has get AssetRegistry()), but it is not listed in src/components/index.cts (and the shipped dist/*/components/index.cjs).
expo-asset does import { AssetRegistry } from 'react-native', so it receives undefined.
Environment
- react-native-css 3.1.0-rc.0 (nativewind 5.0.0-rc.0)
- expo 58.0.23, expo-asset 58.0.20, react-native 0.88.1
- Android, Metro
Reproduction
- Expo SDK 58 app with NativeWind v5 (
withNativewindin metro.config.js). - Use
NativeTabs.Trigger.Iconfromexpo-router/native-tabswith anmdprop and installexpo-symbols. - Open the app on Android.
Actual
TypeError: Cannot read property 'getAssetByID' of undefined
fromModule (node_modules/expo-asset/build/Asset.js:125)
getAssetForSource (node_modules/expo-font/build/FontLoader.js)
loadAsync (node_modules/expo-font/build/Font.js)
unstable_getMaterialSymbolSourceAsync (node_modules/expo-symbols/build/materialImageSource.js)
Diagnostic in app code:
import * as RN from 'react-native';
Object.keys(RN).includes('AssetRegistry'); // false
typeof require('react-native/src/private/assets/AssetRegistry').AssetRegistry; // 'object'Cause
src/components/index.cts is a hand-written list of getters. Comparing it with react-native/index.js (0.88.1) by name, AssetRegistry is the only export from the RN side that is missing.
Fix
Add to src/components/index.cts:
get AssetRegistry() {
return require("react-native").AssetRegistry;
},With this change (applied via patch-package to the commonjs and module index.cjs files as well) the Android tab icons render and the error is gone.
Suggestion
Generate the list from react-native's exports instead of maintaining it by hand, so new RN exports do not silently disappear.
Note: I did not verify this against 3.1.0-rc.1; its release notes do not mention it.
Activity
samquarm commentedon Nov 9, 2026
Another data point: this also silently breaks every custom font loaded through
expo-font/useFonts, not just symbols. Every family fails withCannot read property 'getAssetByID' of undefined, the hook returns an error, and all text falls back to the system font, so weights and custom faces disappear with no crash. Seen with nativewind 5.0.0-rc.1 + react-native-css 3.1.0-rc.1 on RN 0.88 / Expo SDK 58, Android.Workaround until the export is added: in
metro.config.js, wrap theresolveRequestthatwithNativewindreturns so that areact-nativeimport coming fromnode_modules(outside react-native-css / nativewind) resolves to the real package viacontext.resolveRequest. App code keeps the wrapper. The trade-off is thatclassNameon third-party components that spread props onto RN views stops working.mfmsajidh commentedon Nov 10, 2026
Related to #504