From 7f0ccc46dbd24a40e3116782b659231d15be9637 Mon Sep 17 00:00:00 2001 From: Jacek Pudysz Date: Wed, 2 Oct 2024 09:26:34 +0200 Subject: [PATCH] feat: prevent keyboard controller to report new ime insets when listener is disabled --- android/src/main/java/com/unistyles/Platform.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/src/main/java/com/unistyles/Platform.kt b/android/src/main/java/com/unistyles/Platform.kt index 7161265f..6354234c 100644 --- a/android/src/main/java/com/unistyles/Platform.kt +++ b/android/src/main/java/com/unistyles/Platform.kt @@ -145,6 +145,12 @@ class Platform(private val reactApplicationContext: ReactApplicationContext) { } val insets = insetsCompat.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()) + val bottomIME = insetsCompat.getInsets(WindowInsetsCompat.Type.ime()).bottom + + // fix for keyboard controller, that triggers WindowInsetsListener + if(!hasAnimatedInsets && bottomIME != 0) { + return + } if (!hasAnimatedInsets) { this.insets = Insets(statusBarTopInset, insets.bottom, insets.left, insets.right)