Skip to content

fix: re-export AssetRegistry from the react-native components shim - #504

Merged
danstepanov merged 1 commit into
nativewind:mainfrom
oJaqob:fix/export-asset-registry
Nov 6, 2026
Merged

danstepanov merged 1 commit into
nativewind:mainfrom
oJaqob:fix/export-asset-registry

Conversation

@oJaqob

@oJaqob oJaqob commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

What

Adds AssetRegistry to the react-native-css/components re-exports.

Why

The Metro resolver sends react-native imports from node_modules to this file. React Native 0.88 added AssetRegistry to its public exports, and expo-asset does import { AssetRegistry } from 'react-native'. Without this getter, expo-asset receives undefined and every asset load fails:

TypeError: Cannot read property 'getAssetByID' of undefined
    at fromModule (expo-asset/build/Asset.js)

In an app this shows up as useFonts failing and the app silently falling back to system fonts.

I compared the export list of react-native/index.js (0.88.0) with this file. AssetRegistry was the only name missing.

Checked

  • Reproduced on Android with react-native 0.88.0, expo 58.0.13 and expo-asset 58.0.16: fonts fell back to the system font before the change and load correctly after it.
  • I haven't run the repo's own test suite.

@sammoore

sammoore commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@danstepanov can you run CI on this one? If it passes (no reason it shouldn't), we should merge.

mathiramilo added a commit to mathiramilo/football-club-management that referenced this pull request Oct 25, 2026
…(TECH-15)

NativeWind 5 (release candidate, on Tailwind v4 through react-native-css)
reads the same packages/ui-tokens/theme.css as the web, so both apps share
one token file. Metro sets rem to 16 px and keeps --club and --club-tint
as runtime variables, which ClubTheme sets after the contrast guard;
useClubTheme exposes the colors to platform controls such as Switch.

Archivo loads at startup as three families with their weights, so
font-sans, font-heading and font-display match the web. Text applies the
family (native text doesn't inherit it) and caps display titles at 1.4x
font scaling so wide titles don't break mid-word at 200%. Icon maps a
lucide icon's text color and size from classes.

Two release-candidate fixes:
- @expo/metro-config's lightningcss is pinned to 1.30.1: react-native-css
  compiles with that copy and fails to deserialize 1.33's output.
- react-native-css is patched to re-export React Native 0.88's
  AssetRegistry (upstream nativewind/react-native-css#504). Without it
  expo-asset gets undefined and every font load fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mathiramilo added a commit to mathiramilo/football-club-management that referenced this pull request Oct 25, 2026
…(TECH-15)

NativeWind 5 (release candidate, on Tailwind v4 through react-native-css)
reads the same packages/ui-tokens/theme.css as the web, so both apps share
one token file. Metro sets rem to 16 px and keeps --club and --club-tint
as runtime variables, which ClubTheme sets after the contrast guard;
useClubTheme exposes the colors to platform controls such as Switch.

Archivo loads at startup as three families with their weights, so
font-sans, font-heading and font-display match the web. Text applies the
family (native text doesn't inherit it) and caps display titles at 1.4x
font scaling so wide titles don't break mid-word at 200%. Icon maps a
lucide icon's text color and size from classes.

Two release-candidate fixes:
- @expo/metro-config's lightningcss is pinned to 1.30.1: react-native-css
  compiles with that copy and fails to deserialize 1.33's output.
- react-native-css is patched to re-export React Native 0.88's
  AssetRegistry (upstream nativewind/react-native-css#504). Without it
  expo-asset gets undefined and every font load fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
christophehurpeau added a commit to christophehurpeau/alouette that referenced this pull request Nov 4, 2026
expo-asset 58 imports AssetRegistry from react-native (0.88), but
react-native-css redirects react-native imports to a shim that does not
forward it, crashing font loading on native. Remove once a release
includes nativewind/react-native-css#504.

Refs: nativewind/react-native-css#506

@sammoore sammoore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danstepanov approved!

@danstepanov
danstepanov force-pushed the fix/export-asset-registry branch from 532e369 to ee24ec3 Compare November 6, 2026 07:14
@danstepanov
danstepanov merged commit 811f357 into nativewind:main Nov 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants