Skip to content

feat(Android,Tabs): support activity indicator #3016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ class TabsHost(
updateNavigationMenuIfNeeded(oldValue, newValue)
}

var tabBarItemActivityIndicatorColor: Int? by Delegates.observable<Int?>(null) { _, oldValue, newValue ->
updateNavigationMenuIfNeeded(oldValue, newValue)
}

var tabBarItemIconColor: Int? by Delegates.observable<Int?>(null) { _, oldValue, newValue ->
updateNavigationMenuIfNeeded(oldValue, newValue)
}
Expand Down Expand Up @@ -297,6 +301,10 @@ class TabsHost(
val iconColors = intArrayOf(iconInactiveColor, iconActiveColor)
bottomNavigationView.itemIconTintList = ColorStateList(states, iconColors)

// ActivityIndicator color
val activityIndicatorColor = tabBarItemActivityIndicatorColor ?: com.google.android.material.R.color.m3_sys_color_dynamic_light_on_secondary_container
bottomNavigationView.itemActiveIndicatorColor = ColorStateList.valueOf(activityIndicatorColor)

// First clean the menu, then populate it
bottomNavigationView.menu.clear()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ class TabsHostViewManager :
view.tabBarItemTitleFontColorActive = value
}

@ReactProp(name = "tabBarItemActivityIndicatorColor", customType = "Color")
override fun setTabBarItemActivityIndicatorColor(
view: TabsHost,
value: Int?,
) {
view.tabBarItemActivityIndicatorColor = value
}

@ReactProp(name = "tabBarItemIconColorActive", customType = "Color")
override fun setTabBarItemIconColorActive(
view: TabsHost,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public void setProperty(T view, String propName, @Nullable Object value) {
case "tabBarItemTitleFontSizeActive":
mViewManager.setTabBarItemTitleFontSizeActive(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "tabBarItemActivityIndicatorColor":
mViewManager.setTabBarItemActivityIndicatorColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
case "controlNavigationStateInJS":
mViewManager.setControlNavigationStateInJS(view, value == null ? false : (boolean) value);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ public interface RNSBottomTabsManagerInterface<T extends View> {
void setTabBarItemTitleFontColorActive(T view, @Nullable Integer value);
void setTabBarItemIconColorActive(T view, @Nullable Integer value);
void setTabBarItemTitleFontSizeActive(T view, float value);
void setTabBarItemActivityIndicatorColor(T view, @Nullable Integer value);
void setControlNavigationStateInJS(T view, boolean value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function BottomTabsContainer(props: BottomTabsContainerProps) {
onNativeFocusChange={onNativeFocusChangeCallback}

tabBarBackgroundColor={Colors.NavyLight100}
tabBarItemActivityIndicatorColor={Colors.GreenLight40}
tabBarTintColor={Colors.YellowLight100}
tabBarItemBadgeBackgroundColor={Colors.GreenDark100}
tabBarItemIconColor={Colors.BlueLight100}
Expand Down
3 changes: 2 additions & 1 deletion src/components/BottomTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export interface BottomTabsProps extends ViewProps {
tabBarItemTitleFontSizeActive?: TextStyle['fontSize'];
tabBarItemTitleFontColorActive?: TextStyle['color'];
tabBarItemIconColorActive?: ColorValue;

tabBarItemActivityIndicatorColor?: ColorValue;

// Control

// Experimental support
Expand Down
1 change: 1 addition & 0 deletions src/fabric/BottomTabsNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface NativeProps extends ViewProps {
tabBarItemTitleFontColorActive?: ColorValue;
tabBarItemIconColorActive?: ColorValue;
tabBarItemTitleFontSizeActive?: Float;
tabBarItemActivityIndicatorColor?: ColorValue;

// Control

Expand Down
Loading