Browse Source

Support titleBarTitleTextCentered in AppStyle (#1102)

Guy Carmeli 7 years ago
parent
commit
1e9e6e9b85

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

44
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
44
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
45
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
45
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
46
         result.titleBarTitleFont = getFont("titleBarTitleFontFamily", getDefaultTitleTextFontFamily());
46
         result.titleBarTitleFont = getFont("titleBarTitleFontFamily", getDefaultTitleTextFontFamily());
47
-        result.titleBarTitleTextCentered = getBoolean("titleBarTitleTextCentered", false);
47
+        result.titleBarTitleTextCentered = getBoolean("titleBarTitleTextCentered", getDefaultTitleBarTextCentered());
48
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
48
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
49
         result.topTabsHidden = getBoolean("topTabsHidden", getDefaultTopTabsHidden());
49
         result.topTabsHidden = getBoolean("topTabsHidden", getDefaultTopTabsHidden());
50
 
50
 
238
         return AppStyle.appStyle == null ? new StyleParams.Font() : AppStyle.appStyle.titleBarTitleFont;
238
         return AppStyle.appStyle == null ? new StyleParams.Font() : AppStyle.appStyle.titleBarTitleFont;
239
     }
239
     }
240
 
240
 
241
+    private boolean getDefaultTitleBarTextCentered() {
242
+        return AppStyle.appStyle != null && AppStyle.appStyle.titleBarTitleTextCentered;
243
+    }
244
+
241
     private boolean getBoolean(String key, boolean defaultValue) {
245
     private boolean getBoolean(String key, boolean defaultValue) {
242
         return params.containsKey(key) ? params.getBoolean(key) : defaultValue;
246
         return params.containsKey(key) ? params.getBoolean(key) : defaultValue;
243
     }
247
     }