Skip to content

fix: avoid native view registry on web - #1526

Open
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/1216-web-host-component
Open

fix: avoid native view registry on web#1526
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/1216-web-host-component

Conversation

@huytdps13400

Copy link
Copy Markdown

Summary

  • add a platform-specific getHostComponent.web.ts so web resolution never imports React Native's native NativeComponentRegistry
  • preserve the existing ViewConfig, ReactNativeView, and callback wrapper type exports through type-only re-exports
  • throw a targeted error only when a consumer tries to create a native-only Nitro View on web
  • add a regression test whose native-registry mock throws if the web module imports it

The emitted ESM and CommonJS web files contain no runtime imports, NativeComponentRegistry, or react-native/Libraries/NativeComponent paths.

Verification

  • RED: bun install / package typecheck failed because getHostComponent.web did not exist
  • focused web regression test passes
  • bun run build
  • full core package Jest suite passes (1 test, 1 existing todo)
  • monorepo bun typecheck
  • bun nitro lint-ci
  • full JavaScript/TypeScript bun lint
  • built ESM/CJS output inspected and asserted free of native registry imports
  • git diff --check

Fixes #1216

@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
nitro-docs Skipped Skipped Aug 23, 2026 11:03am

Request Review

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.

Deep import of react-native/Libraries/NativeComponent/NativeComponentRegistry breaks expo web builds with tree shaking

1 participant