From 29a4a5f90c9cdea3ef30281f47cc1552570dc498 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Fri, 7 Jun 2024 15:32:38 +0300
Subject: Composer - backup android focus (#4415)

* backup android focus

* bump to 300ms just to make sure it catches all of them
---
 src/view/com/composer/Composer.tsx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'src/view/com/composer/Composer.tsx')

diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 3c2b8db2d..7872ea186 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -402,6 +402,19 @@ export const ComposePost = observer(function ComposePost({
     bottomBarAnimatedStyle,
   } = useAnimatedBorders()
 
+  // Backup focus on android, if the keyboard *still* refuses to show
+  useEffect(() => {
+    if (!isAndroid) return
+    if (isModalReady) {
+      setTimeout(() => {
+        if (!Keyboard.isVisible()) {
+          textInput.current?.blur()
+          textInput.current?.focus()
+        }
+      }, 300)
+    }
+  }, [isModalReady])
+
   return (
     <>
       <KeyboardAvoidingView
-- 
cgit 1.4.1

