Pārlūkot izejas kodu

Support titleBarTitleTextCentered in AppStyle (#1102)

Guy Carmeli 7 gadus atpakaļ
vecāks
revīzija
1e9e6e9b85

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

@@ -44,7 +44,7 @@ public class StyleParamsParser {
44 44
         result.titleBarButtonColor = getColor("titleBarButtonColor", getTitleBarButtonColor());
45 45
         result.titleBarDisabledButtonColor = getColor("titleBarDisabledButtonColor", getTitleBarDisabledButtonColor());
46 46
         result.titleBarTitleFont = getFont("titleBarTitleFontFamily", getDefaultTitleTextFontFamily());
47
-        result.titleBarTitleTextCentered = getBoolean("titleBarTitleTextCentered", false);
47
+        result.titleBarTitleTextCentered = getBoolean("titleBarTitleTextCentered", getDefaultTitleBarTextCentered());
48 48
         result.backButtonHidden = getBoolean("backButtonHidden", getDefaultBackButtonHidden());
49 49
         result.topTabsHidden = getBoolean("topTabsHidden", getDefaultTopTabsHidden());
50 50
 
@@ -238,6 +238,10 @@ public class StyleParamsParser {
238 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 245
     private boolean getBoolean(String key, boolean defaultValue) {
242 246
         return params.containsKey(key) ? params.getBoolean(key) : defaultValue;
243 247
     }