Skip to content

Conversation

@alanleedev
Copy link
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
Contributor

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

@alanleedev
Copy link
Contributor Author

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

@zoontek
Copy link
Contributor

zoontek commented Jul 14, 2025

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

EDIT: I opened a PR on your fork to fix it alanleedev#1

alanleedev pushed a commit to alanleedev/react-native that referenced this pull request Jul 15, 2025
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 facebook#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
@facebook-github-bot
Copy link
Contributor

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

alanleedev pushed a commit to alanleedev/react-native that referenced this pull request Jul 15, 2025
Summary:
Pull Request resolved: facebook#52481

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 facebook#47080

## Changelog:

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

Pull Request resolved: facebook#47554

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

Rollback Plan:

Reviewed By: cortinico

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 facebook#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
Contributor

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

@react-native-bot
Copy link
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
cipolleschi added a commit that referenced this pull request Jul 21, 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
kikoso pushed a commit to kikoso/react-native that referenced this pull request Aug 26, 2025
Summary:
Pull Request resolved: facebook#52481

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 facebook#47080

## Changelog:

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

Pull Request resolved: facebook#47554

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

Rollback Plan:

Reviewed By: cortinico

Differential Revision: D77906644

Pulled By: alanleedev

fbshipit-source-id: 121cd6bc4133973f06b28eb9e79c9387ac7070a1
kikoso pushed a commit to kikoso/react-native that referenced this pull request Aug 26, 2025
facebook#52732)

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: facebook#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