Skip to content

fix: update insets and frame on window resize on web#736

Draft
janicduplessis wants to merge 1 commit into
mainfrom
@janic/web-resize-insets
Draft

fix: update insets and frame on window resize on web#736
janicduplessis wants to merge 1 commit into
mainfrom
@janic/web-resize-insets

Conversation

@janicduplessis

Copy link
Copy Markdown
Collaborator

Summary

Adds a window resize listener to the web NativeSafeAreaProvider that calls the existing measurement handler (removed on effect cleanup). Insets and frame were only re-measured on the hidden element's CSS transitionend, which a plain window resize never fires, so useSafeAreaFrame and useSafeAreaInsets stayed stale after mount.

Fixes #184

Test Plan

Added src/__tests__/NativeSafeAreaProvider.web-test.tsx (jsdom): renders the web provider with stubbed computed paddings and document dimensions, dispatches a resize event, and asserts onInsetsChange reports the new frame and insets. Fails without the fix (onInsetsChange never called after resize), passes with it.

jest-environment-jsdom is added as a devDependency (Jest 29 doesn't bundle it) — that's all the yarn.lock churn.

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.

useSafeAreaFrame doesn't update on device resize (RN Web)

1 participant