normal_button.tsx 802 B

123456789101112131415161718192021222324252627282930313233343536
  1. import React, { ReactElement } from "react";
  2. import { Pressable, Text, StyleSheet, ViewStyle, StyleProp } from "react-native";
  3. interface NormalButtonProps {
  4. title: ReactElement;
  5. extendedStyle?: StyleProp<ViewStyle>;
  6. onPress: () => void;
  7. }
  8. const NormalButton: React.FC<NormalButtonProps> = ({ title, extendedStyle, onPress }) => {
  9. return (
  10. <Pressable
  11. onPress={onPress}
  12. style={({ pressed }) => [styles.button, pressed ? styles.buttonPressed : null, extendedStyle]}
  13. >
  14. {title}
  15. </Pressable>
  16. );
  17. };
  18. const styles = StyleSheet.create({
  19. button: {
  20. maxWidth: "100%",
  21. padding: 15,
  22. margin: 10,
  23. backgroundColor: "#025c72",
  24. justifyContent: "center",
  25. alignItems: "center",
  26. borderRadius: 10,
  27. },
  28. buttonPressed: {
  29. backgroundColor: "#28495c",
  30. },
  31. });
  32. export default NormalButton;