Browse Source

default to statusBarTextColorScheme from AppStyle

Guy Carmeli 7 years ago
parent
commit
2ce161d09e

+ 3
- 3
android/app/src/main/java/com/reactnativenavigation/params/StatusBarTextColorScheme.java View File

6
 public enum StatusBarTextColorScheme {
6
 public enum StatusBarTextColorScheme {
7
     Light, Dark, Undefined;
7
     Light, Dark, Undefined;
8
 
8
 
9
-    public static StatusBarTextColorScheme fromString(@Nullable String colorScheme) {
10
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || colorScheme == null) return Undefined;
9
+    public static StatusBarTextColorScheme fromString(@Nullable String colorScheme, StatusBarTextColorScheme defaultScheme) {
10
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || colorScheme == null) return defaultScheme;
11
         switch (colorScheme) {
11
         switch (colorScheme) {
12
             case "light":
12
             case "light":
13
                 return Light;
13
                 return Light;
14
             case "dark":
14
             case "dark":
15
                 return Dark;
15
                 return Dark;
16
             default:
16
             default:
17
-                return Undefined;
17
+                return defaultScheme;
18
         }
18
         }
19
     }
19
     }
20
 }
20
 }

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

30
         result.orientation = Orientation.fromString(params.getString("orientation", getDefaultOrientation()));
30
         result.orientation = Orientation.fromString(params.getString("orientation", getDefaultOrientation()));
31
         result.statusBarColor = getColor("statusBarColor", getDefaultStatusBarColor());
31
         result.statusBarColor = getColor("statusBarColor", getDefaultStatusBarColor());
32
         result.statusBarHidden = getBoolean("statusBarHidden", getDefaultStatusHidden());
32
         result.statusBarHidden = getBoolean("statusBarHidden", getDefaultStatusHidden());
33
-        result.statusBarTextColorScheme = StatusBarTextColorScheme.fromString(params.getString("statusBarTextColorScheme"));
33
+        result.statusBarTextColorScheme = StatusBarTextColorScheme.fromString(params.getString("statusBarTextColorScheme"), getDefaultStatusBarTextColorScheme());
34
         result.contextualMenuStatusBarColor = getColor("contextualMenuStatusBarColor", getDefaultContextualMenuStatusBarColor());
34
         result.contextualMenuStatusBarColor = getColor("contextualMenuStatusBarColor", getDefaultContextualMenuStatusBarColor());
35
         result.contextualMenuButtonsColor = getColor("contextualMenuButtonsColor", getDefaultContextualMenuButtonsColor());
35
         result.contextualMenuButtonsColor = getColor("contextualMenuButtonsColor", getDefaultContextualMenuButtonsColor());
36
         result.contextualMenuBackgroundColor = getColor("contextualMenuBackgroundColor", getDefaultContextualMenuBackgroundColor());
36
         result.contextualMenuBackgroundColor = getColor("contextualMenuBackgroundColor", getDefaultContextualMenuBackgroundColor());
99
         return result;
99
         return result;
100
     }
100
     }
101
 
101
 
102
+    private StatusBarTextColorScheme getDefaultStatusBarTextColorScheme() {
103
+        return AppStyle.appStyle == null ? StatusBarTextColorScheme.Undefined : AppStyle.appStyle.statusBarTextColorScheme;
104
+    }
105
+
102
     private String getDefaultOrientation() {
106
     private String getDefaultOrientation() {
103
         return AppStyle.appStyle == null ? null : AppStyle.appStyle.orientation.name;
107
         return AppStyle.appStyle == null ? null : AppStyle.appStyle.orientation.name;
104
     }
108
     }