Skip to content

Conversation

@kikoso
Copy link
Contributor

@kikoso kikoso commented Aug 26, 2025

ReactRootView now listens to WindowInfoTracker events on Android 15+ to handle fold/unfold state changes. Previously, useWindowDimensions relied only on configuration changes, which are not always triggered on Android 15. This caused incorrect width/height values on foldable devices.

The new listener recalculates display metrics and emits didUpdateDimensions to JS, restoring correct behavior.

Fixes #47080

Summary

On Android 15 foldables, useWindowDimensions does not update after fold/unfold because no configuration change is triggered. This PR introduces a WindowInfoTracker listener in ReactRootView to detect these window layout changes and emit updated display metrics to JavaScript. This restores correct dimension reporting in apps.

Changelog

[ANDROID] [FIXED] - Fix useWindowDimensions not updating on Android 15 foldables by listening to WindowInfoTracker events in ReactRootView

Test Plan

  • Tested on an Android 15 foldable emulator (Pixel Fold).
  • Verified that folding/unfolding the device correctly updates useWindowDimensions.
  • Confirmed that the didUpdateDimensions event is emitted and JS receives the new width/height values.
  • No regressions observed on Android < 15.

ReactRootView now listens to WindowInfoTracker events on Android 15+ to handle fold/unfold state changes. Previously, useWindowDimensions relied only on configuration changes, which are not always triggered on Android 15. This caused incorrect width/height values on foldable devices.

The new listener recalculates display metrics and emits `didUpdateDimensions` to JS, restoring correct behavior.
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 26, 2025
@react-native-bot
Copy link
Collaborator

Fails
🚫

📋 Missing Changelog - Please add a Changelog to your PR description. See Changelog format

Generated by 🚫 dangerJS against 9c0b4df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dimensions.get('window').height not consistent in Android 14 and Android 15

2 participants