Skip to content

Commit 7d4f296

Browse files
committed
Fix: Android clearFocus hide keyboard
1 parent 3545dd5 commit 7d4f296

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,8 +1724,7 @@ public void requestFocusView() {
17241724
InputMethodManager inputManager =
17251725
(InputMethodManager) this.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
17261726
if (inputManager != null) {
1727-
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,
1728-
InputMethodManager.HIDE_IMPLICIT_ONLY);
1727+
inputManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
17291728
}
17301729
}
17311730

android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InputAwareWebView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ public boolean checkInputConnectionProxy(final View view) {
150150
public void clearFocus() {
151151
super.clearFocus();
152152

153+
InputMethodManager inputManager = (InputMethodManager) this.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
154+
if (inputManager != null) {
155+
inputManager.hideSoftInputFromWindow(this.getWindowToken(), 0);
156+
}
157+
153158
if (useHybridComposition) {
154159
return;
155160
}

0 commit comments

Comments
 (0)