react-native-simi-comps
Version:
Simple Minimal Components for React Native
28 lines • 1.83 kB
JavaScript
import React from "react";
import { Text as DefaultText } from "react-native";
import useThemeColor from "../useThemeColor";
export default function Text(_a) {
var _b = _a.text, text = _b === void 0 ? undefined : _b, _c = _a.size, size = _c === void 0 ? 16 : _c, _d = _a.bold, bold = _d === void 0 ? false : _d, _e = _a.centered, centered = _e === void 0 ? false : _e, _f = _a.italic, italic = _f === void 0 ? false : _f, _g = _a.spaced, spaced = _g === void 0 ? false : _g, style = _a.style, color = _a.color, margin = _a.margin, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, marginTop = _a.marginTop, marginRight = _a.marginRight, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, _h = _a.numberOfLines, numberOfLines = _h === void 0 ? undefined : _h, _j = _a.selectable, selectable = _j === void 0 ? true : _j, _k = _a.children, children = _k === void 0 ? undefined : _k;
var textColor = useThemeColor("text");
if (!text && !children)
return null;
return (React.createElement(DefaultText, { style: [
{
color: color || textColor,
fontSize: size,
fontWeight: bold ? "bold" : "normal",
textAlign: centered ? "center" : "left",
fontStyle: italic ? "italic" : "normal",
letterSpacing: spaced ? 0.25 : undefined,
margin: margin,
marginHorizontal: marginHorizontal,
marginVertical: marginVertical,
marginTop: marginTop,
marginRight: marginRight,
marginBottom: marginBottom,
marginLeft: marginLeft
},
style,
], numberOfLines: numberOfLines, selectable: selectable }, text || children));
}
//# sourceMappingURL=Text.js.map