From 2b427f86928b1229089c356a84d668b68cda5733 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Fri, 13 Aug 2021 13:52:11 -0700 Subject: [PATCH] Add a flag to warn whenever the legacy NativeModule system is used Summary: When true, this flag will cause React Native to start logging soft exceptions, whenever the legacy NativeModule system is used. This flag is independent of useTurboModules. In practice, it's only enabled when TurboModules is enabled. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D30250363 fbshipit-source-id: f610567c5b99a4fbf8252c3962908668f483d028 --- .../java/com/facebook/react/config/ReactFeatureFlags.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 9955932d4ff..8513e6c0ccd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -25,6 +25,13 @@ public class ReactFeatureFlags { */ public static volatile boolean useTurboModules = false; + /** + * After TurboModules and Fabric are enabled, we need to ensure that the legacy NativeModule isn't + * isn't used. So, turn this flag on to trigger warnings whenever the legacy NativeModule system + * is used. + */ + public static volatile boolean warnOnLegacyNativeModuleSystemUse = false; + /** Should we dispatch TurboModule methods with promise returns to the NativeModules thread? */ public static volatile boolean enableTurboModulePromiseAsyncDispatch = false;