您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

functions.web.ts 949B

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