@OnCreateLayout static @Nullable Component onCreateLayout(ComponentContext c) { return null; } }
@OnCreateLayout public static Component onCreateLayout(ComponentContext c) { throw new RuntimeException("onCreateLayout crash"); } }
@OnCreateLayout public Component onCreateLayout(ComponentContext c, @Prop String s) { return null; } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Text.create(c, 0, R.style.hello_world).textRes(R.string.hello_world).build(); } }
@OnCreateLayout public final Component onCreateLayout( ComponentContext c, @Prop(varArg = "number") java.util.List<? extends java.lang.Number> numbers) { return null; } }
@OnCreateLayout public final Component onCreateLayout( ComponentContext c, @Prop(varArg = "number") java.util.List<? extends java.lang.Number> numbers) { return null; } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop(resType = STRING) String subtitle) { if (Math.random() >= 0.7) { throw new RuntimeException("Oh no, a random error!"); } return Text.create(c).text(subtitle).textSizeDip(18).build(); } }
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop Component child, @State Optional<String> error) { if (error.isPresent()) { return Text.create(c) .marginDip(YogaEdge.ALL, 8) .textSizeSp(24) .text(String.format("A WILD ERROR APPEARS:\n%s", error.get())) .build(); } return child; }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Text.create(c).text("Hello, World!").textSizeDip(50).build(); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return RecyclerCollectionComponent.create(c) .section(StoryCardsWithHeaderSection.create(new SectionContext(c)).build()) .build(); } }
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop TreePropTestResult resultPropALeaf1, @Prop TreePropTestResult resultPropBLeaf1) { return TreePropTestLeaf.create(c) .resultPropA(resultPropALeaf1) .resultPropB(resultPropBLeaf1) .build(); } }
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop String text, @Prop EventHandler<ClickEvent> clickEventHandler) { return Text.create(c) .text(text) .textSizeSp(25) .clickHandler(clickEventHandler) .build(); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Column.create(c) .backgroundColor(Color.WHITE) .child( Text.create(c) .textSizeSp(20) .text("Playground sample")) .build(); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop(resType = STRING) String title) { return Text.create(c) .text(title) .textStyle(BOLD) .textSizeDip(24) .positionDip(YogaEdge.BOTTOM, 16) .build(); } }
@OnCreateLayout public void testMethod( @Prop boolean testProp, @State int testState, @Event Object testPermittedAnnotation) { // Don't do anything. }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @State boolean favourited) { return Row.create(c) .backgroundRes(favourited ? star_on : star_off) .widthDip(32) .heightDip(32) .clickHandler(FavouriteButton.onClick(c)) .build(); }
@OnCreateLayout static Component 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(); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @State boolean state) { final int color = state ? Color.RED : Color.LTGRAY; final String key = state ? "red" : "gray"; return Column.create(c) .child(buildRow(c, color, key + 0)) .child(buildRow(c, color, key + 1)) .paddingDip(YogaEdge.ALL, 8) .clickHandler(RTAnimationComponent.onClick(c)) .build(); }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop final Artist artist) { return Column.create(c) .paddingDip(VERTICAL, 8) .paddingDip(HORIZONTAL, 16) .child(Card.create(c).content(FeedItemComponent.create(c).artist(artist))) .build(); } }
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Column.create(c) .child(Text.create(c).text("Hello, World!").textSizeDip(50)) .child( Text.create(c) .text("Hello, world 2!") .textColorRes(android.R.color.holo_green_dark) .textSizeSp(30)) .build(); } }