34 lines
817 B
TypeScript
34 lines
817 B
TypeScript
|
import Button from '@/components/theme/buttons/Button';
|
||
|
import { ThemedText } from '@/components/theme/Theme';
|
||
|
import { Colors } from '@/constants/Colors';
|
||
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
||
|
|
||
|
const DEFAULT_FONT_SIZE = 16;
|
||
|
|
||
|
type Props = {
|
||
|
width?: number;
|
||
|
height?: number;
|
||
|
text: string;
|
||
|
fontSize?: number;
|
||
|
onPress?: () => void;
|
||
|
};
|
||
|
|
||
|
const TextButton = ({ width, height, text, fontSize, onPress }: Props) => {
|
||
|
const scheme = useColorScheme() ?? 'dark';
|
||
|
return (
|
||
|
<Button width={width} height={height} onPress={onPress}>
|
||
|
<ThemedText
|
||
|
style={[
|
||
|
{
|
||
|
color: Colors[scheme].background,
|
||
|
fontSize: fontSize ?? DEFAULT_FONT_SIZE,
|
||
|
},
|
||
|
]}
|
||
|
>
|
||
|
{text}
|
||
|
</ThemedText>
|
||
|
</Button>
|
||
|
);
|
||
|
};
|
||
|
export default TextButton;
|