import * as React from 'react'; import { View, TouchableOpacity, ActivityIndicator } from 'react-native'; import AppText from '../LidoAppText/index.native'; import styles from './index.style'; interface LidoAppTextProps { onPress: () => void; loading?: boolean; loadingProps?: { size?: number | 'small' | 'large' | undefined; color?: string; }; disabled?: boolean; clickedStyle?: object; style?: object; styleText?: object; title?: string; subTitle?: string; subTitleStyle?: object; superScriptStyle?: object; superScript?: React.ReactNode; } const LidoButton: React.FC = (props) => { const [clicked, setClicked] = React.useState({}); const { onPress, loading = false, loadingProps: { size = 'small', color = '#fff' } = {}, disabled = false, clickedStyle = {} } = props; function _onPress() { if (!disabled) { onPress(); } } return ( setClicked({})} onPressIn={() => setClicked(clickedStyle)} > {loading ? ( ) : ( <> {props.title} {props.superScript} {props.subTitle ? ( {props.subTitle} ) : ( <> )} )} ); }; export default LidoButton;