Sfoglia il codice sorgente

Set default StatusBarBackgroundColor in OptionsPresenter

This prevents the call to mergeOptions from applying statusBar color even
though it was not declared explicitly by the user.
Guy Carmeli 6 anni fa
parent
commit
5e92a8438a

+ 2
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/StatusBarOptions.java Vedi File

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3 3
 import com.reactnativenavigation.parse.params.Color;
4
+import com.reactnativenavigation.parse.params.NullColor;
4 5
 import com.reactnativenavigation.parse.parsers.ColorParser;
5 6
 
6 7
 import org.json.JSONObject;
@@ -15,7 +16,7 @@ public class StatusBarOptions {
15 16
         return result;
16 17
     }
17 18
 
18
-    public Color backgroundColor = new Color(android.graphics.Color.BLACK);
19
+    public Color backgroundColor = new NullColor();
19 20
 
20 21
     public void mergeWith(StatusBarOptions other) {
21 22
         if (other.backgroundColor.hasValue()) backgroundColor = other.backgroundColor;

+ 2
- 1
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java Vedi File

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.presentation;
2 2
 
3 3
 import android.app.Activity;
4
+import android.graphics.Color;
4 5
 import android.os.Build;
5 6
 import android.view.View;
6 7
 
@@ -39,7 +40,7 @@ public class OptionsPresenter {
39 40
 
40 41
     private void applyStatusBarOptions(StatusBarOptions statusBar) {
41 42
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
42
-            activity.getWindow().setStatusBarColor(statusBar.backgroundColor.get());
43
+            activity.getWindow().setStatusBarColor(statusBar.backgroundColor.get(Color.BLACK));
43 44
         }
44 45
     }
45 46
 }