Skip to content

Commit

Permalink
Merge pull request #51307 from QichenZhu/fix/48100
Browse files Browse the repository at this point in the history
Fix KeyboardAvoidingView padding on Android
  • Loading branch information
stitesExpensify authored Oct 28, 2024
2 parents f9b91b6 + 65ef887 commit 608ec61
Showing 1 changed file with 26 additions and 0 deletions.
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));

0 comments on commit 608ec61

Please sign in to comment.