Skip to content

feat(tabs): custom drawable/symbol tab-bar icons — tinted, per-tab size, indicator sizing, iOS fallback#4209

Open
stachbial wants to merge 6 commits into
software-mansion:mainfrom
stachbial:@stachbial/native-tab-drawable-icons
Open

feat(tabs): custom drawable/symbol tab-bar icons — tinted, per-tab size, indicator sizing, iOS fallback#4209
stachbial wants to merge 6 commits into
software-mansion:mainfrom
stachbial:@stachbial/native-tab-drawable-icons

Conversation

@stachbial

@stachbial stachbial commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Extends the native bottom tab bar for custom, app-provided icons.

Android (gamma Tabs), on the drawableResource icon:

  • tinted?: boolean (default true) — false keeps the drawable's own colors (wraps it in NoTintDrawable so the bar's tint can't repaint it). Settable per state (normal / selected).
  • drawableIconSize (dp) — per-tab icon size. Material has one bar-wide itemIconSize, so the box becomes the max across tabs and each icon is inset to its own size; unset uses 24dp.
  • tabBarItemActiveIndicatorWidth / tabBarItemActiveIndicatorHeight (dp) on the appearance — bar-wide indicator size, from the focused tab; unset auto-scales to wrap an enlarged icon.

iOS — custom SF Symbol fallback on the tab bar: systemImageNamed: ?: imageNamed:, so a sfSymbol icon resolves an app asset-catalog symbol when it isn't a built-in.

Before & after

Per-tab icon size — drawableIconSize. The wide logo renders at its intended size; the system star stays 24dp.

Before After
default 24dp box per-tab drawableIconSize

Active-indicator size. Reshape the pill to wrap the enlarged icon; shared across tabs.

Before After
default indicator reshaped indicator

Tint — tinted: false. The focused tab keeps the icon's own colors; unfocused falls back to the template tint.

Screen.Recording.2026-06-25.at.12.31.14.mov

iOS showcase: type: 'sfSymbol' with custom icon name supplied via xcasset .symbolset and .imageset (vector image)

react-native-nano-icons-SFSymbols.mp4

Test plan

  • Render the gamma Tabs bar with drawableResource icons on Android: tinted: false keeps a multicolor VectorDrawable's colors; drawableIconSize scales one tab while others stay 24dp; the indicator wraps the enlarged icon.
  • iOS: a custom asset-catalog symbol renders as a tab icon via sfSymbol.
  • Built and ran on Android + iOS (RN 0.83). Minimal repro: CustomNativeBottomTabsIcons.{ios,android}.tsx.

Extend the gamma native bottom tab bar so a drawableResource icon can:
- keep its own colors via tintingMode 'original' (NoTintDrawable)
- size per tab via drawableIconSize (shared max box + per-item inset)
- size the active indicator via activeIndicatorWidth/Height, or auto-scale
…ance

The active indicator is bar-wide in Material (one size for all items), so
exposing it per tab via activeIndicatorWidth/Height was misleading. Move the
size into the standardAppearance struct as tabBarItemActiveIndicatorWidth/Height,
applied from the focused tab like the indicator color, keeping the icon-box
auto-scale fallback. drawableIconSize stays per-tab.
@stachbial stachbial changed the title feat(tabs/android): custom drawable tab-bar icons — original tint, per-tab size, active-indicator sizing feat(tabs): custom drawable/symbol tab-bar icons — tinted, per-tab size, indicator sizing, iOS fallback Jun 28, 2026
…-drawable-icons

# Conflicts:
#	android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreen.kt
#	android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreenViewManager.kt
@stachbial stachbial marked this pull request as ready for review June 30, 2026 15:40
@stachbial

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant