You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.web.ts 981B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // @ts-ignore
  2. import { StyleType } from './functions.any';
  3. // @ts-ignore
  4. export * from './functions.any';
  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. for (const component of style) {
  16. Object.assign(_style, component);
  17. }
  18. return _style;
  19. }
  20. return style;
  21. }
  22. /**
  23. * Sets the line height of a CSS Object group in pixels.
  24. * By default lineHeight is unitless in CSS, but not in RN.
  25. *
  26. * @param {Object} base - The base object containing the `lineHeight` property.
  27. * @returns {Object}
  28. */
  29. export function withPixelLineHeight(base: any): Object {
  30. return {
  31. ...base,
  32. lineHeight: `${base.lineHeight}px`
  33. };
  34. }