Skip to content
Closed
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
Expand Up @@ -854,20 +854,6 @@ public void onGlobalLayout() {
checkForDeviceDimensionsChanges();
}

private @Nullable WindowManager.LayoutParams getWindowLayoutParams() {
View view = ReactRootView.this;
if (view.getLayoutParams() instanceof WindowManager.LayoutParams) {
return (WindowManager.LayoutParams) view.getLayoutParams();
}
while (view.getParent() instanceof View) {
view = (View) view.getParent();
if (view.getLayoutParams() instanceof WindowManager.LayoutParams) {
return (WindowManager.LayoutParams) view.getLayoutParams();
}
}
return null;
}

@RequiresApi(api = Build.VERSION_CODES.R)
private void checkForKeyboardEvents() {
getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
Expand All @@ -885,13 +871,10 @@ private void checkForKeyboardEvents() {
Insets barInsets = rootInsets.getInsets(WindowInsets.Type.systemBars());
int height = imeInsets.bottom - barInsets.bottom;

int softInputMode;
WindowManager.LayoutParams windowLayoutParams = getWindowLayoutParams();
if (windowLayoutParams != null) {
softInputMode = windowLayoutParams.softInputMode;
} else {
return;
}
ViewGroup.LayoutParams rootLayoutParams = getRootView().getLayoutParams();
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Assertions.assertCondition(rootLayoutParams instanceof WindowManager.LayoutParams);

int softInputMode = ((WindowManager.LayoutParams) rootLayoutParams).softInputMode;
int screenY =
softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING
? mVisibleViewArea.bottom - height
Expand Down