Chrysolites Tech Academy

Short-Video App with React Native and Supabase · Course book

Chapter 4: Designing the Tab Bar

Pairs with Lesson 4: Custom Icons for the Tab Bar

The bottom tab bar is the most-touched part of a social app. Every session starts there, and people switch tabs dozens of times a day without thinking. A good tab bar is instantly readable, shows clearly where you are, gives generous targets for thumbs and gives special prominence to the main action, which in a short-video app is creating a video. This chapter explains how to add icons to the tabs with Expo's vector icon sets, how to show focused and unfocused states, how to size and position icons, how to hide a label and style a special camera button, and how to make the bar accessible, with the layout arithmetic worked out by hand.

Icon sets and how vector icons work

Expo includes a package of popular vector icon sets, such as Ionicons, Feather, MaterialIcons and FontAwesome. Each set is distributed as an icon font: every icon is a character in a font file, drawn as a mathematical outline, so it stays crisp at any size and can be coloured like text. Using one is as simple as importing the set and rendering it with a name, size and colour: <Ionicons name="home" size={24} color="white" />.

Many sets offer several variants of each icon. Ionicons, for example, typically provides a filled version, an -outline version drawn with lines only, and a -sharp version with square corners, such as home, home-outline and home-sharp. Pairing a filled or sharp icon for the selected tab with an outline icon for the others is a widely used convention, because the change in visual weight shows the current tab even to people who cannot easily distinguish colours.

TabPurposeFocused iconUnfocused iconLabel
HomeThe main video feedhome-sharphome-outlineHome
FriendsVideos from mutual followerspeople-sharppeople-outlineFriends
CameraRecord or upload a videoA bold add iconThe same iconHidden
InboxActivity and chatschatbox-sharpchatbox-outlineInbox
ProfileThe user's own pageperson-sharpperson-outlineProfile

Icon names change occasionally between versions of a set, so check the set's directory of icons for the exact names available in your version. Using a single set throughout the bar keeps line weights and proportions consistent, which matters more than it might seem: mixing sets often looks subtly wrong.

Icon fonts are not the only option. Custom icons designed for a brand are often exported as SVG files and rendered with a library that draws SVG in React Native, or turned into components automatically during the build. SVG icons can have several colours and precise shapes that a font cannot, at the cost of a little more setup. Image icons, such as PNG files, are the least flexible, because each size and colour needs its own file, so they are best kept for logos and illustrations. Whatever the format, icons should be loaded before the first screen appears; Expo can preload fonts, including icon fonts, while the splash screen is still showing, so that tabs never flash empty boxes while the font downloads.

Focused and unfocused states

Expo Router's Tabs component accepts options for each screen, including a tabBarIcon function. The tab bar calls it with the tab's current state, including whether it is focused, and the colour and size the bar suggests. The function returns the icon to draw.

<Tabs.Screen
  name="index"
  options={{
    title: "Home",
    tabBarIcon: ({ focused, color, size }) => (
      <Ionicons name={focused ? "home-sharp" : "home-outline"} size={size} color={color} />
    ),
  }}
/>

Colours for the two states are set once on the whole bar with tabBarActiveTintColor and tabBarInactiveTintColor, so every icon and label follows them. A video app's bar usually sits on black, with white for the active tab and a mid grey for the others. Writing a small helper that takes the two icon names and returns the tabBarIcon function avoids repeating the same code five times.

The state shown must match where the user actually is. Because Expo Router derives the focused tab from the current route, this is automatic for the tab screens themselves; but if a screen opened on top of the tabs, such as comments, should still show the Home tab as selected, it needs to be placed in the navigation tree so that the Home tab remains the active route beneath it.

Sizes, spacing and the layout arithmetic

A tab bar divides the screen width equally among its tabs. On a 375-pixel-wide phone with five tabs, each tab is 375 / 5 = 75 pixels wide. Platform guidelines recommend touch targets of at least about 44 points on iOS and 48 density-independent pixels on Android, so a 75-pixel-wide tab is comfortably large horizontally; the height of the bar determines the vertical size.

Worked example. A bar of 50 points plus the device's bottom safe-area inset is common. On a phone with a home indicator, where that inset is often 34 points, the bar occupies 50 + 34 = 84 points of the screen's height. On an 812-point-tall screen, that leaves 812 − 84 = 728 points for the feed above it, before any top inset. A 24-point icon with a 12-point label and 4 points of space between them uses 40 points, leaving 10 points to share as padding above and below inside the 50-point bar. Using a 28-point icon instead would leave only 6 points, which starts to look cramped.
safe-area inset, about 34 pt Home FriendsInboxProfile + 0375 pt75150 50 pt bar five equal tabs of 75 pt; the camera tab hides its label and uses a larger button
Figure 4.1 — The tab bar's geometry on a 375-point phone. Equal 75-point tabs leave generous targets; the safe-area inset keeps icons clear of the home indicator.

Respecting the safe area matters on modern phones. The tab bar component accounts for the bottom inset automatically, but custom bars or absolutely positioned buttons must read the insets themselves, typically with a safe-area hook, or they will sit under the home indicator where taps are unreliable. The inset differs between devices and is zero on phones with a physical home button, so never hard-code it; always read the value the system provides.

The special camera button and hidden labels

Short-video apps give the create action a distinctive button in the centre of the bar: wider than the other icons, often a rounded rectangle with a contrasting fill and a plus sign, and with no label underneath. Two options produce this. Setting tabBarShowLabel to false, or giving that screen an empty title, removes the text; and a custom tabBarIcon can return any view, such as a rounded white box holding a black plus icon, instead of a plain glyph.

Some designs go further and make the centre button open the camera as a full-screen modal rather than as a normal tab, so the camera covers the tab bar while recording. That is handled by intercepting the tab press: a listener on the camera tab prevents the default switch and instead navigates to a modal camera screen. Either way, keep the button's touch area at least as large as the other tabs, and give it an accessible label such as "Create video", because a bare plus sign means nothing to a screen reader.

Accessibility and finishing touches

Tabs are announced by screen readers using their titles, so every tab needs a meaningful title even when its label is hidden. The tabBarAccessibilityLabel option sets a fuller description where helpful, such as "Inbox, 3 unread". Colour contrast matters too: grey inactive icons on a black bar should still be clearly visible, aiming for a contrast ratio of at least 3 to 1 for icons, the level recommended for meaningful graphics.

Several small touches make the bar feel polished. A badge, set with the tabBarBadge option, can show the number of unread messages on the Inbox tab. A light haptic tap when switching tabs, using Expo's haptics library, makes the bar feel responsive on devices that support it. Matching the bar's background to the screen above it, black on the video feed, avoids a visible seam. And tapping the already-selected Home tab is commonly used to scroll the feed back to the top, a behaviour people expect from social apps, and one that is easy to add with a listener on the tab.

Testing on both platforms is essential, because iOS and Android draw tab bars a little differently, from label fonts to the default height. Check the bar on a small phone, where five labels may crowd together, and on a large one, where icons can look lost; adjusting icon sizes slightly for each, or hiding labels on very narrow screens, keeps the bar balanced everywhere.

Practice tasks

  1. How wide is each tab on a 414-point-wide phone with five tabs? With four?
  2. A bar is 56 points tall and the bottom inset is 34 points. How much of an 844-point screen remains above the bar?
  3. Inside a 50-point bar, a 26-point icon and a 12-point label have 4 points between them. How much padding is left above and below?
  4. Write a helper function that takes a focused and an unfocused icon name and returns a tabBarIcon function.
  5. Explain why an outline-versus-filled icon change is better than a colour change alone for showing the current tab.
  6. Describe two ways to make the camera tab open a full-screen recording screen that hides the tab bar.

Install Chrysolites Tech Academy

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.