Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public String toString() {
public Color bottomTabBadgeTextColor;
public Color bottomTabBadgeBackgroundColor;
public Font bottomTabFontFamily;
public Integer bottomTabFontSize;
public Integer bottomTabSelectedFontSize;

public Color navigationBarColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public StyleParams parse() {
result.forceTitlesDisplay = getBoolean("forceTitlesDisplay", getDefaultForceTitlesDisplay());

result.bottomTabFontFamily = getFont("bottomTabFontFamily", getDefaultBottomTabsFontFamily());
result.bottomTabFontSize = getIntegerOrNull("bottomTabFontSize");
result.bottomTabSelectedFontSize = getIntegerOrNull("bottomTabSelectedFontSize");

return result;
}
Expand All @@ -125,6 +127,8 @@ private StyleParams createDefaultStyleParams() {
result.titleBarHideOnScroll = false;
result.orientation = Orientation.auto;
result.bottomTabFontFamily = new StyleParams.Font();
result.bottomTabFontSize = 10;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid hardcoding a default font size. Can we set font size only if specified by the user?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

result.bottomTabSelectedFontSize = 10;
result.titleBarTitleFont = new StyleParams.Font();
result.titleBarSubtitleFontFamily = new StyleParams.Font();
result.titleBarButtonFontFamily = new StyleParams.Font();
Expand Down Expand Up @@ -361,6 +365,10 @@ private int getInt(String key, int defaultValue) {
return params.containsKey(key) ? params.getInt(key) : defaultValue;
}

private Integer getIntegerOrNull(String key) {
return params.containsKey(key) ? params.getInt(key) : null;
}

private Bundle getBundle(String key) {
return params.containsKey(key) ? params.getBundle(key) : Bundle.EMPTY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public BottomTabs(Context context) {
createVisibilityAnimator();
setStyle();
setFontFamily();
setFontSize();
}

public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
Expand Down Expand Up @@ -156,4 +157,10 @@ private void setFontFamily() {
setTitleTypeface(AppStyle.appStyle.bottomTabFontFamily.get());
}
}

private void setFontSize() {
if(AppStyle.appStyle.bottomTabSelectedFontSize != null && AppStyle.appStyle.bottomTabFontSize != null) {
setTitleTextSizeInSp(AppStyle.appStyle.bottomTabSelectedFontSize, AppStyle.appStyle.bottomTabFontSize);
}
}
}
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 12 16:05:44 IDT 2016
#Mon Feb 19 11:46:35 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
4 changes: 3 additions & 1 deletion docs/styling-the-tab-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Navigation.startTabBasedApp({
tabBarButtonColor: '#ffffff',
tabBarSelectedButtonColor: '#63d7cc',
tabBarTranslucent: false,
tabFontFamily: 'Avenir-Medium' // existing font family name or asset file without extension which can be '.ttf' or '.otf' (searched only if '.ttf' asset not found)
tabFontFamily: 'Avenir-Medium', // existing font family name or asset file without extension which can be '.ttf' or '.otf' (searched only if '.ttf' asset not found)
tabFontSize: 10,
selectedTabFontSize: 12,
},
...
}
Expand Down
2 changes: 2 additions & 0 deletions src/deprecated/platformSpecificDeprecated.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ function convertStyleParams(originalStyleObject) {
bottomTabBadgeTextColor: processColor(originalStyleObject.bottomTabBadgeTextColor),
bottomTabBadgeBackgroundColor: processColor(originalStyleObject.bottomTabBadgeBackgroundColor),
bottomTabFontFamily: originalStyleObject.tabFontFamily,
bottomTabFontSize: originalStyleObject.tabFontSize,
bottomTabSelectedFontSize: originalStyleObject.selectedTabFontSize,

navigationBarColor: processColor(originalStyleObject.navigationBarColor)
};
Expand Down