Browse Source

Add badge styling options

Guy Carmeli 8 years ago
parent
commit
098f0e509f

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

61
     public Color selectedBottomTabsButtonColor;
61
     public Color selectedBottomTabsButtonColor;
62
     public Color bottomTabsButtonColor;
62
     public Color bottomTabsButtonColor;
63
     public boolean forceTitlesDisplay;
63
     public boolean forceTitlesDisplay;
64
+    public Color bottomTabBadgeTextColor;
65
+    public Color bottomTabBadgeBackgroundColor;
64
 
66
 
65
     public Color navigationBarColor;
67
     public Color navigationBarColor;
66
 }
68
 }

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

47
         result.bottomTabsButtonColor = getColor("bottomTabsButtonColor", getDefaultBottomTabsButtonColor());
47
         result.bottomTabsButtonColor = getColor("bottomTabsButtonColor", getDefaultBottomTabsButtonColor());
48
         result.selectedBottomTabsButtonColor =
48
         result.selectedBottomTabsButtonColor =
49
                 getColor("bottomTabsSelectedButtonColor", getDefaultSelectedBottomTabsButtonColor());
49
                 getColor("bottomTabsSelectedButtonColor", getDefaultSelectedBottomTabsButtonColor());
50
+        result.bottomTabBadgeTextColor = getColor("bottomTabBadgeTextColor", getBottomTabBadgeTextColor());
51
+        result.bottomTabBadgeBackgroundColor = getColor("bottomTabBadgeBackgroundColor", getBottomTabBadgeBackgroundColor());
50
 
52
 
51
         result.navigationBarColor = getColor("navigationBarColor", getDefaultNavigationColor());
53
         result.navigationBarColor = getColor("navigationBarColor", getDefaultNavigationColor());
52
         result.forceTitlesDisplay = getBoolean("forceTitlesDisplay", getDefaultForceTitlesDisplay());
54
         result.forceTitlesDisplay = getBoolean("forceTitlesDisplay", getDefaultForceTitlesDisplay());
82
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedBottomTabsButtonColor;
84
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedBottomTabsButtonColor;
83
     }
85
     }
84
 
86
 
87
+    private StyleParams.Color getBottomTabBadgeTextColor() {
88
+        return new StyleParams.Color();
89
+    }
90
+
91
+    private StyleParams.Color getBottomTabBadgeBackgroundColor() {
92
+        return new StyleParams.Color();
93
+    }
94
+
85
     private StyleParams.Color getDefaultBottomTabsButtonColor() {
95
     private StyleParams.Color getDefaultBottomTabsButtonColor() {
86
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsButtonColor;
96
         return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsButtonColor;
87
     }
97
     }

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

6
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
6
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
7
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
7
 import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
8
 import com.reactnativenavigation.animation.VisibilityAnimator;
8
 import com.reactnativenavigation.animation.VisibilityAnimator;
9
+import com.reactnativenavigation.params.AppStyle;
9
 import com.reactnativenavigation.params.ScreenParams;
10
 import com.reactnativenavigation.params.ScreenParams;
10
 import com.reactnativenavigation.params.StyleParams;
11
 import com.reactnativenavigation.params.StyleParams;
11
 import com.reactnativenavigation.utils.ViewUtils;
12
 import com.reactnativenavigation.utils.ViewUtils;
21
         setForceTint(true);
22
         setForceTint(true);
22
         setId(ViewUtils.generateViewId());
23
         setId(ViewUtils.generateViewId());
23
         createVisibilityAnimator();
24
         createVisibilityAnimator();
25
+        setStyle();
24
     }
26
     }
25
 
27
 
26
     public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
28
     public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
78
             }
80
             }
79
         });
81
         });
80
     }
82
     }
83
+
84
+    private void setStyle() {
85
+        if (AppStyle.appStyle.bottomTabBadgeBackgroundColor.hasColor()) {
86
+            setNotificationBackgroundColor(AppStyle.appStyle.bottomTabBadgeBackgroundColor.getColor());
87
+        }
88
+        if (AppStyle.appStyle.bottomTabBadgeTextColor.hasColor()) {
89
+            setNotificationTextColor(AppStyle.appStyle.bottomTabBadgeTextColor.getColor());
90
+        }
91
+    }
81
 }
92
 }

+ 2
- 0
src/deprecated/platformSpecificDeprecated.android.js View File

134
     bottomTabsHidden: originalStyleObject.tabBarHidden,
134
     bottomTabsHidden: originalStyleObject.tabBarHidden,
135
     bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
135
     bottomTabsHiddenOnScroll: originalStyleObject.bottomTabsHiddenOnScroll,
136
     forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
136
     forceTitlesDisplay: originalStyleObject.forceTitlesDisplay,
137
+    bottomTabBadgeTextColor: originalStyleObject.bottomTabBadgeTextColor,
138
+    bottomTabBadgeBackgroundColor: originalStyleObject.bottomTabBadgeBackgroundColor,
137
 
139
 
138
     navigationBarColor: originalStyleObject.navigationBarColor
140
     navigationBarColor: originalStyleObject.navigationBarColor
139
   }
141
   }