import { useColors } from './Provider'; import React from 'react'; import type { StyleProp, ViewStyle } from 'react-native'; import { Button as PaperButton } from 'react-native-paper'; declare type Props = Omit, 'mode'> & { mode?: 'text' | 'outline' | 'contained' | 'light' | 'gray'; shape?: 'pill' | 'square' | 'regular'; }; const Button = function (props: Props) { const { getColor } = useColors(); const { mode, style, color = 'primary', shape = 'regular', ...otherProps } = props; const customStyle: StyleProp = [{ elevation: 0, borderRadius: 5 }]; if (mode === 'light') { customStyle.push({ backgroundColor: getColor(`${color}100`), }); } if (mode === 'gray') { customStyle.push({ backgroundColor: getColor('gray100') }); } if (mode === 'outline') { customStyle.push({ borderColor: getColor(`${color}500`), borderWidth: 1, }); } if (shape === 'square') { customStyle.push({ borderRadius: 0 }); } if (shape === 'pill') { customStyle.push({ borderRadius: 1000 }); } customStyle.push(style); const customColor = color ? getColor(`${color}500`) : getColor('primary500'); return ( {otherProps.children} ); }; export default Button;