secondary_button.tsx 807 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. margin: 10,
  23. backgroundColor: "#e7f2f8",
  24. justifyContent: "center",
  25. alignItems: "center",
  26. borderRadius: 10,
  27. },
  28. buttonPressed: {
  29. backgroundColor: "#d0e1e8",
  30. },
  31. });
  32. export default SecondaryButton;