2024-10-08 16:58:50 -05:00
|
|
|
import { StyleSheet, Pressable } from "react-native";
|
|
|
|
import { ThemedText } from "@/components/ThemedText";
|
|
|
|
import { ThemedView } from "@/components/ThemedView";
|
|
|
|
import { Colors } from '@/constants/Colors';
|
|
|
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
2024-10-08 19:40:36 -05:00
|
|
|
|
|
|
|
const DEFAULT_WIDTH = 320;
|
|
|
|
const DEFAULT_HEIGHT = 68;
|
2024-10-08 16:58:50 -05:00
|
|
|
|
|
|
|
type Props = {
|
2024-10-08 19:40:36 -05:00
|
|
|
width?: number;
|
|
|
|
height?: number;
|
2024-10-08 16:58:50 -05:00
|
|
|
onPress?: () => void;
|
|
|
|
};
|
|
|
|
|
2024-10-08 19:40:36 -05:00
|
|
|
const Button = ({ width, height, children, onPress }: Props & React.ComponentProps<typeof Pressable>) => {
|
2024-10-08 16:58:50 -05:00
|
|
|
const scheme = useColorScheme() ?? 'light';
|
2024-10-08 19:40:36 -05:00
|
|
|
return (
|
|
|
|
<ThemedView
|
|
|
|
style={[
|
|
|
|
styles.buttonContainer,
|
|
|
|
{
|
|
|
|
width: (width ?? DEFAULT_WIDTH),
|
|
|
|
height: (height ?? DEFAULT_HEIGHT),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
<Pressable
|
|
|
|
style={[
|
|
|
|
styles.button,
|
|
|
|
{backgroundColor: Colors[scheme].text}
|
|
|
|
]}
|
|
|
|
onPress={onPress}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</Pressable>
|
|
|
|
</ThemedView>
|
|
|
|
);
|
2024-10-08 16:58:50 -05:00
|
|
|
};
|
|
|
|
export default Button;
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
buttonContainer: {
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
padding: 3,
|
|
|
|
},
|
|
|
|
button: {
|
|
|
|
borderRadius: 10,
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
flexDirection: 'row',
|
|
|
|
},
|
|
|
|
});
|