1import React from 'react'; 2import {Pressable} from 'react-native'; 3import ThemeText from './themeText'; 4import rpx from '@/utils/rpx'; 5import {CustomizedColors} from '@/hooks/useColors'; 6 7interface IButtonProps { 8 withHorizonalPadding?: boolean; 9 style?: any; 10 hitSlop?: number; 11 children: string; 12 fontColor?: keyof CustomizedColors; 13 onPress?: () => void; 14} 15export default function (props: IButtonProps) { 16 const {children, onPress, fontColor, hitSlop, withHorizonalPadding} = props; 17 return ( 18 <Pressable 19 {...props} 20 style={[ 21 withHorizonalPadding 22 ? { 23 paddingHorizontal: rpx(24), 24 } 25 : null, 26 props.style, 27 ]} 28 hitSlop={hitSlop ?? (withHorizonalPadding ? 0 : rpx(28))} 29 onPress={onPress} 30 accessible 31 accessibilityLabel={children}> 32 <ThemeText fontColor={fontColor}>{children}</ThemeText> 33 </Pressable> 34 ); 35} 36