How to use the react-with-direction function in react-with-direction

To help you get started, we’ve selected a few react-with-direction examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbnb / react-with-styles / src / contextual / withStyles.jsx View on Github external
return (
        <WrappedComponent
          {...props}
          {...{
            [themePropName]: theme,
            [stylesPropName]: styles,
            [cssPropName]: css,
          }}
        />
      );
    }

    // Listen to directional updates via props
    // eslint-disable-next-line no-func-assign
    WithStyles = withDirection(WithStyles);

    // Make into a pure functional component if requested
    // eslint-disable-next-line no-func-assign
    WithStyles = pureComponent ? memo(WithStyles) : WithStyles;

    // Set React statics on WithStyles
    WithStyles.WrappedComponent = WrappedComponent;
    WithStyles.displayName = `withStyles(${wrappedComponentName})`;
    if (WrappedComponent.propTypes) {
      WithStyles.propTypes = { ...WrappedComponent.propTypes };
      delete WithStyles.propTypes[stylesPropName];
      delete WithStyles.propTypes[themePropName];
      delete WithStyles.propTypes[cssPropName];
    }
    if (WrappedComponent.defaultProps) {
      WithStyles.defaultProps = { ...WrappedComponent.defaultProps };

react-with-direction

Components to provide and consume RTL or LTR direction in React

MIT
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis