UNPKG

icomoon-helper

Version:
25 lines (24 loc) 1.27 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderIcon = void 0; const react_1 = __importDefault(require("react")); const react_native_1 = require("react-native"); const renderIcon = (props) => { return (react_1.default.createElement(react_native_1.View, null, props.symbols.map((symbol, index) => (react_1.default.createElement(react_native_1.Text, { key: symbol.value, style: getStyles(symbol, props, index) }, symbol.value))))); }; exports.renderIcon = renderIcon; const getStyles = (symbol, { size, color, opacity, fontFamily }, index) => { const propsColor = typeof color === 'object' ? color === null || color === void 0 ? void 0 : color[index] : color; const propsOpacity = typeof opacity === 'object' ? opacity === null || opacity === void 0 ? void 0 : opacity[index] : opacity; return { fontSize: size || symbol.size, lineHeight: size || symbol.size, fontFamily, color: propsColor || symbol.color, opacity: propsOpacity || symbol.opacity, position: index === 0 ? 'relative' : 'absolute', }; };