Java 类com.facebook.yoga.YogaPositionType 实例源码

项目:litho-glide    文件:TitleComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @Prop(resType = STRING) String title) {
  return Text.create(c)
      .text(title)
      .textStyle(BOLD)
      .textSizeDip(24)
      .withLayout().flexShrink(0)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.BOTTOM, 4)
      .positionDip(YogaEdge.LEFT, 4)
      .paddingDip(YogaEdge.HORIZONTAL, 6)
      .build();
}
项目:litho-picasso    文件:TitleComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c,
    @Prop(resType = STRING) String title) {
  return Text.create(c)
      .text(title)
      .textStyle(BOLD)
      .textSizeDip(24)
      .withLayout().flexShrink(0)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.BOTTOM, 4)
      .positionDip(YogaEdge.LEFT, 4)
      .paddingDip(YogaEdge.HORIZONTAL, 6)
      .build();
}
项目:RNLearn_Project1    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.POSITION)
public void setPosition(@Nullable String position) {
  if (isVirtual()) {
    return;
  }

  if (position == null) {
    setPositionType(YogaPositionType.RELATIVE);
    return;
  }

  switch (position) {
    case "relative": {
      setPositionType(YogaPositionType.RELATIVE);
      break;
    }
    case "absolute": {
      setPositionType(YogaPositionType.ABSOLUTE);
      break;
    }
    default: {
      throw new JSApplicationIllegalArgumentException(
          "invalid value for position: " + position);
    }
  }
}
项目:RNLearn_Project1    文件:LayoutShadowNode.java   
@ReactProp(name = ViewProps.POSITION)
public void setPosition(@Nullable String position) {
  if (isVirtual()) {
    return;
  }

  if (position == null) {
    setPositionType(YogaPositionType.RELATIVE);
    return;
  }

  switch (position) {
    case "relative": {
      setPositionType(YogaPositionType.RELATIVE);
      break;
    }
    case "absolute": {
      setPositionType(YogaPositionType.ABSOLUTE);
      break;
    }
    default: {
      throw new JSApplicationIllegalArgumentException(
          "invalid value for position: " + position);
    }
  }
}
项目:litho-glide    文件:ActionsComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c) {
  return Row.create(c)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.RIGHT, 4)
      .positionDip(YogaEdge.TOP, 4)
      .paddingDip(YogaEdge.ALL, 2)
      .child(FavouriteButton.create(c))
      .build();
}
项目:litho-picasso    文件:ActionsComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(
    ComponentContext c) {
  return Row.create(c)
      .backgroundColor(0xDDFFFFFF)
      .positionType(YogaPositionType.ABSOLUTE)
      .positionDip(YogaEdge.RIGHT, 4)
      .positionDip(YogaEdge.TOP, 4)
      .paddingDip(YogaEdge.ALL, 2)
      .child(FavouriteButton.create(c))
      .build();
}
项目:RNLearn_Project1    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testPosition() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = spy(buildStyles(
      "position",
      "absolute",
      "bottom",
      10.0,
      "right",
      5.0));

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setPosition(eq(Spacing.BOTTOM), anyFloat());
  verify(reactShadowNode).setPosition(eq(Spacing.END), anyFloat());
  verify(reactShadowNode).setPositionType(any(YogaPositionType.class));
  verify(map).getFloat("bottom", Float.NaN);
  verify(map).getFloat("right", Float.NaN);

  reactShadowNode = spy(new LayoutShadowNode());
  map = spy(buildStyles());

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode, never()).setPosition(eq(Spacing.BOTTOM), anyFloat());
  verify(reactShadowNode, never()).setPosition(eq(Spacing.END), anyFloat());
  verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
  verify(map, never()).getFloat("bottom", Float.NaN);
  verify(map, never()).getFloat("right", Float.NaN);
}
项目:RNLearn_Project1    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection",
      "column",
      "alignSelf",
      "stretch",
      "alignItems",
      "center",
      "justifyContent",
      "space_between",
      "position",
      "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(YogaFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(YogaAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(YogaAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(YogaJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(YogaPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(YogaFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(YogaAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(YogaAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(YogaJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
}
项目:RNLearn_Project1    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testPosition() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = spy(buildStyles(
      "position",
      "absolute",
      "bottom",
      10.0,
      "right",
      5.0));

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setPosition(eq(Spacing.BOTTOM), anyFloat());
  verify(reactShadowNode).setPosition(eq(Spacing.END), anyFloat());
  verify(reactShadowNode).setPositionType(any(YogaPositionType.class));
  verify(map).getFloat("bottom", Float.NaN);
  verify(map).getFloat("right", Float.NaN);

  reactShadowNode = spy(new LayoutShadowNode());
  map = spy(buildStyles());

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode, never()).setPosition(eq(Spacing.BOTTOM), anyFloat());
  verify(reactShadowNode, never()).setPosition(eq(Spacing.END), anyFloat());
  verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
  verify(map, never()).getFloat("bottom", Float.NaN);
  verify(map, never()).getFloat("right", Float.NaN);
}
项目:RNLearn_Project1    文件:LayoutPropertyApplicatorTest.java   
@Test
public void testEnumerations() {
  LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
  ReactStylesDiffMap map = buildStyles(
      "flexDirection",
      "column",
      "alignSelf",
      "stretch",
      "alignItems",
      "center",
      "justifyContent",
      "space_between",
      "position",
      "relative");

  reactShadowNode.updateProperties(map);
  verify(reactShadowNode).setFlexDirection(YogaFlexDirection.COLUMN);
  verify(reactShadowNode).setAlignSelf(YogaAlign.STRETCH);
  verify(reactShadowNode).setAlignItems(YogaAlign.CENTER);
  verify(reactShadowNode).setJustifyContent(YogaJustify.SPACE_BETWEEN);
  verify(reactShadowNode).setPositionType(YogaPositionType.RELATIVE);

  reactShadowNode = spy(new LayoutShadowNode());
  map = buildStyles();
  reactShadowNode.updateProperties(map);

  verify(reactShadowNode, never()).setFlexDirection(any(YogaFlexDirection.class));
  verify(reactShadowNode, never()).setAlignSelf(any(YogaAlign.class));
  verify(reactShadowNode, never()).setAlignItems(any(YogaAlign.class));
  verify(reactShadowNode, never()).setJustifyContent(any(YogaJustify.class));
  verify(reactShadowNode, never()).setPositionType(any(YogaPositionType.class));
}
项目:RNLearn_Project1    文件:ReactShadowNode.java   
public void setPositionType(YogaPositionType positionType) {
  mYogaNode.setPositionType(positionType);
}
项目:RNLearn_Project1    文件:ReactShadowNode.java   
public void setPositionType(YogaPositionType positionType) {
  mYogaNode.setPositionType(positionType);
}