Skip to content

Commit

Permalink
Added TitleState showWhenActiveForce option for bottomTabs (#5814)
Browse files Browse the repository at this point in the history
* Updated ahbottomnavigation to 3.0.9
  • Loading branch information
BenJeau authored and guyca committed Jan 9, 2020
1 parent 608bb67 commit cf18e2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/docs/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Navigation.mergeOptions(this.props.componentId, {
},
bottomTabs: {
elevation: 8, // BottomTabs elevation in dp
titleDisplayMode: 'alwaysShow' | 'showWhenActive' | 'alwaysHide' // Sets the title state for each tab.
titleDisplayMode: 'alwaysShow' | 'showWhenActive' | 'alwaysHide' | 'showWhenActiveForce' // Sets the title state for each tab. (showWhenActiveForce to be used when showWhenActive doesn't work, e.g. with three bottom tabs)
},
bottomTab: {
selectedFontSize: 19 // Selected tab font size in sp
Expand Down
2 changes: 1 addition & 1 deletion lib/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha08'

implementation 'com.github.wix-playground:ahbottomnavigation:3.0.8'
implementation 'com.github.wix-playground:ahbottomnavigation:3.0.9'
implementation 'com.github.wix-playground:reflow-animator:1.0.4'
implementation 'com.github.clans:fab:1.6.4'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import javax.annotation.Nullable;

public enum TitleDisplayMode {
ALWAYS_SHOW(TitleState.ALWAYS_SHOW), SHOW_WHEN_ACTIVE(TitleState.SHOW_WHEN_ACTIVE), ALWAYS_HIDE(TitleState.ALWAYS_HIDE), UNDEFINED(null);
ALWAYS_SHOW(TitleState.ALWAYS_SHOW), SHOW_WHEN_ACTIVE(TitleState.SHOW_WHEN_ACTIVE), ALWAYS_HIDE(TitleState.ALWAYS_HIDE), SHOW_WHEN_ACTIVE_FORCE(TitleState.SHOW_WHEN_ACTIVE_FORCE), UNDEFINED(null);

public static TitleDisplayMode fromString(String mode) {
switch (mode) {
Expand All @@ -17,6 +17,8 @@ public static TitleDisplayMode fromString(String mode) {
return SHOW_WHEN_ACTIVE;
case Constants.ALWAYS_HIDE:
return ALWAYS_HIDE;
case Constants.SHOW_WHEN_ACTIVE_FORCE:
return SHOW_WHEN_ACTIVE_FORCE;
default:
return UNDEFINED;
}
Expand Down Expand Up @@ -45,6 +47,7 @@ public TitleState toState() {
private static class Constants {
static final String ALWAYS_SHOW = "alwaysShow";
static final String SHOW_WHEN_ACTIVE = "showWhenActive";
static final String SHOW_WHEN_ACTIVE_FORCE = "showWhenActiveForce";
static final String ALWAYS_HIDE = "alwaysHide";
}
}
2 changes: 1 addition & 1 deletion lib/src/interfaces/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export interface OptionsBottomTabs {
* Control the text display mode below the tab icon
* #### (Android specific)
*/
titleDisplayMode?: 'alwaysShow' | 'showWhenActive' | 'alwaysHide';
titleDisplayMode?: 'alwaysShow' | 'showWhenActive' | 'alwaysHide' | 'showWhenActiveForce';
/**
* Set the elevation of the Bottom Tabs in dp
* #### (Android specific)
Expand Down

0 comments on commit cf18e2d

Please sign in to comment.