How to use the css-to-react-native.getPropertyName function in css-to-react-native

To help you get started, we’ve selected a few css-to-react-native 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 jacobp100 / cssta / runtime / flattenTransition.ts View on Github external
shorthandParts.forEach(part => {
    if (!(set & TIMING_FUNCTION) && easingRegExp.test(part)) {
      accum.timingFunction = part as any;
      set &= TIMING_FUNCTION;
    } else if (!(set & DURATION) && durationRegExp.test(part)) {
      accum.duration = getDurationInMs(part);
      set &= DURATION;
    } else if (!(set & DELAY) && durationRegExp.test(part)) {
      accum.delay = getDurationInMs(part);
      set &= DELAY;
    } else if (!(set & PROPERTY)) {
      accum.property = getPropertyName(part);
      set &= PROPERTY;
    } else {
      throw new Error("Failed to parse shorthand");
    }
  });
github jacobp100 / cssta / compiler / babel / styleSheet / styleBody.ts View on Github external
const getInterpolationType = (
  substitutionMap: SubstitutionMap,
  [prop, value]: StyleTuple
) => {
  if (!containsSubstitution(substitutionMap, value)) {
    return InterpolationType.NoOrSimple;
  } else if (getPropertyName(prop) in unitTypes && !calcRe.test(value)) {
    return InterpolationType.NoOrSimple;
  }
  return InterpolationType.Template;
};
github jacobp100 / cssta / compiler / babel / styleSheet / viewport.ts View on Github external
([prop, value]): ViewportMode => {
        if (!viewportUnitRegExp.test(value)) {
          return ViewportMode.None;
        } else if (
          unitTypes[getPropertyName(prop)] === UnitType.Length &&
          !calcRe.test(value)
        ) {
          return ViewportMode.SimpleLengthUnits;
        } else {
          return ViewportMode.ComplexUnits;
        }
      }
    )
github jacobp100 / cssta / packages / babel-plugin-cssta / src / platforms / native.js View on Github external
const getInterpolationType = (substitutionMap, [prop, value]) => {
  if (!containsSubstitution(substitutionMap, value)) {
    return SIMPLE_OR_NO_INTERPOLATION;
  } else if (getPropertyName(prop) in simpleInterpolation) {
    return SIMPLE_OR_NO_INTERPOLATION;
  }
  return TEMPLATE_INTERPOLATION;
};
github jacobp100 / cssta / babel-plugin / platforms / native / createStyleSheet.js View on Github external
([prop, value]) =>
        babel.types.arrayExpression([
          babel.types.stringLiteral(getPropertyName(prop)),
          getStringWithSubstitutedValues(babel, substitutionMap, value)
        ]),
      styleTuples
github jacobp100 / cssta / compiler / babel / styleSheet / styleBody.ts View on Github external
styleTuplesGroup.forEach(([prop, value]) => {
    const propertyName = getPropertyName(prop);
    const substitutionMatches = substitutionRegExp
      ? value.match(substitutionRegExp)
      : null;

    if (substitutionMatches == null) {
      const styles = transformStyleTuples([[propertyName, value]]);

      Object.entries(styles).forEach(([key, value]) => {
        styleMap[key] = jsonToNode(babel, value);
      });
    } else if (substitutionMatches.length === 1) {
      const substitution =
        substitutionMatches[0] === value.trim()
          ? t.cloneDeep(substitutionMap[value])
          : getStringWithSubstitutedValues(babel, substitutionMap, value);
github jacobp100 / cssta / packages / babel-plugin-cssta / src / platforms / native.js View on Github external
const bodyPairs = t.arrayExpression(_.map(([prop, value]) => t.arrayExpression([
        t.stringLiteral(getPropertyName(prop)),
        getStringWithSubstitutedValues(substitutionMap, value),
      ]), styleTuplesGroup));
github jacobp100 / cssta / packages / babel-plugin-cssta / src / platforms / native / createStyleSheetVariables.js View on Github external
) => t.arrayExpression(_.map(([prop, value]) => (
  t.arrayExpression([
    t.stringLiteral(getPropertyName(prop)),
    getStringWithSubstitutedValues(substitutionMap, value),
  ])
), styleTuples));
github jacobp100 / cssta / packages / babel-plugin-cssta / src / platforms / native.js View on Github external
const styleMap = _.reduce((accum, [prop, value]) => {
        const propertyName = getPropertyName(prop);
        const substitutionMatches = substitutionRegExp
          ? value.match(substitutionRegExp)
          : null;

        if (!substitutionMatches) {
          const styles = transformStyleTuples([[propertyName, value]]);
          const styleToValue = _.mapValues(jsonToNode, styles);
          return _.assign(accum, styleToValue);
        } else if (substitutionMatches.length === 1) {
          const substitutionNode = substitutionMatches[0] === value.trim()
            ? substitutionMap[value]
            : getStringWithSubstitutedValues(substitutionMap, value);

          return _.set(
            propertyName,
            simpleInterpolation[propertyName](path, substitutionNode),

css-to-react-native

Convert CSS text to a React Native stylesheet object

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis