From b78996a5690add6c978ee5867ddf666a3471f116 Mon Sep 17 00:00:00 2001 From: Ian MacDonald Date: Fri, 18 Feb 2022 18:25:40 -0500 Subject: [PATCH] fix(android): when hiding the keyboard make view lose focus to match ios behavior (#9786) Hiding the keyboard on iOS loses focus; this makes Android match when no view argument is provided. --- packages/core/utils/native-helper.android.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/utils/native-helper.android.ts b/packages/core/utils/native-helper.android.ts index 96364ad77..cdb68a71b 100644 --- a/packages/core/utils/native-helper.android.ts +++ b/packages/core/utils/native-helper.android.ts @@ -63,7 +63,12 @@ export namespace ad { windowToken = nativeView.getWindowToken(); } else if (androidApp.foregroundActivity instanceof androidx.appcompat.app.AppCompatActivity) { const decorView = androidApp.foregroundActivity.getWindow().getDecorView(); - windowToken = decorView ? decorView.getWindowToken() : null; + if (decorView) { + windowToken = decorView.getWindowToken(); + decorView.requestFocus(); + } else { + windowToken = null; + } } if (inputManager && windowToken) {