import React, { forwardRef } from 'react'; import { StyleSheet, Text, TouchableOpacity, View, ActivityIndicator } from 'react-native'; import Icon, { type IconProps } from './Icon'; import { useTheme } from './themes'; type IconButtonProps = Pick & { color: string }; type SecondButtonProps = { backgroundColor?: string; disabled?: boolean; icon?: IconButtonProps; title: string; onPress?: () => void; loading?: boolean; testID?: string; }; export const SecondButton = forwardRef, SecondButtonProps>((props, ref) => { const { colors } = useTheme(); let backgroundColor = props.backgroundColor ? props.backgroundColor : colors.buttonGrayBackgroundColor; let fontColor = colors.secondButtonTextColor; if (props.disabled === true) { backgroundColor = colors.buttonDisabledBackgroundColor; fontColor = colors.buttonDisabledTextColor; } const buttonView = props.loading ? ( ) : ( {props.icon && } {props.title && {props.title}} ); return props.onPress ? ( {buttonView} ) : ( {buttonView} ); }); const styles = StyleSheet.create({ button: { minHeight: 45, height: 48, maxHeight: 48, borderRadius: 7, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16, flexGrow: 1, }, content: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', }, text: { marginHorizontal: 8, fontSize: 16, fontWeight: '600', }, view: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', }, });