Java Code Examples for com.facebook.react.bridge.ReactContext#onHostPause()

The following examples show how to use com.facebook.react.bridge.ReactContext#onHostPause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 6 votes vote down vote up
private void tearDownReactContext(ReactContext reactContext) {
  Log.d(ReactConstants.TAG, "ReactInstanceManager.tearDownReactContext()");
  UiThreadUtil.assertOnUiThread();
  if (mLifecycleState == LifecycleState.RESUMED) {
    reactContext.onHostPause();
  }

  synchronized (mAttachedRootViews) {
    for (ReactRootView rootView : mAttachedRootViews) {
      rootView.removeAllViews();
      rootView.setId(View.NO_ID);
    }
  }

  reactContext.destroy();
  mDevSupportManager.onReactInstanceDestroyed(reactContext);
  mMemoryPressureRouter.removeMemoryPressureListener(reactContext.getCatalystInstance());
}
 
Example 2
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 5 votes vote down vote up
private synchronized void moveToBeforeResumeLifecycleState() {
  ReactContext currentContext = getCurrentReactContext();
  if (currentContext != null) {
    if (mLifecycleState == LifecycleState.BEFORE_CREATE) {
      currentContext.onHostResume(mCurrentActivity);
      currentContext.onHostPause();
    } else if (mLifecycleState == LifecycleState.RESUMED) {
      currentContext.onHostPause();
    }
  }
  mLifecycleState = LifecycleState.BEFORE_RESUME;
}
 
Example 3
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 5 votes vote down vote up
private synchronized void moveToBeforeCreateLifecycleState() {
  ReactContext currentContext = getCurrentReactContext();
  if (currentContext != null) {
    if (mLifecycleState == LifecycleState.RESUMED) {
      currentContext.onHostPause();
      mLifecycleState = LifecycleState.BEFORE_RESUME;
    }
    if (mLifecycleState == LifecycleState.BEFORE_RESUME) {
      currentContext.onHostDestroy();
    }
  }
  mLifecycleState = LifecycleState.BEFORE_CREATE;
}