How to use the react-with-direction/dist/constants.DIRECTIONS.LTR 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 / deprecated / withStyles.jsx View on Github external
function getStyleDef(direction, wrappedComponentName) {
    const currentTheme = getCurrentTheme(direction);
    let styleDef = direction === DIRECTIONS.LTR
      ? styleDefLTR
      : styleDefRTL;

    const registeredTheme = ThemedStyleSheet.get();

    // Return the existing styles if they've already been defined
    // and if the theme used to create them corresponds to the theme
    // registered with ThemedStyleSheet
    if (styleDef && currentTheme === registeredTheme) {
      return styleDef;
    }

    if (
      process.env.NODE_ENV !== 'production'
      && typeof performance !== 'undefined'
      && performance.mark !== undefined && typeof performance.clearMarks === 'function'
github airbnb / react-with-styles / src / deprecated / withStyles.jsx View on Github external
function getCurrentTheme(direction) {
    return direction === DIRECTIONS.LTR
      ? currentThemeLTR
      : currentThemeRTL;
  }
github airbnb / react-with-styles / src / deprecated / withStyles.jsx View on Github external
function getResolveMethod(direction) {
    return direction === DIRECTIONS.LTR
      ? ThemedStyleSheet.resolveLTR
      : ThemedStyleSheet.resolveRTL;
  }
github airbnb / react-with-styles / src / deprecated / withStyles.jsx View on Github external
if (pureComponent) {
    if (!React.PureComponent) {
      throw new ReferenceError('withStyles() pureComponent option requires React 15.3.0 or later');
    }

    return React.PureComponent;
  }

  return React.Component;
}

const contextTypes = {
  [CHANNEL]: brcastShape,
};

const defaultDirection = DIRECTIONS.LTR;

export function withStyles(
  styleFn,
  {
    stylesPropName = 'styles',
    themePropName = 'theme',
    cssPropName = 'css',
    flushBefore = false,
    pureComponent = false,
  } = {},
) {
  let styleDefLTR;
  let styleDefRTL;
  let currentThemeLTR;
  let currentThemeRTL;
  const BaseClass = baseClass(pureComponent);

react-with-direction

Components to provide and consume RTL or LTR direction in React

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages