From d73551a4406ac6118bff90c8a12d5e3406e7a06b Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 5 Dec 2019 06:44:09 -0800 Subject: [PATCH] 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 --- .../facebook/flipper/sample/RootComponentSpec.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java b/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java index 417d7cf6a..653f0a0eb 100644 --- a/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java +++ b/android/sample/src/main/java/com/facebook/flipper/sample/RootComponentSpec.java @@ -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 displayImage) { displayImage.set(true);