Java Code Examples for com.facebook.react.common.LifecycleState#BEFORE_CREATE

The following examples show how to use com.facebook.react.common.LifecycleState#BEFORE_CREATE . 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: ReactContext.java    From react-native-GPay with MIT License 5 votes vote down vote up
/**
 * Should be called by the hosting Fragment in {@link Fragment#onDestroy}
 */
public void onHostDestroy() {
  UiThreadUtil.assertOnUiThread();
  mLifecycleState = LifecycleState.BEFORE_CREATE;
  for (LifecycleEventListener listener : mLifecycleEventListeners) {
    try {
      listener.onHostDestroy();
    } catch (RuntimeException e) {
      handleException(e);
    }
  }
  mCurrentActivity = null;
}
 
Example 2
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 5 votes vote down vote up
private synchronized void moveToResumedLifecycleState(boolean force) {
  ReactContext currentContext = getCurrentReactContext();
  if (currentContext != null) {
    // we currently don't have an onCreate callback so we call onResume for both transitions
    if (force ||
        mLifecycleState == LifecycleState.BEFORE_RESUME ||
        mLifecycleState == LifecycleState.BEFORE_CREATE) {
      currentContext.onHostResume(mCurrentActivity);
    }
  }
  mLifecycleState = LifecycleState.RESUMED;
}
 
Example 3
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 4
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;
}