Skip to content
Closed
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,11 @@ private Activity getActivity() {
while (!(context instanceof Activity) && context instanceof ContextWrapper) {
context = ((ContextWrapper) context).getBaseContext();
}
return (Activity) context;
if(context instanceof Activity){
return (Activity) context;
}

return null;
}
Comment thread
gabrieldonadel marked this conversation as resolved.

@RequiresApi(api = Build.VERSION_CODES.R)
Expand All @@ -942,7 +946,12 @@ private void checkForKeyboardEvents() {
Insets barInsets = rootInsets.getInsets(WindowInsets.Type.systemBars());
int height = imeInsets.bottom - barInsets.bottom;

int softInputMode = getActivity().getWindow().getAttributes().softInputMode;
Activity activity = getActivity();
if(activity == null){
Comment thread
gabrieldonadel marked this conversation as resolved.
Outdated
return;
}

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