import React, { forwardRef } from 'react'; import { useRestyle, createVariant } from '@shopify/restyle'; import { TextInput, TouchableOpacity } from 'react-native'; import { Box } from '../Box'; import CloseIcon from '../../icons/CloseIcon'; import { fonts, Theme } from './../../theme/theme'; import { Normalize } from '../../utils/normalize'; import { useTheme } from '../../theme/ThemeProvider'; import { MagnifyingGlass } from 'phosphor-react-native'; type TextInputProps = React.ComponentPropsWithRef & { onChangeCancel: () => void; }; const variant = createVariant({ themeKey: 'fonts', defaults: { flex: 1, paddingLeft: 'spacing-xs', fontFamily: fonts.caustenRoundRegular, color: 'darkBlueGray', fontSize: Normalize(16), }, }); const restyleFunctions = [variant]; export const TextFieldSearch = forwardRef( ({ ...rest }, ref) => { const props = useRestyle(restyleFunctions as any, rest); const { colors } = useTheme(); return ( {rest.value ? ( rest.onChangeCancel()}> ) : null} ); } );