Repository navigation
Web: startup crash with react-native-web 0.21.3 when the react-native root is loaded (InputAccessoryView circular import) #704
Description
What happened?
With Uniwind 1.12.1 and react-native-web 0.21.3, an Expo app crashes on web at startup:
TypeError: Cannot read properties of undefined (reading 'default')
at Object.get [as InputAccessoryView] (…/_expo/static/js/web/entry-….js)
With web.output: 'single' the page stays blank and the error is in the console. With web.output: 'static' (the default create-expo-app template), expo export -p web already fails during static rendering with the same error.
The crash happens whenever something loads the react-native root on web. expo-router does this: its compiled code calls require('react-native'). apps/expo-example does not reproduce it as is, because babel-plugin-react-native-web rewrites its named imports to per-component modules, so the react-native-web root index is never loaded there.
Cause. The web InputAccessoryView added in #697 does import * as ReactNative from 'react-native' and reads ReactNative.InputAccessoryView ?? ReactNative.View at module scope. On web, Metro's webResolver redirects react-native-web's own ./exports/InputAccessoryView import (in react-native-web/dist/index.js) to uniwind/components/InputAccessoryView:
- The react-native-web root index starts initializing and requires
./exports/InputAccessoryView, which now resolves to the Uniwind wrapper. - The wrapper imports the root index again. That is a circular import, so the wrapper gets the partially initialized exports object.
- The module-scope read of
InputAccessoryViewcalls the root index getter before_exportsInputAccessoryView2is assigned, and it throws.
The other web wrappers use named imports, which babel-plugin-react-native-web rewrites to react-native-web/dist/exports/<Component>. They never touch the root index.
| Uniwind | react-native-web | Result |
|---|---|---|
| 1.12.0 | 0.21.3 | web bundling fails (#695) |
| 1.12.1 | 0.21.2 | works |
| 1.12.1 | 0.21.3 | crashes on startup when the root is loaded |
Fresh installs of Expo SDK 57 and 58 resolve react-native-web ~0.21.0 and babel-plugin-react-native-web ~0.21.0 (from babel-preset-expo) to 0.21.3, so new Expo Router apps hit this on web.
A fix with a regression test is in #703. This replaces #702, which I opened without the issue form by mistake.
Steps to Reproduce
Fresh Expo app:
npx create-expo-app@latest repro --template default@sdk-57, then install dependencies. react-native-web and babel-plugin-react-native-web resolve to 0.21.3.- Add Uniwind 1.12.1 as in the quickstart:
uniwind@1.12.1andtailwindcss@4.3.3,metro.config.jswithwithUniwindConfig(getDefaultConfig(__dirname), { cssEntryFile: './src/uniwind.css' }),src/uniwind.csscontaining@import 'tailwindcss'; @import 'uniwind';, andimport '../uniwind.css'at the top ofsrc/app/_layout.tsx. - Run
npx expo export -p web. It fails with the error above. - Pin
react-native-web@0.21.2and export again. The export succeeds and the app renders.
In this repository, using the linked branch:
- In the branch,
apps/expo-example/App.tsxhas one added line:import * as ReactNative from 'react-native'. - Run
bun install, thenbun run buildinpackages/uniwind. - Run
npx expo export -p webinapps/expo-example, servedist, and open it. The page is blank and the console shows the error.
Snack or Repository Link
https://github.com/dmitryshostak/uniwind/tree/repro/web-input-accessory-view-crash
Uniwind version
1.12.1
React Native Version
0.86.3 (Expo SDK 57.0.26); also 0.88.0-rc.3 (Expo SDK 58.0.0)
Platforms
Web
Expo
Yes
Additional information 〰
- I've searched for similar issues in this repository and found none
Activity
Brentlok commentedon Oct 5, 2026
🚀 This pull request is included in v1.12.2. See Release v1.12.2 for release notes.