import React, { forwardRef } from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Icon } from '@rneui/themed'; import { useTheme } from './themes'; type IconProps = { name: string; type: string; color: string; }; type SecondButtonProps = { backgroundColor?: string; disabled?: boolean; icon?: IconProps; title?: string; onPress?: () => void; }; export const SecondButton = forwardRef((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.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', }, });