Browse Source

Don't override LightBox ReactRootView id

fixes #1502
Guy Carmeli 6 years ago
parent
commit
14a7952711

+ 7
- 3
android/app/src/main/java/com/reactnativenavigation/views/LightBox.java View File

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