diff options
author | Hailey <me@haileyok.com> | 2024-06-04 19:44:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 03:44:43 +0100 |
commit | afbcac3ff30befeddcaeed1b862a352ea1f2ca69 (patch) | |
tree | 4ef11d3d813b676950997af458d9b3cb9c584e1b /src | |
parent | deea2f383988aef51035b27b10167cebfd29f612 (diff) | |
download | voidsky-afbcac3ff30befeddcaeed1b862a352ea1f2ca69.tar.zst |
use a timeout to focus the composer input (#4370)
* use a timeout to focus the composer input * scope to just android * scope useEffect to just android as well * oops * cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/composer/Composer.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 58ec65a88..80890286b 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -154,6 +154,13 @@ export const ComposePost = observer(function ComposePost({ const [extGif, setExtGif] = useState<Gif>() const [labels, setLabels] = useState<string[]>([]) const [threadgate, setThreadgate] = useState<ThreadgateSetting[]>([]) + + React.useEffect(() => { + if (!isAndroid) return + const id = setTimeout(() => textInput.current?.focus(), 100) + return () => clearTimeout(id) + }, []) + const gallery = useMemo( () => new GalleryModel(initImageUris), [initImageUris], @@ -517,7 +524,7 @@ export const ComposePost = observer(function ComposePost({ ref={textInput} richtext={richtext} placeholder={selectTextInputPlaceholder} - autoFocus={true} + autoFocus={!isAndroid} setRichText={setRichText} onPhotoPasted={onPhotoPasted} onPressPublish={onPressPublish} |