Pārlūkot izejas kodu

Added overrideBackPress to LightBox (#1520)

Brendon Sled 7 gadus atpakaļ
vecāks
revīzija
dea336ce10

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/LightBoxParams.java Parādīt failu

@@ -5,4 +5,5 @@ public class LightBoxParams {
5 5
     public NavigationParams navigationParams;
6 6
     public StyleParams.Color backgroundColor;
7 7
     public boolean tapBackgroundToDismiss;
8
+    public boolean overrideBackPress;
8 9
 }

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/LightBoxParamsParser.java Parādīt failu

@@ -20,6 +20,7 @@ public class LightBoxParamsParser extends Parser {
20 20
         result.navigationParams = new NavigationParams(params.getBundle("navigationParams"));
21 21
         result.backgroundColor = getColor(params, "backgroundColor");
22 22
         result.tapBackgroundToDismiss = params.getBoolean("tapBackgroundToDismiss");
23
+        result.overrideBackPress = params.getBoolean("overrideBackPress");
23 24
         return result;
24 25
     }
25 26
 }

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/views/LightBox.java Parādīt failu

@@ -36,6 +36,7 @@ public class LightBox extends Dialog implements DialogInterface.OnDismissListene
36 36
         setOnDismissListener(this);
37 37
         requestWindowFeature(Window.FEATURE_NO_TITLE);
38 38
         createContent(activity, params);
39
+        setCancelable(!params.overrideBackPress);
39 40
         getWindow().setWindowAnimations(android.R.style.Animation);
40 41
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
41 42
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);