Parcourir la source

Set BottomTabs background color only if it is defined

This change means that in a tab based app, when pushing a screen
which did not declare `tabBarBackgroundColor` - the BottomTabs color
will persist from the previous screen and not be set to the default
color which is white. This eliminates the unwanted BottomTabs
background color change in this specific use case.

closes #409
Guy Carmeli il y a 8 ans
Parent
révision
ec01544bd2

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java Voir le fichier

@@ -332,7 +332,7 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
332 332
     }
333 333
 
334 334
     private class ScreenStackNotFoundException extends RuntimeException {
335
-        public ScreenStackNotFoundException(String navigatorId) {
335
+        ScreenStackNotFoundException(String navigatorId) {
336 336
             super(navigatorId);
337 337
         }
338 338
     }

+ 0
- 1
android/app/src/main/java/com/reactnativenavigation/params/StyleParams.java Voir le fichier

@@ -61,7 +61,6 @@ public class StyleParams {
61 61
 
62 62
     public boolean drawScreenAboveBottomTabs;
63 63
 
64
-    public Color snackbarTextColor;
65 64
     public Color snackbarButtonColor;
66 65
 
67 66
     public boolean bottomTabsHidden;

+ 3
- 3
android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java Voir le fichier

@@ -35,12 +35,12 @@ public class BottomTabs extends AHBottomNavigation {
35 35
     }
36 36
 
37 37
     public void setStyleFromScreen(StyleParams params) {
38
-        setBackgroundColor(params.bottomTabsColor);
39
-
38
+        if (params.bottomTabsColor.hasColor()) {
39
+            setBackgroundColor(params.bottomTabsColor);
40
+        }
40 41
         if (params.bottomTabsButtonColor.hasColor()) {
41 42
             setInactiveColor(params.bottomTabsButtonColor.getColor());
42 43
         }
43
-
44 44
         if (params.selectedBottomTabsButtonColor.hasColor()) {
45 45
             setAccentColor(params.selectedBottomTabsButtonColor.getColor());
46 46
         }