import * as React from 'react'; import { View } from 'react-native'; import { Paragraph, Button, Caption, withTheme, Text, Subheading, } from 'react-native-paper'; import { ActivityIndicator, Flex } from '@ant-design/react-native'; function MyButton(props) { const { children, onPress, outline, text, size, type, theme, block, style, left, width, height, radius, disabled, loading, } = props; let { fontColor, color } = props; const { colors } = theme; let contentStyle = {}; let mode = 'contained'; let childNode; let dark = true; switch (type) { case 'primary': color = colors.primary; if (disabled) { color = '#8E8E8E'; } break; case 'info': if (outline || text) { color = colors.info; } else { color = colors.lightInfo; fontColor = colors.info; } break; case 'danger': color = colors.error; break; default: color = color || colors.primary; break; } if (outline) { mode = 'outlined'; dark = false; } if (text) { mode = 'text'; dark = false; } switch (size) { case 'mini': contentStyle = { height: 25 }; childNode = () => ( {children} ); break; case 'small': contentStyle = { height: 30 }; childNode = () => ( // 14 {children} ); break; case 'normal': contentStyle = { width: width || 120, height: height || 44 }; childNode = () => ( {children} ); break; case 'large': // 16 contentStyle = { width: width || 120, height: height || 44 }; if (left) { contentStyle = { height: 44, paddingRight: 30 }; } childNode = () => ( {children} ); break; default: contentStyle = { width: width || 120, height: height || 30 }; childNode = () => ( {children} ); break; } if (block) { delete contentStyle.width; return ( ); } else { return ( ); } } export default withTheme(MyButton);