Add artificial crash button to sample app

Summary: Lets you test the crash reporter more easily

Reviewed By: passy

Differential Revision: D18830402

fbshipit-source-id: fca57a05f121ca4219aaaf4e2b8bfeca9b46a4a9
This commit is contained in:
John Knox
2019-12-05 06:44:09 -08:00
committed by Facebook Github Bot
parent 006003ae6b
commit d73551a440

View File

@@ -76,6 +76,13 @@ public class RootComponentSpec {
.marginDip(YogaEdge.ALL, 10)
.textSizeSp(20)
.clickHandler(RootComponent.openAlternateActivityOne(c)))
.child(
Text.create(c)
.text("Crash this app")
.key("7")
.marginDip(YogaEdge.ALL, 10)
.textSizeSp(20)
.clickHandler(RootComponent.triggerCrash(c)))
.child(
displayImage
? FrescoImage.create(c)
@@ -114,6 +121,11 @@ public class RootComponentSpec {
c.getAndroidContext().startActivity(intent);
}
@OnEvent(ClickEvent.class)
static void triggerCrash(final ComponentContext c) {
throw new RuntimeException("Artificially triggered crash from Flipper sample app");
}
@OnUpdateState
static void updateDisplayImage(StateValue<Boolean> displayImage) {
displayImage.set(true);