Skip to content

Commit

Permalink
ReactHost: Make ReactInstanceEventListener APIs public
Browse files Browse the repository at this point in the history
Summary:
The ReactInstanceManager allows applications to register a ReactInstanceEventListener with itself.

Exposing a similar functionality to ReactHost. So, applications can do the same in bridgeless.

Changelog: [Android][Added] - Make ReactInstanceEventListener available on ReactHost

Reviewed By: christophpurrer

Differential Revision: D58890092
  • Loading branch information
RSNara authored and facebook-github-bot committed Jun 25, 2024
1 parent 1fda630 commit 751cf5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public class com/facebook/react/ReactFragment$Builder {

public abstract interface class com/facebook/react/ReactHost {
public abstract fun addBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
public abstract fun addReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
public abstract fun createSurface (Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Lcom/facebook/react/interfaces/fabric/ReactSurface;
public abstract fun destroy (Ljava/lang/String;Ljava/lang/Exception;)Lcom/facebook/react/interfaces/TaskInterface;
public abstract fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
Expand All @@ -230,6 +231,7 @@ public abstract interface class com/facebook/react/ReactHost {
public abstract fun onWindowFocusChange (Z)V
public abstract fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
public abstract fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
public abstract fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
public abstract fun setJsEngineResolutionAlgorithm (Lcom/facebook/react/JSEngineResolutionAlgorithm;)V
public abstract fun start ()Lcom/facebook/react/interfaces/TaskInterface;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,10 @@ public interface ReactHost {
public fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)

public fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)

/** Add a listener to be notified of ReactInstance events. */
public fun addReactInstanceEventListener(listener: ReactInstanceEventListener)

/** Remove a listener previously added with {@link #addReactInstanceEventListener}. */
public fun removeReactInstanceEventListener(listener: ReactInstanceEventListener)
}

0 comments on commit 751cf5f

Please sign in to comment.