diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/composer/Composer.tsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index f5b29664a..17d0f94f7 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -64,6 +64,7 @@ import { type SupportedMimeTypes, } from '#/lib/constants' import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED' +import {useAppState} from '#/lib/hooks/useAppState' import {useIsKeyboardVisible} from '#/lib/hooks/useIsKeyboardVisible' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {usePalette} from '#/lib/hooks/usePalette' @@ -822,6 +823,8 @@ let ComposerPost = React.memo(function ComposerPost({ [post.id, onSelectVideo, onImageAdd, _], ) + useHideKeyboardOnBackground() + return ( <View style={[ @@ -1522,6 +1525,18 @@ function isEmptyPost(post: PostDraft) { ) } +function useHideKeyboardOnBackground() { + const appState = useAppState() + + useEffect(() => { + if (isIOS) { + if (appState === 'inactive') { + Keyboard.dismiss() + } + } + }, [appState]) +} + const styles = StyleSheet.create({ topbarInner: { flexDirection: 'row', |