1 import { StyleType } from './functions.any'; 2 3 export * from './functions.any'; 4 5 /** 6 * Fixes the style prop that is passed to a platform generic component based on platform specific 7 * format requirements. 8 * 9 * @param {StyleType} style - The passed style prop to the component. 10 * @returns {StyleType} 11 */ 12 export function getFixedPlatformStyle(style?: StyleType | StyleType[]) { 13 if (Array.isArray(style)) { 14 const _style = {}; 15 16 for (const component of style) { 17 Object.assign(_style, component); 18 } 19 20 return _style; 21 } 22 23 return style; 24 } 25 26 /** 27 * Sets the line height of a CSS Object group in pixels. 28 * By default lineHeight is unitless in CSS, but not in RN. 29 * 30 * @param {Object} base - The base object containing the `lineHeight` property. 31 * @returns {Object} 32 */ 33 export function withPixelLineHeight(base: any) { 34 return { 35 ...base, 36 lineHeight: `${base.lineHeight}px` 37 }; 38 }