diff --git a/src/components/forms/SearchInput.tsx b/src/components/forms/SearchInput.tsx index 8b54b44246..edd737352f 100644 --- a/src/components/forms/SearchInput.tsx +++ b/src/components/forms/SearchInput.tsx @@ -3,6 +3,7 @@ import {type TextInput, View} from 'react-native' import {useLingui} from '@lingui/react/macro' import {HITSLOP_10} from '#/lib/constants' +import {mergeRefs} from '#/lib/merge-refs' import {listenFocusSearch} from '#/state/events' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonIcon} from '#/components/Button' @@ -18,7 +19,7 @@ type Props = Omit & { */ onClearText?: () => void hotkey?: boolean - ref?: React.RefObject + ref?: React.Ref } export function SearchInput({ @@ -33,21 +34,20 @@ export function SearchInput({ const {t: l} = useLingui() const showClear = value && value.length > 0 const internalRef = useRef(null) - const inputRef = ref ?? internalRef useEffect(() => { if (!hotkey) return return listenFocusSearch(() => { - inputRef.current?.focus() + internalRef.current?.focus() }) - }, [hotkey, inputRef]) + }, [hotkey]) return (