Browse Source

Make tabBarHideShadow to be configurable on Android (#2990)

Tetsuro Mikami 6 years ago
parent
commit
033cb61b2d

+ 1
- 0
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java View File

145
     public int bottomTabsInitialIndex;
145
     public int bottomTabsInitialIndex;
146
     public boolean bottomTabsHidden;
146
     public boolean bottomTabsHidden;
147
     public boolean bottomTabsHiddenOnScroll;
147
     public boolean bottomTabsHiddenOnScroll;
148
+    public boolean bottomTabsHideShadow;
148
     public Color bottomTabsColor;
149
     public Color bottomTabsColor;
149
     public Color selectedBottomTabsButtonColor;
150
     public Color selectedBottomTabsButtonColor;
150
     public Color bottomTabsButtonColor;
151
     public Color bottomTabsButtonColor;

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

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

+ 5
- 0
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java View File

27
         setStyle();
27
         setStyle();
28
         setFontFamily();
28
         setFontFamily();
29
         setFontSize();
29
         setFontSize();
30
+        setTabsHideShadow();
30
     }
31
     }
31
 
32
 
32
     public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
33
     public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
163
             setTitleTextSizeInSp(AppStyle.appStyle.bottomTabSelectedFontSize, AppStyle.appStyle.bottomTabFontSize);
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 View File

24
   tabBarLabelColor: '#ffb700', // iOS only. change the color of tab text
24
   tabBarLabelColor: '#ffb700', // iOS only. change the color of tab text
25
   tabBarSelectedLabelColor: 'red', // iOS only. change the color of the selected tab text
25
   tabBarSelectedLabelColor: 'red', // iOS only. change the color of the selected tab text
26
   forceTitlesDisplay: true, // Android only. If true - Show all bottom tab labels. If false - only the selected tab's label is visible.
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
   appStyle: {
36
   appStyle: {
37
     tabBarBackgroundColor: '#0f2362',
37
     tabBarBackgroundColor: '#0f2362',
38
     tabBarButtonColor: '#ffffff',
38
     tabBarButtonColor: '#ffffff',
39
+    tabBarHideShadow: true,
39
     tabBarSelectedButtonColor: '#63d7cc',
40
     tabBarSelectedButtonColor: '#63d7cc',
40
     tabBarTranslucent: false,
41
     tabBarTranslucent: false,
41
     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)
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 View File

224
     bottomTabsSelectedButtonColor: processColor(originalStyleObject.tabBarSelectedButtonColor),
224
     bottomTabsSelectedButtonColor: processColor(originalStyleObject.tabBarSelectedButtonColor),
225
     bottomTabsHidden: originalStyleObject.tabBarHidden,
225
     bottomTabsHidden: originalStyleObject.tabBarHidden,
226
     bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
226
     bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
227
+    bottomTabsHideShadow: originalStyleObject.tabBarHideShadow,
227
     forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
228
     forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
228
     bottomTabBadgeTextColor: processColor(originalStyleObject.bottomTabBadgeTextColor),
229
     bottomTabBadgeTextColor: processColor(originalStyleObject.bottomTabBadgeTextColor),
229
     bottomTabBadgeBackgroundColor: processColor(originalStyleObject.bottomTabBadgeBackgroundColor),
230
     bottomTabBadgeBackgroundColor: processColor(originalStyleObject.bottomTabBadgeBackgroundColor),