119dc08ecS猫头猫import React from 'react'; 24060c00aS猫头猫import {Text, TextProps} from 'react-native'; 319dc08ecS猫头猫import {useTheme} from 'react-native-paper'; 44060c00aS猫头猫import { 54060c00aS猫头猫 ColorKey, 64060c00aS猫头猫 colorMap, 74060c00aS猫头猫 fontSizeConst, 84060c00aS猫头猫 fontWeightConst, 94060c00aS猫头猫} from '@/constants/uiConst'; 1019dc08ecS猫头猫 1119dc08ecS猫头猫type IThemeTextProps = TextProps & { 1219dc08ecS猫头猫 fontColor?: ColorKey; 1319dc08ecS猫头猫 fontSize?: keyof typeof fontSizeConst; 1419dc08ecS猫头猫 fontWeight?: keyof typeof fontWeightConst; 1519dc08ecS猫头猫}; 1619dc08ecS猫头猫 1719dc08ecS猫头猫export default function ThemeText(props: IThemeTextProps) { 1819dc08ecS猫头猫 const theme = useTheme(); 194060c00aS猫头猫 const { 204060c00aS猫头猫 style, 214060c00aS猫头猫 children, 224060c00aS猫头猫 fontSize = 'content', 234060c00aS猫头猫 fontColor = 'normal', 244060c00aS猫头猫 fontWeight = 'regular', 254060c00aS猫头猫 } = props; 2619dc08ecS猫头猫 2719dc08ecS猫头猫 const themeStyle = { 2819dc08ecS猫头猫 color: theme.colors[colorMap[fontColor]], 2919dc08ecS猫头猫 fontSize: fontSizeConst[fontSize], 3019dc08ecS猫头猫 fontWeight: fontWeightConst[fontWeight], 3119dc08ecS猫头猫 includeFontPadding: false, 3219dc08ecS猫头猫 }; 3319dc08ecS猫头猫 3419dc08ecS猫头猫 const _style = Array.isArray(style) 3519dc08ecS猫头猫 ? [themeStyle, ...style] 3619dc08ecS猫头猫 : [themeStyle, style]; 3719dc08ecS猫头猫 3819dc08ecS猫头猫 return ( 39*15feccc1S猫头猫 <Text {...props} style={_style} allowFontScaling={false}> 4019dc08ecS猫头猫 {children} 4119dc08ecS猫头猫 </Text> 4219dc08ecS猫头猫 ); 4319dc08ecS猫头猫} 44