Browse Source

Added overrideBackPress to LightBox (#1520)

Brendon Sled 7 years ago
parent
commit
dea336ce10

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/LightBoxParams.java View File

5
     public NavigationParams navigationParams;
5
     public NavigationParams navigationParams;
6
     public StyleParams.Color backgroundColor;
6
     public StyleParams.Color backgroundColor;
7
     public boolean tapBackgroundToDismiss;
7
     public boolean tapBackgroundToDismiss;
8
+    public boolean overrideBackPress;
8
 }
9
 }

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/LightBoxParamsParser.java View File

20
         result.navigationParams = new NavigationParams(params.getBundle("navigationParams"));
20
         result.navigationParams = new NavigationParams(params.getBundle("navigationParams"));
21
         result.backgroundColor = getColor(params, "backgroundColor");
21
         result.backgroundColor = getColor(params, "backgroundColor");
22
         result.tapBackgroundToDismiss = params.getBoolean("tapBackgroundToDismiss");
22
         result.tapBackgroundToDismiss = params.getBoolean("tapBackgroundToDismiss");
23
+        result.overrideBackPress = params.getBoolean("overrideBackPress");
23
         return result;
24
         return result;
24
     }
25
     }
25
 }
26
 }

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/views/LightBox.java View File

36
         setOnDismissListener(this);
36
         setOnDismissListener(this);
37
         requestWindowFeature(Window.FEATURE_NO_TITLE);
37
         requestWindowFeature(Window.FEATURE_NO_TITLE);
38
         createContent(activity, params);
38
         createContent(activity, params);
39
+        setCancelable(!params.overrideBackPress);
39
         getWindow().setWindowAnimations(android.R.style.Animation);
40
         getWindow().setWindowAnimations(android.R.style.Animation);
40
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
41
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
41
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
42
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);