2024-05-05 17:44:42 +02:00
|
|
|
import React from "react";
|
|
|
|
import { Text, StyleSheet, Pressable } from "react-native";
|
|
|
|
|
|
|
|
export default function Button(props) {
|
2024-05-08 21:18:47 +02:00
|
|
|
const { onPress, title = "Button", color = "black" } = props;
|
2024-05-08 16:50:25 +02:00
|
|
|
return (
|
|
|
|
<Pressable
|
|
|
|
style={({ pressed }) => [
|
|
|
|
{
|
|
|
|
backgroundColor: pressed
|
|
|
|
? "rgb(210, 230, 255 )"
|
|
|
|
: color
|
|
|
|
? color
|
|
|
|
: "black",
|
|
|
|
},
|
|
|
|
styles.button,
|
|
|
|
]}
|
|
|
|
onPress={onPress}
|
|
|
|
>
|
|
|
|
<Text style={styles.text}>{title}</Text>
|
|
|
|
</Pressable>
|
|
|
|
);
|
2024-05-05 17:44:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
2024-05-08 16:50:25 +02:00
|
|
|
button: {
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
paddingVertical: 12,
|
|
|
|
paddingHorizontal: 32,
|
|
|
|
borderRadius: 4,
|
|
|
|
elevation: 3,
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
fontSize: 16,
|
|
|
|
lineHeight: 21,
|
|
|
|
fontWeight: "bold",
|
|
|
|
letterSpacing: 0.25,
|
|
|
|
color: "white",
|
|
|
|
},
|
2024-05-05 17:44:42 +02:00
|
|
|
});
|