import { ActivityIndicator, I18nManager, ImageSourcePropType, ImageStyle, TextStyle, TouchableOpacity, View, ViewStyle, } from 'react-native'; import * as React from 'react'; import styled from 'styled-components/native'; const StyledButton = styled.View` background-color: ${(props: any) => props.theme.colors.primary}; border-radius: 26px; border-width: 2px; height: 52px; border-color: ${(props: any) => props.theme.colors.primary}; flex-direction: row; align-items: center; justify-content: center; box-shadow: 1px 1px 2px #00000020; padding-left: 20px; padding-right: 20px; position: relative; ` const StyledButtonDisabled = styled(StyledButton)` background-color: ${(props: any) => props.theme.colors.disabled}; border-color: ${(props: any) => props.theme.colors.disabled}; ` const StyledText = styled.Text` font-size: 16px; color: ${(props: any) => props.theme.colors.btnFont}; margin-left: 10px; margin-right: 10px; font-family: 'Poppins-Regular'; ` const StyledTextDisabled = styled(StyledText)` color: ${(props: any) => props.theme.colors.primary}; ` const StyledImage = styled.Image` width: 20px; height: 20px; resize-mode: contain; ` const EndImage = styled.Image` width: 15px; height: 15px; resize-mode: contain; position: absolute; right: 20px; `; interface Props { testID?: string; isLoading?: boolean; isDisabled?: boolean; onClick?: () => void; style?: ViewStyle; parentStyle?: ViewStyle; disabledStyle?: ViewStyle; textStyle?: TextStyle; imgLeftSrc?: ImageSourcePropType | string; imgLeftStyle?: ImageStyle; imgRightSrc?: any; imgRightStyle?: ImageStyle; indicatorColor?: string; activeOpacity?: number; text?: string; isCircle?: boolean; bgColor?: string; borderColor?: string; loadingStyle?: ViewStyle; theme?: any; textProps?: any } const OButton = (props: Props): React.ReactElement => { if (props.isDisabled) { return ( {props.text} ); } if (props.isLoading) { return ( ); } return ( {props.imgLeftSrc ? ( ) : null} {props.text ? ( {props.text} ) : null} {props.imgRightSrc ? ( ) : null} ); } OButton.defaultProps = { isLoading: false, isDisabled: false, indicatorColor: 'white', activeOpacity: 0.5, imgRightSrc: require('../../assets/icons/arrow_right.png') }; export default OButton;