import { useColors } from './Provider'; import React from 'react'; import type { StyleProp, ViewStyle } from 'react-native'; import { IconButton as PaperButton } from 'react-native-paper'; declare type Props = Omit, 'mode'> & { mode?: 'text' | 'outline' | 'contained' | 'light' | 'gray'; shape?: 'circle' | 'regular'; }; const IconButton = (props: Props) => { const { getColor } = useColors(); const { mode, style, color = 'primary', shape = 'regular', ...otherProps } = props; const customStyle: StyleProp = [{ elevation: 0, borderRadius: 5 }]; if (mode === 'contained') { customStyle.push({ backgroundColor: getColor(`${color}500`), }); } 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 === 'circle') { customStyle.push({ borderRadius: 1000, }); } customStyle.push(style); const customColor = mode === 'contained' ? 'white' : color ? getColor(`${color}500`) : getColor('primary500'); return ( ); }; export default IconButton;