Show dialog on UI thread to avoid crash

This commit is contained in:
Byron Wang 2016-02-11 15:36:21 +08:00
parent 86764c4e42
commit 641dea6d84
1 changed files with 8 additions and 5 deletions

View File

@ -284,12 +284,15 @@ public class DialogAndroid extends ReactContextBaseJavaModule {
} }
}); });
} }
mActivity.runOnUiThread(new Runnable() {
public void run() {
if(mDialog != null) if(mDialog != null)
mDialog.dismiss(); mDialog.dismiss();
mDialog = mBuilder.build(); mDialog = mBuilder.build();
mDialog.show(); mDialog.show();
} }
});
}
@ReactMethod @ReactMethod
public void dismiss() { public void dismiss() {