Skip to content

Commit

Permalink
fix clear button in input (#5650)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Bailey <[email protected]>
  • Loading branch information
haileyok and estrattonbailey authored Oct 8, 2024
1 parent 2ab9512 commit 3da4f9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/forms/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const SearchInput = React.forwardRef<TextInput, SearchInputProps>(
function SearchInput({value, label, onClearText, ...rest}, ref) {
const t = useTheme()
const {_} = useLingui()
const showClear = value && value.length > 0

return (
<View style={[a.w_full, a.relative]}>
Expand All @@ -41,11 +42,18 @@ export const SearchInput = React.forwardRef<TextInput, SearchInputProps>(
autoCorrect={false}
autoComplete="off"
autoCapitalize="none"
style={[
showClear
? {
paddingRight: 24,
}
: {},
]}
{...rest}
/>
</TextField.Root>

{value && value.length > 0 && (
{showClear && (
<View
style={[
a.absolute,
Expand Down

0 comments on commit 3da4f9b

Please sign in to comment.