Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

globalClassNamePolyfill: AssetRegistry missing from react-native re-export whitelist

Đang mở Phù hợp với người mới
#506 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
87/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react-native, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Đọc src/components/index.cts và so sánh các getter của AppRegistry và AppState với export AssetRegistry được yêu cầu. Thêm getter được mô tả trong issue, sau đó build lại dist theo hướng dẫn. Hoàn tất khi AssetRegistry được re-export từ whitelist và bản distribution đã build có thay đổi này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug

With NativeWind v5 / globalClassNamePolyfill: true, Metro remaps import … from 'react-native' to react-native-css/components. That entry (src/components/index.cts) is a hand-maintained whitelist of RN exports.

AssetRegistry is not on the list. Callers such as expo-asset then do:

import { AssetRegistry } from 'react-native';
AssetRegistry.getAssetByID(id); // Cannot read property 'getAssetByID' of undefined

This breaks Material Symbol loading for Expo Router NativeTabs md icons (and any other expo-asset / font path that uses AssetRegistry).

Fix

Add the same getter pattern used for AppRegistry / AppState:

get AssetRegistry() {
  return require("react-native").AssetRegistry;
},

after AppState in src/components/index.cts (and rebuild dist).

require("react-native") from inside this package stays on the real RN module because the Metro resolver treats react-native-css as internal and does not remapped it.

Environment

Happy to open a PR if useful.

Ngôn ngữ chính
TypeScript
Star
166
Fork
45
Merge trung bình
13 ngày 14 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nativewind/react-native-css

Tất cả issue của nativewind/react-native-css

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.