mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-10 17:22:45 +08:00
remove activities from module constructors
Summary: Refactor modules that take activities (or activities that implement some interface) as constructor args to not do that. Expose `getCurrentActivity()` in `ReactContext` and use that wherever the activity is needed. public Reviewed By: astreet Differential Revision: D2680462 fb-gh-sync-id: f263b3fe5b422b7aab9fdadd051cef4e82797b0a
This commit is contained in:
committed by
facebook-github-bot-9
parent
7ab17e5ef3
commit
c06efc0831
@@ -47,6 +47,18 @@ import com.facebook.react.uimanager.ViewManager;
|
||||
* have a static method, and so cannot (in Java < 8), be one.
|
||||
*/
|
||||
public abstract class ReactInstanceManager {
|
||||
|
||||
/**
|
||||
* Listener interface for react instance events.
|
||||
*/
|
||||
public interface ReactInstanceEventListener {
|
||||
/**
|
||||
* Called when the react context is initialized (all modules registered). Always called on the
|
||||
* UI thread.
|
||||
*/
|
||||
void onReactContextInitialized(ReactContext context);
|
||||
}
|
||||
|
||||
public abstract DevSupportManager getDevSupportManager();
|
||||
|
||||
/**
|
||||
@@ -118,6 +130,11 @@ public abstract class ReactInstanceManager {
|
||||
public abstract List<ViewManager> createAllViewManagers(
|
||||
ReactApplicationContext catalystApplicationContext);
|
||||
|
||||
/**
|
||||
* Add a listener to be notified of react instance events.
|
||||
*/
|
||||
public abstract void addReactInstanceEventListener(ReactInstanceEventListener listener);
|
||||
|
||||
@VisibleForTesting
|
||||
public abstract @Nullable ReactContext getCurrentReactContext();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user