Skip to content

Commit

Permalink
Fix: Android clearFocus hide keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
lanistor committed Dec 2, 2022
1 parent 3545dd5 commit 7d4f296
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1724,8 +1724,7 @@ public void requestFocusView() {
InputMethodManager inputManager =
(InputMethodManager) this.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
inputManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public boolean checkInputConnectionProxy(final View view) {
public void clearFocus() {
super.clearFocus();

InputMethodManager inputManager = (InputMethodManager) this.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.hideSoftInputFromWindow(this.getWindowToken(), 0);
}

if (useHybridComposition) {
return;
}
Expand Down

0 comments on commit 7d4f296

Please sign in to comment.