Ejemplo n.º 1
0
static ParagraphAttributes convertRawProp(
    const RawProps &rawProps,
    const ParagraphAttributes &defaultParagraphAttributes) {
  auto paragraphAttributes = ParagraphAttributes{};

  paragraphAttributes.maximumNumberOfLines = convertRawProp(
      rawProps,
      "numberOfLines",
      defaultParagraphAttributes.maximumNumberOfLines);
  paragraphAttributes.ellipsizeMode = convertRawProp(
      rawProps, "ellipsizeMode", defaultParagraphAttributes.ellipsizeMode);
  paragraphAttributes.adjustsFontSizeToFit = convertRawProp(
      rawProps,
      "adjustsFontSizeToFit",
      defaultParagraphAttributes.adjustsFontSizeToFit);
  paragraphAttributes.minimumFontSize = convertRawProp(
      rawProps,
      "minimumFontSize",
      defaultParagraphAttributes.minimumFontSize,
      std::numeric_limits<Float>::quiet_NaN());
  paragraphAttributes.maximumFontSize = convertRawProp(
      rawProps,
      "maximumFontSize",
      defaultParagraphAttributes.maximumFontSize,
      std::numeric_limits<Float>::quiet_NaN());

  return paragraphAttributes;
}
Ejemplo n.º 2
0
ParagraphProps::ParagraphProps(
    const ParagraphProps &sourceProps,
    const RawProps &rawProps)
    : ViewProps(sourceProps, rawProps),
      BaseTextProps(sourceProps, rawProps),
      paragraphAttributes(
          convertRawProp(rawProps, sourceProps.paragraphAttributes)),
      isSelectable(
          convertRawProp(rawProps, "selectable", sourceProps.isSelectable)){};
Ejemplo n.º 3
0
SwitchProps::SwitchProps(
    const SwitchProps &sourceProps,
    const RawProps &rawProps)
    : ViewProps(sourceProps, rawProps),
      value(convertRawProp(rawProps, "value", sourceProps.value, value)),
      disabled(
          convertRawProp(rawProps, "disabled", sourceProps.disabled, disabled)),
      tintColor(convertRawProp(
          rawProps,
          "tintColor",
          sourceProps.tintColor,
          tintColor)),
      onTintColor(convertRawProp(
          rawProps,
          "onTintColor",
          sourceProps.onTintColor,
          onTintColor)),
      thumbTintColor(convertRawProp(
          rawProps,
          "thumbTintColor",
          sourceProps.thumbTintColor,
          thumbTintColor)) {}
Ejemplo n.º 4
0
BaseTextProps::BaseTextProps(const BaseTextProps &sourceProps, const RawProps &rawProps):
  textAttributes(convertRawProp(rawProps, sourceProps.textAttributes)) {};
Ejemplo n.º 5
0
static TextAttributes convertRawProp(const RawProps &rawProps, const TextAttributes defaultTextAttributes) {
  auto textAttributes = TextAttributes {};

  // Color
  textAttributes.foregroundColor = convertRawProp(rawProps, "color", defaultTextAttributes.foregroundColor);
  textAttributes.backgroundColor = convertRawProp(rawProps, "backgroundColor", defaultTextAttributes.backgroundColor);
  textAttributes.opacity = convertRawProp(rawProps, "opacity", defaultTextAttributes.opacity);

  // Font
  textAttributes.fontFamily = convertRawProp(rawProps, "fontFamily", defaultTextAttributes.fontFamily);
  textAttributes.fontSize = convertRawProp(rawProps, "fontSize", defaultTextAttributes.fontSize);
  textAttributes.fontSizeMultiplier = convertRawProp(rawProps, "fontSizeMultiplier", defaultTextAttributes.fontSizeMultiplier);
  textAttributes.fontWeight = convertRawProp(rawProps, "fontWeight", defaultTextAttributes.fontWeight);
  textAttributes.fontStyle = convertRawProp(rawProps, "fontStyle", defaultTextAttributes.fontStyle);
  textAttributes.fontVariant = convertRawProp(rawProps, "fontVariant", defaultTextAttributes.fontVariant);
  textAttributes.allowFontScaling = convertRawProp(rawProps, "allowFontScaling", defaultTextAttributes.allowFontScaling);
  textAttributes.letterSpacing = convertRawProp(rawProps, "letterSpacing", defaultTextAttributes.letterSpacing);

  // Paragraph
  textAttributes.lineHeight = convertRawProp(rawProps, "lineHeight", defaultTextAttributes.lineHeight);
  textAttributes.alignment = convertRawProp(rawProps, "alignment", defaultTextAttributes.alignment);
  textAttributes.baseWritingDirection = convertRawProp(rawProps, "baseWritingDirection", defaultTextAttributes.baseWritingDirection);

  // Decoration
  textAttributes.textDecorationColor = convertRawProp(rawProps, "textDecorationColor", defaultTextAttributes.textDecorationColor);
  textAttributes.textDecorationLineType = convertRawProp(rawProps, "textDecorationLineType", defaultTextAttributes.textDecorationLineType);
  textAttributes.textDecorationLineStyle = convertRawProp(rawProps, "textDecorationLineStyle", defaultTextAttributes.textDecorationLineStyle);
  textAttributes.textDecorationLinePattern = convertRawProp(rawProps, "textDecorationLinePattern", defaultTextAttributes.textDecorationLinePattern);

  // Shadow
  textAttributes.textShadowOffset = convertRawProp(rawProps, "textShadowOffset", defaultTextAttributes.textShadowOffset);
  textAttributes.textShadowRadius = convertRawProp(rawProps, "textShadowRadius", defaultTextAttributes.textShadowRadius);
  textAttributes.textShadowColor = convertRawProp(rawProps, "textShadowColor", defaultTextAttributes.textShadowColor);

  // Special
  textAttributes.isHighlighted = convertRawProp(rawProps, "isHighlighted", defaultTextAttributes.isHighlighted);

  return textAttributes;
}
Ejemplo n.º 6
0
YogaStylableProps::YogaStylableProps(const YogaStylableProps &sourceProps, const RawProps &rawProps):
  yogaStyle(convertRawProp(rawProps, sourceProps.yogaStyle)) {};
Ejemplo n.º 7
0
RawTextProps::RawTextProps(
    const RawTextProps &sourceProps,
    const RawProps &rawProps)
    : Props(sourceProps, rawProps),
      text(convertRawProp(rawProps, "text", sourceProps.text)){};
ActivityIndicatorViewProps::ActivityIndicatorViewProps(const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps):
  ViewProps(sourceProps, rawProps),
  animating(convertRawProp(rawProps, "animating", sourceProps.animating)),
  color(convertRawProp(rawProps, "color", sourceProps.color)),
  hidesWhenStopped(convertRawProp(rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped)),
  size(convertRawProp(rawProps, "size", sourceProps.size)) {}
Ejemplo n.º 9
0
ViewProps::ViewProps(const ViewProps &sourceProps, const RawProps &rawProps):
  Props(sourceProps, rawProps),
  YogaStylableProps(sourceProps, rawProps),
  opacity(convertRawProp(rawProps, "opacity", sourceProps.opacity)),
  foregroundColor(convertRawProp(rawProps, "foregroundColor", sourceProps.foregroundColor)),
  backgroundColor(convertRawProp(rawProps, "backgroundColor", sourceProps.backgroundColor)),
  borderWidth(convertRawProp(rawProps, "borderWidth", sourceProps.borderWidth)),
  borderRadius(convertRawProp(rawProps, "borderRadius", sourceProps.borderRadius)),
  borderColor(convertRawProp(rawProps, "borderColor", sourceProps.borderColor)),
  borderStyle(convertRawProp(rawProps, "borderStyle", sourceProps.borderStyle)),
  shadowColor(convertRawProp(rawProps, "shadowColor", sourceProps.shadowColor)),
  shadowOffset(convertRawProp(rawProps, "shadowOffset", sourceProps.shadowOffset)),
  shadowOpacity(convertRawProp(rawProps, "shadowOpacity", sourceProps.shadowOpacity)),
  shadowRadius(convertRawProp(rawProps, "shadowRadius", sourceProps.shadowRadius)),
  transform(convertRawProp(rawProps, "transform", sourceProps.transform)),
  backfaceVisibility(convertRawProp(rawProps, "backfaceVisibility", sourceProps.backfaceVisibility)),
  shouldRasterize(convertRawProp(rawProps, "shouldRasterize", sourceProps.shouldRasterize)),
  zIndex(convertRawProp(rawProps, "zIndex", sourceProps.zIndex)),
  pointerEvents(convertRawProp(rawProps, "pointerEvents", sourceProps.pointerEvents)),
  hitSlop(convertRawProp(rawProps, "hitSlop", sourceProps.hitSlop)) {};