secondary_button.tsx 829 B

1234567891011121314151617181920212223242526272829303132333435
  1. import React, { ReactElement } from "react";
  2. import { Pressable, StyleSheet, ViewStyle, StyleProp } from "react-native";
  3. interface SecondaryButtonProps {
  4. title: ReactElement;
  5. extendedStyle?: StyleProp<ViewStyle>;
  6. onPress: () => void;
  7. }
  8. const SecondaryButton: React.FC<SecondaryButtonProps> = ({ 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. backgroundColor: "#e7f2f8",
  23. justifyContent: "center",
  24. alignItems: "center",
  25. borderRadius: 10,
  26. },
  27. buttonPressed: {
  28. backgroundColor: "#d0e1e8",
  29. },
  30. });
  31. export default SecondaryButton;