@nexara/nativeflow
Version:
Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.
55 lines (54 loc) • 1.31 kB
JavaScript
;
import { Text } from 'react-native';
import { responsiveFontSize } from "../../helpers/ResponsiveCalculations.js";
import { useTheme } from "../../hooks/index.js";
import { jsx as _jsx } from "react/jsx-runtime";
const StyledText = ({
variant = 'primary',
fScale = 'base',
children,
style,
ff,
fs,
tas,
fw,
color,
themeColor,
...rest
}) => {
const {
colors,
sizes: {
typography: typographyScales
}
} = useTheme();
const getVariantColor = () => {
switch (variant) {
case 'secondary':
return colors.typography.secondary;
case 'tertiary':
return colors.typography.tertiary;
case 'disabled':
return colors.typography.disabled;
case 'inverse':
return colors.typography.inverse;
default:
return colors.typography.primary;
}
};
return /*#__PURE__*/_jsx(Text, {
style: [{
fontSize: responsiveFontSize(fs ?? typographyScales[fScale]),
fontFamily: ff ?? '',
textAlign: tas ? 'center' : 'auto',
...(fw ? {
fontWeight: fw
} : {}),
color: color ?? (themeColor && colors.brand.primary || getVariantColor())
}, style],
...rest,
children: children
});
};
export default StyledText;
//# sourceMappingURL=StyledText.js.map