mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 18:05:26 +08:00
Fix IllegalStateException when dismissing DialogManager
Summary: This diff fixes a IllegalStateException that can happen because of a race condition when using DialogManager Reviewed By: fkgozali Differential Revision: D12899432 fbshipit-source-id: 98fb7c1ee1d292a959628a33c8a2dd5a6d93e328
This commit is contained in:
committed by
Facebook Github Bot
parent
8b275a8b8d
commit
38e01a20c3
@@ -7,17 +7,12 @@
|
||||
|
||||
package com.facebook.react.modules.dialog;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
@@ -29,6 +24,8 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ReactModule(name = DialogModule.NAME)
|
||||
public class DialogModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
|
||||
@@ -110,13 +107,13 @@ public class DialogModule extends ReactContextBaseJavaModule implements Lifecycl
|
||||
if (isUsingSupportLibrary()) {
|
||||
SupportAlertFragment oldFragment =
|
||||
(SupportAlertFragment) mSupportFragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
if (oldFragment != null) {
|
||||
if (oldFragment != null && oldFragment.isResumed()) {
|
||||
oldFragment.dismiss();
|
||||
}
|
||||
} else {
|
||||
AlertFragment oldFragment =
|
||||
(AlertFragment) mFragmentManager.findFragmentByTag(FRAGMENT_TAG);
|
||||
if (oldFragment != null) {
|
||||
if (oldFragment != null && oldFragment.isResumed()) {
|
||||
oldFragment.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user