Warn whenever CxxNativeModules are used

Summary:
After this diff, when ReactFeatureFlags.warnOnLegacyNativeModuleSystemUse is enabled, the legacy NativeModule infra will log soft exceptions whenever legacy NativeModules are accessed/used.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D30272695

fbshipit-source-id: 7111402c1d8b883a600dcb4559e9ff1d56447070
This commit is contained in:
Ramanpreet Nara
2021-08-13 13:53:44 -07:00
committed by Facebook GitHub Bot
parent b7fd68e611
commit f536f82e12
5 changed files with 54 additions and 0 deletions
@@ -139,6 +139,11 @@ public class CatalystInstanceImpl implements CatalystInstance {
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initializeCxxBridge");
if (ReactFeatureFlags.warnOnLegacyNativeModuleSystemUse) {
warnOnLegacyNativeModuleSystemUse();
}
initializeBridge(
new BridgeCallback(this),
jsExecutor,
@@ -206,6 +211,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
private native void jniExtendNativeModules(
Collection<JavaModuleWrapper> javaModules, Collection<ModuleHolder> cxxModules);
private native void warnOnLegacyNativeModuleSystemUse();
private native void initializeBridge(
ReactCallback callback,
JavaScriptExecutor jsExecutor,