UNPKG

react-native-alertbox

Version:
34 lines (30 loc) 779 B
import React from 'react'; import {StyleSheet, Text as RNText} from 'react-native'; import {TYPOGRAPHY, VARIABLES} from '../../constants/index'; export default function Text({color, size, weight, children, style, ...props}) { const styles = stylesRef({color, size, weight}); return ( <RNText style={[styles.textColor, styles.textSize, styles.textWeight, style]} {...props}> {children} </RNText> ); } Text.defaultProps = { color: 'LABEL', size: 'normal', weight: 'regular', }; const stylesRef = ({color, size, weight}) => StyleSheet.create({ textColor: { color: VARIABLES[color], }, textSize: { fontSize: TYPOGRAPHY.SIZES[size], }, textWeight: { fontWeight: TYPOGRAPHY.WEIGHTS[weight], }, });