fix clear button in input (#5650)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -23,6 +23,7 @@ export const SearchInput = React.forwardRef<TextInput, SearchInputProps>(
|
|||||||
function SearchInput({value, label, onClearText, ...rest}, ref) {
|
function SearchInput({value, label, onClearText, ...rest}, ref) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
const showClear = value && value.length > 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.w_full, a.relative]}>
|
<View style={[a.w_full, a.relative]}>
|
||||||
@@ -41,11 +42,18 @@ export const SearchInput = React.forwardRef<TextInput, SearchInputProps>(
|
|||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
|
style={[
|
||||||
|
showClear
|
||||||
|
? {
|
||||||
|
paddingRight: 24,
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
]}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</TextField.Root>
|
</TextField.Root>
|
||||||
|
|
||||||
{value && value.length > 0 && (
|
{showClear && (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.absolute,
|
a.absolute,
|
||||||
|
|||||||
Reference in New Issue
Block a user