Mark ReactPackage#getModule as stable (#47676)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47676

`getModule` is used by all modern ReactPackage base-classes to allow lazy loading of specific module and should be considered stable at this point.

Changelog: [Android][Added] Marked ReactPackage#getModule as stable.

Reviewed By: mdvacca

Differential Revision: D66127068

fbshipit-source-id: de447794435d267619430e3c0cbc65c6e1c614ba
This commit is contained in:
Pieter De Baets 2024-11-19 10:19:14 -08:00 committed by Facebook GitHub Bot
parent 4c3112c8d8
commit 8fba7ebb5e
2 changed files with 4 additions and 3 deletions

View File

@ -342,6 +342,7 @@ public abstract class com/facebook/react/ReactNativeHost {
public abstract interface class com/facebook/react/ReactPackage { public abstract interface class com/facebook/react/ReactPackage {
public abstract fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List; public abstract fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
public abstract fun createViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List; public abstract fun createViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
public fun getModule (Ljava/lang/String;Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/NativeModule;
} }
public abstract interface class com/facebook/react/ReactPackageLogger { public abstract interface class com/facebook/react/ReactPackageLogger {

View File

@ -12,7 +12,7 @@ import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture; import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
import com.facebook.react.common.annotations.UnstableReactNativeAPI; import com.facebook.react.common.annotations.StableReactNativeAPI;
import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewManager; import com.facebook.react.uimanager.ViewManager;
import java.util.List; import java.util.List;
@ -43,7 +43,7 @@ public interface ReactPackage {
* is deprecated in the new Architecture of React Native. * is deprecated in the new Architecture of React Native.
*/ */
@NonNull @NonNull
@DeprecatedInNewArchitecture @DeprecatedInNewArchitecture(message = "Migrate to BaseReactPackage and implement getModule")
List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext); List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext);
/** /**
@ -59,7 +59,7 @@ public interface ReactPackage {
* @param reactContext {@link ReactApplicationContext} context for this * @param reactContext {@link ReactApplicationContext} context for this
*/ */
@Nullable @Nullable
@UnstableReactNativeAPI @StableReactNativeAPI
default NativeModule getModule( default NativeModule getModule(
@NonNull String name, @NonNull ReactApplicationContext reactContext) { @NonNull String name, @NonNull ReactApplicationContext reactContext) {
return null; return null;