Skip to content

fix(web, SafeAreaView): add named export alongside default export#3956

Open
roryabraham wants to merge 1 commit intosoftware-mansion:mainfrom
roryabraham:fix/safe-area-view-web-named-export
Open

fix(web, SafeAreaView): add named export alongside default export#3956
roryabraham wants to merge 1 commit intosoftware-mansion:mainfrom
roryabraham:fix/safe-area-view-web-named-export

Conversation

@roryabraham
Copy link
Copy Markdown

Description

safe-area/index.ts re-exports SafeAreaView as a named export:

export { SafeAreaView } from './SafeAreaView';

For web builds, webpack resolves './SafeAreaView' to './SafeAreaView.web.tsx', which only has a default export:

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:

import { SafeAreaView } from './safe-area/SafeAreaView';

For web builds this resolves to the .web variant, again hitting the same missing named export.

Fix

Add export { SafeAreaView } to SafeAreaView.web.tsx so the named export is available consistently with how the rest of the package imports it.

Test plan

  • 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.

Made with Cursor

The safe-area/index.ts re-exports SafeAreaView as a named export:
  export { SafeAreaView } from './SafeAreaView';

For web builds, webpack resolves './SafeAreaView' to './SafeAreaView.web.tsx',
which only has a default export. This causes a ModuleDependencyWarning at
build time since the named export 'SafeAreaView' cannot be found.

Add a named export to SafeAreaView.web.tsx so it is consistent with how
it is imported throughout the package (e.g. in ScreenStackItem.tsx).

Made-with: Cursor
@roryabraham roryabraham marked this pull request as ready for review April 29, 2026 18:06
Copy link
Copy Markdown
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

Hey, thanks for catching this & PR.

If this is an regression introduced in beta version, we can get rid of the default export entirely.

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.

2 participants