Bladeren bron

Make tabBarHideShadow to be configurable on Android (#2990)

Tetsuro Mikami 6 jaren geleden
bovenliggende
commit
033cb61b2d

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java Bestand weergeven

@@ -145,6 +145,7 @@ public class StyleParams {
145 145
     public int bottomTabsInitialIndex;
146 146
     public boolean bottomTabsHidden;
147 147
     public boolean bottomTabsHiddenOnScroll;
148
+    public boolean bottomTabsHideShadow;
148 149
     public Color bottomTabsColor;
149 150
     public Color selectedBottomTabsButtonColor;
150 151
     public Color bottomTabsButtonColor;

+ 2
- 0
android/app/src/main/java/com/reactnativenavigation/params/parsers/StyleParamsParser.java Bestand weergeven

@@ -86,6 +86,8 @@ public class StyleParamsParser {
86 86
 
87 87
         result.bottomTabsInitialIndex = getInt("initialTabIndex", 0);
88 88
         result.bottomTabsHidden = getBoolean("bottomTabsHidden", getDefaultBottomTabsHidden());
89
+        result.bottomTabsHideShadow = getBoolean("bottomTabsHideShadow", false);
90
+
89 91
         result.drawScreenAboveBottomTabs = !result.bottomTabsHidden &&
90 92
                                            params.getBoolean("drawScreenAboveBottomTabs", getDefaultDrawScreenAboveBottomTabs());
91 93
         if (result.titleBarHideOnScroll) {

+ 5
- 0
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java Bestand weergeven

@@ -27,6 +27,7 @@ public class BottomTabs extends AHBottomNavigation {
27 27
         setStyle();
28 28
         setFontFamily();
29 29
         setFontSize();
30
+        setTabsHideShadow();
30 31
     }
31 32
 
32 33
     public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
@@ -163,4 +164,8 @@ public class BottomTabs extends AHBottomNavigation {
163 164
             setTitleTextSizeInSp(AppStyle.appStyle.bottomTabSelectedFontSize, AppStyle.appStyle.bottomTabFontSize);
164 165
         }
165 166
     }
167
+
168
+    private void setTabsHideShadow() {
169
+        setUseElevation(!AppStyle.appStyle.bottomTabsHideShadow);
170
+    }
166 171
 }

+ 2
- 1
docs/styling-the-tab-bar.md Bestand weergeven

@@ -24,7 +24,7 @@ Navigation.startTabBasedApp({
24 24
   tabBarLabelColor: '#ffb700', // iOS only. change the color of tab text
25 25
   tabBarSelectedLabelColor: 'red', // iOS only. change the color of the selected tab text
26 26
   forceTitlesDisplay: true, // Android only. If true - Show all bottom tab labels. If false - only the selected tab's label is visible.
27
-  tabBarHideShadow: true // iOS only. Remove default tab bar top shadow (hairline)
27
+  tabBarHideShadow: true // Remove default tab bar top shadow (hairline)
28 28
 }
29 29
 ```
30 30
 
@@ -36,6 +36,7 @@ Navigation.startTabBasedApp({
36 36
   appStyle: {
37 37
     tabBarBackgroundColor: '#0f2362',
38 38
     tabBarButtonColor: '#ffffff',
39
+    tabBarHideShadow: true,
39 40
     tabBarSelectedButtonColor: '#63d7cc',
40 41
     tabBarTranslucent: false,
41 42
     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)

+ 1
- 0
src/deprecated/platformSpecificDeprecated.android.js Bestand weergeven

@@ -224,6 +224,7 @@ function convertStyleParams(originalStyleObject) {
224 224
     bottomTabsSelectedButtonColor: processColor(originalStyleObject.tabBarSelectedButtonColor),
225 225
     bottomTabsHidden: originalStyleObject.tabBarHidden,
226 226
     bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
227
+    bottomTabsHideShadow: originalStyleObject.tabBarHideShadow,
227 228
     forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
228 229
     bottomTabBadgeTextColor: processColor(originalStyleObject.bottomTabBadgeTextColor),
229 230
     bottomTabBadgeBackgroundColor: processColor(originalStyleObject.bottomTabBadgeBackgroundColor),