UNPKG

@kietpt2003/react-native-core-ui

Version:
51 lines (50 loc) 1.79 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx } from "react/jsx-runtime"; import { StyleSheet, Text as RNText, } from 'react-native'; import { colors, fontSize } from '../themes'; /** * Text component for displaying text with custom styles and loading state. * This component also have its own view and can easily be customized. */ const Text = (_a) => { var { bold = false, color = colors.black, italic = false, light = false, medium = false, semiBold = false, size = fontSize._16, style = {}, thin = false } = _a, rest = __rest(_a, ["bold", "color", "italic", "light", "medium", "semiBold", "size", "style", "thin"]); let textStyle = { color, fontSize: size, fontStyle: italic ? 'italic' : 'normal', fontWeight: '400' }; if (bold) { textStyle.fontWeight = '700'; } if (semiBold) { textStyle.fontWeight = '600'; } if (medium) { textStyle.fontWeight = '500'; } if (light) { textStyle.fontWeight = '300'; } if (thin) { textStyle.fontWeight = '100'; } return _jsx(RNText, Object.assign({}, rest, { style: [styles.textDefault, textStyle, style] })); }; const styles = StyleSheet.create({ textDefault: { color: colors.black, }, }); Text.displayName = 'Text'; export default Text;