diff --git a/src/components/forms/SearchInput.tsx b/src/components/forms/SearchInput.tsx index fcbf0e641d..97540d0bca 100644 --- a/src/components/forms/SearchInput.tsx +++ b/src/components/forms/SearchInput.tsx @@ -1,11 +1,12 @@ import React from 'react' -import {Pressable, TextInput, View} from 'react-native' +import {TextInput, View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {HITSLOP_10} from '#/lib/constants' import {isNative} from '#/platform/detection' -import {atoms as a, native, useTheme, web} from '#/alf' +import {atoms as a, useTheme} from '#/alf' +import {Button, ButtonIcon} from '#/components/Button' import * as TextField from '#/components/forms/TextField' import {MagnifyingGlass2_Stroke2_Corner0_Rounded as MagnifyingGlassIcon} from '#/components/icons/MagnifyingGlass2' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' @@ -22,6 +23,7 @@ export const SearchInput = React.forwardRef( function SearchInput({value, label, onClearText, ...rest}, ref) { const t = useTheme() const {_} = useLingui() + const showClear = value && value.length > 0 return ( @@ -40,37 +42,41 @@ export const SearchInput = React.forwardRef( autoCorrect={false} autoComplete="off" autoCapitalize="none" + style={[ + showClear + ? { + paddingRight: 24, + } + : {}, + ]} {...rest} /> - {value && value.length > 0 && ( - + + {showClear && ( + + + + )} ) },