mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-12 19:48:30 +08:00
use a static react instance holder
Reviewed By: astreet Differential Revision: D2937867 fb-gh-sync-id: cdda79929fa5993b6ef159aa73922909017c2ded shipit-source-id: cdda79929fa5993b6ef159aa73922909017c2ded
This commit is contained in:
committed by
facebook-github-bot-7
parent
b516976457
commit
19a1c4c229
@@ -133,7 +133,7 @@ public class ReactContext extends ContextWrapper {
|
||||
/**
|
||||
* Should be called by the hosting Fragment in {@link Fragment#onResume}
|
||||
*/
|
||||
public void onResume(@Nullable Activity activity) {
|
||||
public void onHostResume(@Nullable Activity activity) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
mCurrentActivity = activity;
|
||||
for (LifecycleEventListener listener : mLifecycleEventListeners) {
|
||||
@@ -144,7 +144,7 @@ public class ReactContext extends ContextWrapper {
|
||||
/**
|
||||
* Should be called by the hosting Fragment in {@link Fragment#onPause}
|
||||
*/
|
||||
public void onPause() {
|
||||
public void onHostPause() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
for (LifecycleEventListener listener : mLifecycleEventListeners) {
|
||||
listener.onHostPause();
|
||||
@@ -154,15 +154,23 @@ public class ReactContext extends ContextWrapper {
|
||||
/**
|
||||
* Should be called by the hosting Fragment in {@link Fragment#onDestroy}
|
||||
*/
|
||||
public void onDestroy() {
|
||||
public void onHostDestroy() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
for (LifecycleEventListener listener : mLifecycleEventListeners) {
|
||||
listener.onHostDestroy();
|
||||
}
|
||||
mCurrentActivity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this instance, making it unusable.
|
||||
*/
|
||||
public void destroy() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
if (mCatalystInstance != null) {
|
||||
mCatalystInstance.destroy();
|
||||
}
|
||||
mCurrentActivity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user