Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix measureInWindow feature parity between iOS and Android #29691

Closed
wants to merge 1 commit into from

Conversation

gedeagas
Copy link
Contributor

@gedeagas gedeagas commented Aug 19, 2020

Summary

This PR aims to fix a feature parity problem between iOS and Android. The iOS return y with status bar height while the android implementation does not. This issue is first discovered on #19497 and mentioned on RN Issue Triage Group 2 #24029.

Related Issue:
resolve #29638 #19497

visibleWindowFrame.top returns the StatusBar height. outputBuffer[1] does not contain the StatusBar height.

Changelog

[Android] [Fixed] - Fix measureInWindow y axis not including StatusBar

Test Plan

RNTester for Android

This is the correct result when measureInWindow is called on hello.
y is 44 from the top and 24 from the status bar. ( Hello have a 20 margin-top and status bar height is 24 ).

Screenshot from 2020-08-19 15-00-46

@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 Aug 19, 2020
@react-native-bot react-native-bot added Bug Platform: Android Android applications. labels Aug 19, 2020
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,003,051 0
android hermes armeabi-v7a 6,666,636 -7
android hermes x86 7,423,349 11
android hermes x86_64 7,314,243 -6
android jsc arm64-v8a 9,162,897 -4
android jsc armeabi-v7a 8,818,626 0
android jsc x86 9,011,296 13
android jsc x86_64 9,588,388 2

Base commit: 2e88b25

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 2e88b25

@gedeagas gedeagas changed the title WIP: Fix measureInWindow feature parity between iOS and Android Fix measureInWindow feature parity between iOS and Android Aug 19, 2020
@gedeagas
Copy link
Contributor Author

@dulmandakh @safaiyeh @ShikaSD can anybody from the core team confirm this? i still get this issue on latest release.

@usrbowe
Copy link
Contributor

usrbowe commented Aug 30, 2021

What is require to merge the PR? I think would be great, if we can fix it, as currently the implementation on Android is not in sync with iOS, which behaves correctly.
Seems like rather small code change.

@safaiyeh
Copy link
Contributor

Just time, the team is looking into PRs recently. Maybe @lunaleaps can bump this one.

@lunaleaps lunaleaps self-assigned this Aug 30, 2021
@lunaleaps
Copy link
Contributor

My concern is that we might be depending on this behavior somewhere.. but let me ask around

@facebook-github-bot
Copy link
Contributor

@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -712,7 +712,7 @@ public synchronized void measureInWindow(int tag, int[] outputBuffer) {
Rect visibleWindowFrame = new Rect();
v.getWindowVisibleDisplayFrame(visibleWindowFrame);
outputBuffer[0] = outputBuffer[0] - visibleWindowFrame.left;
outputBuffer[1] = outputBuffer[1] - visibleWindowFrame.top;
outputBuffer[1] = outputBuffer[1] + visibleWindowFrame.top;
Copy link
Contributor

@lunaleaps lunaleaps Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From discussion with @yungsters, why are we adding visibleWindowFrame.top versus removing this line altogether?

Also from the PR that introduced this change: #28449
visibleWindowFrame.top might include more than just status bar height.. is that expected that we want this included in the measure values?

Has this change been tested in split screen? What should the expected behavior be for that -- say for a split screen of:

---
A
--
B
---

What should B's measureInWindow return?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lunaleaps, let me check again. This PR is more than 1 year old already and I forget about the context. Let me check and confirm your concern and test the behavior on split-screen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lunaleaps i will work on this on the weekend, sorry for the delay.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, thanks for working on this!

@github-actions
Copy link

This PR is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 28, 2023
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This PR was closed because the author hasn't provided the requested feedback after 7 days.

@github-actions github-actions bot closed this Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Needs: Author Feedback Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIManager.measureInWindow on android not work as document
7 participants