Skip to content

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

Merged
janicduplessis merged 1 commit into
mainfrom
@janic/web-resize-insets
Aug 12, 2026
Merged

fix: update insets and frame on window resize on web#736
janicduplessis merged 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.

@janicduplessis
janicduplessis marked this pull request as ready for review August 12, 2026 01:39
@janicduplessis
janicduplessis merged commit 1fe7ec5 into main Aug 12, 2026
2 checks passed
@janicduplessis
janicduplessis deleted the @janic/web-resize-insets branch August 12, 2026 01:40
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