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.

shimStyles.web.js 885B

1234567891011121314151617181920212223
  1. /**
  2. * Shim style properties to work correctly on Web.
  3. *
  4. * Some generic properties used by react-native for styling require additional
  5. * style fields to be included in order to work on Web. For example, setting the
  6. * `flex` property to control the flexbox layout also requires setting the
  7. * `display` property to `flexbox` for the `flex` style to take effect.
  8. *
  9. * Using this shimStyles method allows us to minimize the number of style
  10. * declarations that need to be set or overridden for specific platforms.
  11. *
  12. * @param {Object} styles - A dictionary of named style definitions.
  13. * @returns {Object}
  14. */
  15. export function shimStyles(styles) {
  16. // The flexbox layout must be explicitly chosen on Web by assigning flex to
  17. // display. This way the React Native styles can be reused on Web.
  18. if (styles.flex) {
  19. styles.display = 'flex';
  20. }
  21. return styles;
  22. }