Skip to content

Commit 20735d4

Browse files
m1gacb1kenobi
andauthored
fix(android): touchFeedbackColor not working for a bottomNavigation tab (#14003)
Co-authored-by: Chris Barber <[email protected]>
1 parent 90c4d1f commit 20735d4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,17 @@ public void updateTabBackgroundDrawable(int index)
344344
try {
345345
// BottomNavigationMenuView rebuilds itself after adding a new item, so we need to reset the colors each time.
346346
TiViewProxy tabProxy = tabs.get(index).getProxy();
347-
if (hasCustomBackground(tabProxy) || hasCustomIconTint(tabProxy)) {
347+
boolean hasTouchFeedbackColor = tabProxy.hasPropertyAndNotNull(TiC.PROPERTY_TOUCH_FEEDBACK_COLOR);
348+
if (hasCustomBackground(tabProxy) || hasCustomIconTint(tabProxy) || hasTouchFeedbackColor) {
348349
BottomNavigationMenuView bottomMenuView =
349350
((BottomNavigationMenuView) this.mBottomNavigationView.getChildAt(0));
350351
Drawable drawable = createBackgroundDrawableForState(tabProxy, android.R.attr.state_checked);
351-
drawable = new RippleDrawable(createRippleColorStateListFrom(getActiveColor(tabProxy)), drawable, null);
352+
int color = getActiveColor(tabProxy);
353+
if (hasTouchFeedbackColor) {
354+
color = TiConvert.toColor(tabProxy.getProperty(TiC.PROPERTY_TOUCH_FEEDBACK_COLOR),
355+
tabProxy.getActivity());
356+
}
357+
drawable = new RippleDrawable(createRippleColorStateListFrom(color), drawable, null);
352358
bottomMenuView.getChildAt(index).setBackground(drawable);
353359
}
354360
} catch (Exception e) {

0 commit comments

Comments
 (0)