From 603eb94dd934f11ff568a3bd814e310bcbf152e1 Mon Sep 17 00:00:00 2001 From: shubhamguptadream11 Date: Fri, 9 Aug 2024 12:23:09 -0700 Subject: [PATCH] feat(android): height issue fixed with keyboard avoiding component in new architecture (#45928) Summary: Fixes this issue: https://github.com/facebook/react-native/issues/45880 ## Changelog: [ANDROID] [CHANGED] - Replaced `mLastHeight` with `mVisibleViewArea.height()` since mLastHeight value is not getting updated. For `width` we are already using `mVisibleViewArea.width()` Pull Request resolved: https://github.com/facebook/react-native/pull/45928 Test Plan: - Tested the fix in new and old architecture both Reviewed By: christophpurrer Differential Revision: D61023998 Pulled By: cortinico fbshipit-source-id: df67616330effb7b9e6724d94b3be92c0dbd6190 --- .../src/main/java/com/facebook/react/ReactRootView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index 4aa8d031e4e..90c638e64f3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -895,7 +895,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { sendEvent( "keyboardDidHide", createKeyboardEventPayload( - PixelUtil.toDIPFromPixel(mLastHeight), + PixelUtil.toDIPFromPixel(mVisibleViewArea.height()), 0, PixelUtil.toDIPFromPixel(mVisibleViewArea.width()), 0)); @@ -944,7 +944,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { sendEvent( "keyboardDidHide", createKeyboardEventPayload( - PixelUtil.toDIPFromPixel(mLastHeight), + PixelUtil.toDIPFromPixel(mVisibleViewArea.height()), 0, PixelUtil.toDIPFromPixel(mVisibleViewArea.width()), 0));