Skip to content

Fix Dimensions window values on Android < 15 (#47554)#52481

Closed
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D77906644
Closed

Fix Dimensions window values on Android < 15 (#47554)#52481
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D77906644

Conversation

@alanleedev

Copy link
Copy Markdown
Contributor

Summary:
This PR (initially created for edge-to-edge opt-in support, rebased multiple times) fixes the Dimensions API window values on Android < 15, when edge-to-edge is enabled.

Currently the window height doesn't include the status and navigation bar heights (but it does on Android >= 15):

Screenshot 2025-06-27 at 16 23 02

Using WindowMetricsCalculator from AndroidX:

Screenshot 2025-06-27 at 16 34 01

Fixes #47080

Changelog:

[Android] [Fixed] Fix Dimensions window values on Android < 15 when edge-to-edge is enabled

Test Plan:
Run the example app on an Android < 15 device.

Rollback Plan:

Differential Revision: D77906644

Pulled By: alanleedev

@facebook-github-bot facebook-github-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 Jul 8, 2025
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D77906644

@alanleedev

Copy link
Copy Markdown
Contributor Author

This PR is re-attempt to merge previously reverted PR #47554 by @zoontek

@zoontek

zoontek commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

@alanleedev I provided the fix to the crash on Android 7 here

EDIT: I opened a PR on your fork to fix it https://github.com/alanleedev/react-native/pull/1

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D77906644

Summary:

This PR (initially created for edge-to-edge opt-in support, rebased multiple times) fixes the `Dimensions` API `window` values on Android < 15, when edge-to-edge is enabled.

Currently the window height doesn't include the status and navigation bar heights (but it does on Android >= 15):

<img width="300" alt="Screenshot 2025-06-27 at 16 23 02" src="https://github.com/user-attachments/assets/c7d11334-9298-4f7f-a75c-590df8cc2d8a" />

Using `WindowMetricsCalculator` from AndroidX:

<img width="300" alt="Screenshot 2025-06-27 at 16 34 01" src="https://github.com/user-attachments/assets/7a4e3dc7-a83b-421b-8f6d-fd1344f5fe81" />

Fixes #47080

## Changelog:

[Android] [Fixed] Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled


Test Plan:
Run the example app on an Android < 15 device.

Rollback Plan:

Reviewed By: cortinico

Differential Revision: D77906644

Pulled By: alanleedev
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D77906644

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @zoontek in 86994a6

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Jul 16, 2025
cipolleschi added a commit that referenced this pull request Jul 21, 2025
facebook-github-bot pushed a commit that referenced this pull request Jul 21, 2025
Summary:
Commit 86994a6 breaks Android for API level 24. Since it has landed last week, we had CI red. reverting this change while we found a valid fix forward.

## Changelog:
[Android][Changed] - Reverted fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled

Pull Request resolved: #52732

Test Plan:
GHA is green.:
https://github.com/facebook/react-native/actions/runs/16414048087/job/46377878366?pr=52732
https://github.com/facebook/react-native/actions/runs/16414048087/job/46377878383?pr=52732

Reviewed By: cortinico, rshest

Differential Revision: D78657920

Pulled By: cipolleschi

fbshipit-source-id: 396a48c9aa7bde3109e25200fe2decc9977efda4
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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

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

4 participants