Fix keyboard flicker when selecting a draft in composer (#9864)
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -54,6 +54,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