From 925330bb83a9f9c3ca104ad4e8cf07c88216bdab Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Mon, 13 Jan 2020 23:18:03 -0800 Subject: [PATCH] Fix animations in OSS debug builds by modifying `Platform.isTesting()` behaviour Summary: In D14244606 I "fixed" `Platform.isTesting()` in JS. By fixed, I made it return true when running SSTs. People in OSS complained about this in discord and [github](https://github.com/facebook/react-native/issues/27010). The problem is that this call returns true whenever an RN project references Detox in the build.gradle file. In practice, this has been really annoying, because it has disabled animations in debug builds, due to D13811035. The fix is to be more specific, and look for the exact screenshot test activity. I haven't explicitly verified this doesn't trigger from Detox, but it shouldn't. I'll coordinate on the github issue to verify. Changelog: [Android][Fixed] Fix animations in OSS debug builds by modifying `Platform.isTesting()` behaviour Reviewed By: TheSavior Differential Revision: D19384098 fbshipit-source-id: 22c885219f2c00f5dcc3b930b068bfd2ad7e4b8e --- .../facebook/react/modules/systeminfo/AndroidInfoModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java index 3eb747a869f..a0e7febc12f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java @@ -93,7 +93,7 @@ public class AndroidInfoModule extends ReactContextBaseJavaModule implements Tur private Boolean isRunningScreenshotTest() { try { - Class.forName("android.support.test.rule.ActivityTestRule"); + Class.forName("com.facebook.testing.react.screenshots.ReactAppScreenshotTestActivity"); return true; } catch (ClassNotFoundException ignored) { return false;