From 5cbdd62b3aaac37adc4f6f8c9dbbc97f55faed93 Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Wed, 19 Jul 2023 07:04:18 -0700 Subject: [PATCH] Populate Platform.isDisableAnimations for the Android mobile platform (#38511) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38511 ## Changelog [Internal] - This allows to override `Platform.isDisableAnimations` for the Android platform, in the same way as it's done with `IS_TESTING` (but similarly optionally doing `IS_DISABLE_ANIMATIONS` in addition to/instead). See for more context: https://github.com/facebook/react-native/pull/38490 Reviewed By: cortinico Differential Revision: D47530731 fbshipit-source-id: b90300124b2a8bac97fae78a94e8a2cc9d7fd5bc --- .../facebook/react/modules/systeminfo/AndroidInfoModule.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java index 8a3fe903b5a0d2..3c283271487eda 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java @@ -28,6 +28,7 @@ @SuppressLint("HardwareIds") public class AndroidInfoModule extends NativePlatformConstantsAndroidSpec implements TurboModule { private static final String IS_TESTING = "IS_TESTING"; + private static final String IS_DISABLE_ANIMATIONS = "IS_DISABLE_ANIMATIONS"; public AndroidInfoModule(ReactApplicationContext reactContext) { super(reactContext); @@ -75,6 +76,10 @@ private String uiMode() { } constants.put( "isTesting", "true".equals(System.getProperty(IS_TESTING)) || isRunningScreenshotTest()); + String isDisableAnimations = System.getProperty(IS_DISABLE_ANIMATIONS); + if (isDisableAnimations != null) { + constants.put("isDisableAnimations", "true".equals(isDisableAnimations)); + } constants.put("reactNativeVersion", ReactNativeVersion.VERSION); constants.put("uiMode", uiMode()); return constants;