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

functions.web.js 971B

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