Skip to content

Commit f779fcc

Browse files
fix(web, SafeAreaView): replace default export with named export (#3956)
## Description `safe-area/index.ts` re-exports `SafeAreaView` as a named export: ```ts export { SafeAreaView } from './SafeAreaView'; ``` For web builds, webpack resolves `'./SafeAreaView'` to `'./SafeAreaView.web.tsx'`, which only had a default export: ```ts const SafeAreaView = View; export default SafeAreaView; ``` This causes a `ModuleDependencyWarning` at build time: ``` export 'SafeAreaView' (imported as 'SafeAreaView') was not found in './safe-area/SafeAreaView' (possible exports: default) ``` This also affects `ScreenStackItem.tsx`, which does: ```ts import { SafeAreaView } from './safe-area/SafeAreaView'; ``` For web builds this resolves to the `.web` variant, again hitting the same missing named export. ## Fix Replace the default export with a named export in `SafeAreaView.web.tsx` to match the native variant (`SafeAreaView.tsx`), which only has a named export, and the package's public surface (`safe-area/index.ts`), which only re-exports as named. ## Test plan - [x] Verified the warning no longer appears in a web/Storybook webpack build after this change ## Related Found while upgrading \`react-native-screens\` to \`4.25.0-beta.1\` in [Expensify/App#89199](Expensify/App#89199). Co-authored-by: Cursor <[email protected]>
1 parent e22e64c commit f779fcc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/components/safe-area/SafeAreaView.web.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { View } from 'react-native';
22

33
const SafeAreaView = View;
44

5-
export default SafeAreaView;
5+
export { SafeAreaView };

0 commit comments

Comments
 (0)