@@ -3,11 +3,11 @@ import {StyleSheet} from 'react-native';
33import { useAnimatedStyle , useSharedValue , withTiming , Easing } from 'react-native-reanimated' ;
44import { useDidUpdate } from '../../hooks' ;
55import Assets from '../../assets' ;
6- import { Spacings , Colors } from '../../style' ;
6+ import { Colors } from '../../style' ;
77import View from '../view' ;
88import Button from '../button' ;
99import FieldContext from './FieldContext' ;
10- import { TextFieldProps } from './types' ;
10+ import { ClearButtonProps } from './types' ;
1111
1212const hitSlop = { top : 20 , bottom : 20 , left : 20 , right : 20 } ;
1313const NON_VISIBLE_POSITION = 18 ;
@@ -17,7 +17,7 @@ const TIMING_CONFIG = {
1717 easing : Easing . bezier ( 0.33 , 1 , 0.68 , 1 )
1818} ;
1919
20- const ClearButton = ( { testID, onClear, onChangeText} : Pick < TextFieldProps , 'onClear' | 'testID' | 'onChangeText' > ) => {
20+ const ClearButton = ( { testID, onClear, onChangeText, clearButtonStyle } : ClearButtonProps ) => {
2121 const { hasValue} = useContext ( FieldContext ) ;
2222 const animatedValue = useSharedValue ( hasValue ? VISIBLE_POSITION : NON_VISIBLE_POSITION ) ;
2323 const animatedOpacity = useSharedValue ( hasValue ? 1 : 0 ) ;
@@ -29,7 +29,7 @@ const ClearButton = ({testID, onClear, onChangeText}: Pick<TextFieldProps, 'onCl
2929 } ;
3030 } ) ;
3131
32- const style = useMemo ( ( ) => [ styles . container , animatedStyle ] , [ animatedStyle ] ) ;
32+ const style = useMemo ( ( ) => [ clearButtonStyle , animatedStyle ] , [ clearButtonStyle , animatedStyle ] ) ;
3333
3434 const animate = useCallback ( ( ) => {
3535 const toValue = hasValue ? VISIBLE_POSITION : NON_VISIBLE_POSITION ;
@@ -64,9 +64,6 @@ const ClearButton = ({testID, onClear, onChangeText}: Pick<TextFieldProps, 'onCl
6464} ;
6565
6666const styles = StyleSheet . create ( {
67- container : {
68- marginHorizontal : Spacings . s3
69- } ,
7067 clearIcon : {
7168 tintColor : Colors . $textNeutralLight
7269 }
0 commit comments