rm forwardRef

This commit is contained in:
Samuel Newman
2025-08-06 17:13:10 +03:00
parent d16ca5083f
commit 137e7e7848
+10 -5
View File
@@ -1,4 +1,3 @@
import {forwardRef} from 'react'
import { import {
type NativeSyntheticEvent, type NativeSyntheticEvent,
type TextInput, type TextInput,
@@ -17,6 +16,7 @@ import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
import {IS_NATIVE} from '#/env' import {IS_NATIVE} from '#/env'
type SearchInputProps = Omit<TextField.InputProps, 'label'> & { type SearchInputProps = Omit<TextField.InputProps, 'label'> & {
ref?: React.Ref<TextInput>
label?: TextField.InputProps['label'] label?: TextField.InputProps['label']
/** /**
* Called when the user presses the (X) button * Called when the user presses the (X) button
@@ -28,8 +28,14 @@ type SearchInputProps = Omit<TextField.InputProps, 'label'> & {
onEscape?: () => void onEscape?: () => void
} }
export const SearchInput = forwardRef<TextInput, SearchInputProps>( export function SearchInput({
function SearchInput({value, label, onClearText, onEscape, ...rest}, ref) { ref,
value,
label,
onClearText,
onEscape,
...rest
}: SearchInputProps) {
const t = useTheme() const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
const showClear = value && value.length > 0 const showClear = value && value.length > 0
@@ -97,5 +103,4 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
)} )}
</View> </View>
) )
}, }
)