Bläddra i källkod

Don't override LightBox ReactRootView id

fixes #1502
Guy Carmeli 7 år sedan
förälder
incheckning
14a7952711

+ 7
- 3
android/app/src/main/java/com/reactnativenavigation/views/LightBox.java Visa fil

@@ -16,6 +16,7 @@ import android.view.ViewGroup;
16 16
 import android.view.Window;
17 17
 import android.view.WindowManager;
18 18
 import android.widget.RelativeLayout;
19
+
19 20
 import com.reactnativenavigation.R;
20 21
 import com.reactnativenavigation.params.LightBoxParams;
21 22
 import com.reactnativenavigation.screens.Screen;
@@ -34,7 +35,7 @@ public class LightBox extends Dialog implements DialogInterface.OnDismissListene
34 35
     public LightBox(AppCompatActivity activity, Runnable onDismissListener, LightBoxParams params) {
35 36
         super(activity, R.style.LightBox);
36 37
         this.onDismissListener = onDismissListener;
37
-        this.cancelable =!params.overrideBackPress; 
38
+        this.cancelable = !params.overrideBackPress;
38 39
         setOnDismissListener(this);
39 40
         requestWindowFeature(Window.FEATURE_NO_TITLE);
40 41
         createContent(activity, params);
@@ -52,7 +53,6 @@ public class LightBox extends Dialog implements DialogInterface.OnDismissListene
52 53
         lightBox.setAlpha(0);
53 54
         content = new ContentView(context, params.screenId, params.navigationParams);
54 55
         content.setAlpha(0);
55
-        content.setId(ViewUtils.generateViewId());
56 56
         RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
57 57
         lp.addRule(RelativeLayout.CENTER_IN_PARENT, content.getId());
58 58
         lightBox.setBackgroundColor(params.backgroundColor.getColor());
@@ -107,7 +107,11 @@ public class LightBox extends Dialog implements DialogInterface.OnDismissListene
107 107
     }
108 108
 
109 109
     public void destroy() {
110
-        content.unmountReactView();
110
+        if (content != null) {
111
+            content.unmountReactView();
112
+            lightBox.removeAllViews();
113
+            content = null;
114
+        }
111 115
         dismiss();
112 116
     }
113 117