-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android] keyboardDidHide wrong screenY coordinates with windowTranslucentStatus=true #29292
Conversation
Base commit: e23e932 |
Base commit: e23e932 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdvacca has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Importing to review |
This pull request was successfully merged by @fabriziobertoglio1987 in 45954ac. When will my fix make it into a release? | Upcoming Releases |
…s=true (#29292) Summary: This issue fixes #27526, related issue #27089 Avoid returning the wrong screenY coordinates on event keyboardDidHide. getWindowVisibleDisplayFrame retrieves the overall visible display size in which the window this view is attached to has been positioned in. This takes into account screen decorations above the window, for both cases where the window itself is being position inside of them or the window is being placed under then and covered insets are used for the window to position its content inside. In effect, this tells you the available area where content can be placed and remain visible to users, since anything below the StatusBar is not visible to the user, the method does not work with translucent StatusBar (android:windowTranslucentStatus). This commit fixes this issues removing the white bar at the bottom of the view when using windowTranslucentStatus. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - keyboardDidHide wrong screenY coordinates with windowTranslucentStatus=true Pull Request resolved: #29292 Test Plan: Works in all scenarios, but **I did not change RNTester `windowTranslucentStatus`**. I would like to discuss the potential breaking changes connected to not using [getWindowVisibleDisplayFrame](https://developer.android.com/reference/android/view/View#getWindowVisibleDisplayFrame(android.graphics.Rect)) with `keyboardDidHide`. I would be happy to build an alternative functionality to calculate the WindowVisibleDisplayFrameHeight under request from the Facebook Team. **WITHOUT** `android:windowTranslucentStatus` | **BEFORE** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86804255-0eca4680-c077-11ea-8c79-95ba297d05ba.gif" />| | **AFTER** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86804265-10940a00-c077-11ea-8cb8-a304cc5de363.gif" /> | **WITH** `android:windowTranslucentStatus` | **BEFORE** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86804458-3a4d3100-c077-11ea-8f3e-7c43eaa08d70.gif" height="" />| | **BEFORE (log)** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86806330-0d018280-c079-11ea-9266-c3bcf23a35da.png" height="" />| | **AFTER** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86804464-3b7e5e00-c077-11ea-8487-34c87f076e5f.gif" height="" /> | | **AFTER (log)** | |:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86806042-c4e26000-c078-11ea-9c3c-cac5319bef65.png" height="" /> | RNTester **WITHOUT** `android:windowTranslucentStatus` | **BEFORE** | **AFTER** | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/86805348-176f4c80-c078-11ea-8e2a-e2d84af5c278.gif" width="300" height="" />| <img src="https://user-images.githubusercontent.com/24992535/86805324-13432f00-c078-11ea-9e70-fa2606eee86b.gif" width="300" height="" /> | I remain available to do improvements. Thanks a lot. Fabrizio. Reviewed By: JoshuaGross Differential Revision: D22521125 Pulled By: mdvacca fbshipit-source-id: e2cb90163abb1baa00b1916e431971b011522565
Thanks a lot David Vacca 🙏 |
This fix breaks the I just want to be sure if this change is actually correct? |
@andres-torres-marroquin I'll check into it this weekend, could you open and issue in react-native and reference this pr? |
Summary
This issue fixes #27526 fixes #30052, related issue #27089
Avoid returning the wrong screenY coordinates on event keyboardDidHide.
getWindowVisibleDisplayFrame retrieves the overall visible display size in which the window this view is attached to has been positioned in. This takes into account screen decorations above the window, for both cases where the window itself is being position inside of them or the window is being placed under then and covered insets are used for the window to position its content inside. In effect, this tells you the available area where content can be placed and remain visible to users, since anything below the StatusBar is not visible to the user, the method does not work with translucent StatusBar (android:windowTranslucentStatus).
This commit fixes this issues removing the white bar at the bottom of the view when using windowTranslucentStatus.
Changelog
[Android] [Fixed] - keyboardDidHide wrong screenY coordinates with windowTranslucentStatus=true
Test Plan
Works in all scenarios, but I did not change RNTester
windowTranslucentStatus
. I would like to discuss the potential breaking changes connected to not using getWindowVisibleDisplayFrame withkeyboardDidHide
.I would be happy to build an alternative functionality to calculate the WindowVisibleDisplayFrameHeight under request from the Facebook Team.
WITHOUT
android:windowTranslucentStatus
WITH
android:windowTranslucentStatus
RNTester WITHOUT
android:windowTranslucentStatus
I remain available to do improvements. Thanks a lot. Fabrizio.