normal_button.tsx 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. disabled?: boolean;
  8. }
  9. const NormalButton: React.FC<NormalButtonProps> = ({ title, extendedStyle, onPress, disabled }) => {
  10. return (
  11. <Pressable
  12. onPress={onPress}
  13. disabled={disabled}
  14. style={({ pressed }) => [styles.button, pressed ? styles.buttonPressed : null, extendedStyle]}
  15. >
  16. {title}
  17. </Pressable>
  18. );
  19. };
  20. const styles = StyleSheet.create({
  21. button: {
  22. maxWidth: "100%",
  23. fontSize: 16,
  24. backgroundColor: "#025c72",
  25. justifyContent: "center",
  26. alignItems: "center",
  27. borderRadius: 12,
  28. padding: 20,
  29. },
  30. buttonPressed: {
  31. backgroundColor: "#28495c",
  32. },
  33. });
  34. export default NormalButton;