From 4479096b5631c0f3d311d8afef73a24dfb082c8f Mon Sep 17 00:00:00 2001 From: jerbob92 Date: Mon, 20 Jul 2020 18:01:57 +0200 Subject: [PATCH] fix(android): add check in ad.dismissSoftInput to make sure the dismissed nativeView has focus at that moment (#8720) closes https://github.com/NativeScript/NativeScript/issues/8713 --- nativescript-core/utils/native-helper.android.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nativescript-core/utils/native-helper.android.ts b/nativescript-core/utils/native-helper.android.ts index 06c9cee04..ce1709fbd 100644 --- a/nativescript-core/utils/native-helper.android.ts +++ b/nativescript-core/utils/native-helper.android.ts @@ -62,6 +62,9 @@ export module ad { let windowToken: android.os.IBinder; if (nativeView instanceof android.view.View) { + if (!nativeView.hasFocus()) { + return; + } windowToken = nativeView.getWindowToken(); } else if (androidApp.foregroundActivity instanceof androidx.appcompat.app.AppCompatActivity) { const decorView = androidApp.foregroundActivity.getWindow().getDecorView(); @@ -159,4 +162,4 @@ export module ad { return fingerprint != null && (fingerprint.indexOf("vbox") > -1 || fingerprint.indexOf("generic") > -1); } -} \ No newline at end of file +}