From e2fb88e6fd81d7eb7d065e18e910b089197d1f15 Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Thu, 28 Dec 2023 07:39:48 -0800 Subject: [PATCH] Deprecate old JSI module APIs (#42085) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42085 Deprecating the old JSI module APIs: `getJSIModule(JSIModuleType moduleType)`, `addJSIModules(List jsiModules)` and `setTurboModuleManager(JSIModule getter)` to further delete them in future release. Deprecating them as of now to cater the OSS use-cases Changelog: [Internal] internal Reviewed By: christophpurrer Differential Revision: D50927292 fbshipit-source-id: 1d25f9f28b8aaf34979a90e4792317b263ae1714 --- .../com/facebook/react/bridge/CatalystInstance.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java index 5d0d4297742206..3849fd50db200e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java @@ -71,6 +71,9 @@ public interface CatalystInstance @Nullable NativeModule getNativeModule(String moduleName); + @Deprecated( + since = + "getJSIModule(JSIModuleType moduleType) is deprecated and will be deleted in the future. Please use ReactInstanceEventListener to subscribe for react instance events instead.") JSIModule getJSIModule(JSIModuleType moduleType); Collection getNativeModules(); @@ -116,6 +119,7 @@ public interface CatalystInstance RuntimeScheduler getRuntimeScheduler(); + @Deprecated void addJSIModules(List jsiModules); /** @@ -130,11 +134,9 @@ public interface CatalystInstance */ NativeMethodCallInvokerHolder getNativeMethodCallInvokerHolder(); - /** - * For the time being, we want code relying on the old infra to also work with TurboModules. - * Hence, we must provide the TurboModuleRegistry to CatalystInstance so that getNativeModule, - * hasNativeModule, and getNativeModules can also return TurboModules. - */ + @Deprecated( + since = + "setTurboModuleManager(JSIModule getter) is deprecated and will be deleted in the future. Please use setTurboModuleRegistry(TurboModuleRegistry turboModuleRegistry)instead.") void setTurboModuleManager(JSIModule getter); @DeprecatedInNewArchitecture(