Skip to content

Android Navigation Bar

expo-navigation-bar


A function to set the android navigation bar’s content color based on the theme.

Installation

Install expo-navigation-bar dependencies

Terminal window
npx expo install expo-navigation-bar

Copy/paste the following code to ~/lib/android-navigation-bar.tsx:

Whenever you set the color scheme, call the function to update the navigation bar

Example

The showcase app uses it in 2 places:

  1. In the root _layout.tsx to set the navigation bar color upon app load: see the code

  2. In the ThemeToggle component to set the navigation bar color when the theme is changed: see the code