Introduce BridgeReactContext < ReactApplicationContext (#43624)

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

Eventually, we will move all bridge methods to BridgeReactContext.

Long-term, ReactApplicationContext and ReactContext will become abstract. And these two contexts will only contain methods common to both modes.

Changelog: [Android][Added] Introduce BridgeReactContext

Reviewed By: cortinico

Differential Revision: D55218592

fbshipit-source-id: 731d4940d492a1ed3f855c9a181d2a6f9eeb9623
This commit is contained in:
Ramanpreet Nara
2024-03-26 07:15:29 -07:00
committed by Facebook GitHub Bot
parent fcddb16bff
commit 6386988de1
2 changed files with 24 additions and 0 deletions
@@ -532,6 +532,10 @@ public abstract class com/facebook/react/bridge/BaseJavaModule : com/facebook/re
public fun invalidate ()V
}
public final class com/facebook/react/bridge/BridgeReactContext : com/facebook/react/bridge/ReactApplicationContext {
public fun <init> (Landroid/content/Context;)V
}
public abstract interface class com/facebook/react/bridge/Callback {
public abstract fun invoke ([Ljava/lang/Object;)V
}
@@ -0,0 +1,20 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge
import android.content.Context
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
/**
* This is the bridge-specific concrete subclass of ReactContext. ReactContext has many methods that
* delegate to the react instance. This subclass will implement those methods, by delegating to the
* CatalystInstance. If you need to create a ReactContext within an "bridge context", please create
* BridgeReactContext.
*/
@DeprecatedInNewArchitecture
class BridgeReactContext(base: Context) : ReactApplicationContext(base) {}