import * as React from 'react'; import { Headline, Paragraph, Subheading, Caption, withTheme, Text, } from 'react-native-paper'; function MyText(props) { const { type, size, children, bold, center, more } = props; let { color, theme, style } = props; const { colors } = theme; if (type) { color = colors[type]; } if (color) { theme = { ...theme, colors: { ...theme.colors, text: color, }, }; } else { theme = { ...theme, colors: { ...theme.colors, text: '#000', }, }; } if (bold) { style = { ...style, fontWeight: 'bold', }; } if (center) { style = { ...style, textAlign: 'center', }; } let lineProps = { numberOfLines: 1, ellipsizeMode: 'tail', }; if (more) { lineProps = {}; } if (children) { switch (size) { case 'h1': // 24 return ( {children} ); case 's1': // 16 return ( {children} ); case 'c1': // 12 return ( {children} ); case 'c2': // 10 return ( {children} ); default: // 14 return ( {children} ); } } else { return <>; } } export default withTheme(MyText);