@@ -128,10 +128,7 @@ public void onDropInstance() {
128128
129129 private void dismiss () {
130130 if (mDialog != null ) {
131- Activity currentActivity = getCurrentActivity ();
132- if (mDialog .isShowing () && (currentActivity == null || !currentActivity .isFinishing ())) {
133- mDialog .dismiss ();
134- }
131+ mDialog .dismiss ();
135132 mDialog = null ;
136133
137134 // We need to remove the mHostView from the parent
@@ -212,9 +209,8 @@ protected void showOrUpdate() {
212209 } else if (mAnimationType .equals ("slide" )) {
213210 theme = R .style .Theme_FullScreenDialogAnimatedSlide ;
214211 }
215- Activity currentActivity = getCurrentActivity ();
216- Context context = currentActivity == null ? getContext () : currentActivity ;
217- mDialog = new Dialog (context , theme );
212+ mDialog = new Dialog (getContext (), theme );
213+
218214 mDialog .setContentView (getContentView ());
219215 updateProperties ();
220216
@@ -237,7 +233,7 @@ public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
237233 } else {
238234 // We redirect the rest of the key events to the current activity, since the activity
239235 // expects to receive those events and react to them, ie. in the case of the dev menu
240- Activity currentActivity = getCurrentActivity ();
236+ Activity currentActivity = (( ReactContext ) getContext ()). getCurrentActivity ();
241237 if (currentActivity != null ) {
242238 return currentActivity .onKeyUp (keyCode , event );
243239 }
@@ -251,13 +247,7 @@ public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
251247 if (mHardwareAccelerated ) {
252248 mDialog .getWindow ().addFlags (WindowManager .LayoutParams .FLAG_HARDWARE_ACCELERATED );
253249 }
254- if (currentActivity == null || !currentActivity .isFinishing ()) {
255- mDialog .show ();
256- }
257- }
258-
259- private @ Nullable Activity getCurrentActivity () {
260- return ((ReactContext ) getContext ()).getCurrentActivity ();
250+ mDialog .show ();
261251 }
262252
263253 /**
0 commit comments