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 KeyboardAvoidingView padding on Android #51307

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
index ed1aba8..0a9284f 100644
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
+++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
@@ -891,7 +891,9 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
sendEvent(
"keyboardDidHide",
createKeyboardEventPayload(
- PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
+ // Use mLastHeight to account for the translucent status bar, and fall back to getMeasuredHeight() on Bridgeless mode.
+ // Remove this patch once the upstream fix for https://github.com/facebook/react-native/issues/47140 is released.
+ PixelUtil.toDIPFromPixel(mWasMeasured ? mLastHeight : getMeasuredHeight()),
0,
PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
0));
@@ -940,7 +942,9 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
sendEvent(
"keyboardDidHide",
createKeyboardEventPayload(
- PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
+ // Use mLastHeight to account for the translucent status bar, and fall back to getMeasuredHeight() on Bridgeless mode.
+ // Remove this patch once the upstream fix for https://github.com/facebook/react-native/issues/47140 is released.
+ PixelUtil.toDIPFromPixel(mWasMeasured ? mLastHeight : getMeasuredHeight()),
0,
PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
0));