hide keyboard when backgrounding (#8450)
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user