Fix keyboard flicker when selecting a draft in composer (#9864)
(cherry picked from commit c46219bc4d)
This commit is contained in:
committed by
Eric Bailey
parent
e8ef4030d0
commit
8ff87d285a
@@ -1,5 +1,5 @@
|
||||
import {useCallback, useEffect, useMemo} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {Keyboard, View} from 'react-native'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
@@ -53,6 +53,12 @@ export function DraftsListDialog({
|
||||
|
||||
const handleSelectDraft = useCallback(
|
||||
(summary: DraftSummary) => {
|
||||
// Dismiss keyboard immediately to prevent flicker. Without this,
|
||||
// the text input regains focus (showing the keyboard) after the
|
||||
// drafts sheet closes, then loses it again when the post component
|
||||
// remounts with the draft content, causing a show-hide-show cycle -sfn
|
||||
Keyboard.dismiss()
|
||||
|
||||
control.close(() => {
|
||||
onSelectDraft(summary)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user