This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 52).

Expo StatusBar iconExpo StatusBar

GitHub

npm

A library that provides the same interface as the React Native StatusBar API, but with slightly different defaults to work great in Expo environments.

Android
iOS
Web

expo-status-bar gives you a component and imperative interface to control the app status bar to change its text color, background color, hide it, make it translucent or opaque, and apply animations to any of these changes. Exactly what you are able to do with the StatusBar component depends on the platform you're using.

Web support

There is no API available on the web for controlling the operating system status bar, so expo-status-bar will no-op, so it will do nothing and will not error.

Installation

Terminal
- npx expo install expo-status-bar

If you are installing this in an existing React Native app, start by installing expo in your project. Then, follow the additional instructions as mentioned by the library's README under "Installation in bare React Native projects" section.

Usage

Example
import { StyleSheet, Text, View } from 'react-native';
import { StatusBar } from 'expo-status-bar';

export default function App() {
  return (
    <View style={styles.container}>
      <Text style={styles.text}>Notice that the status bar has light text!</Text>
      <StatusBar style="light" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#000',
    alignItems: 'center',
    justifyContent: 'center',
  },
  text: {
    color: '#fff',
  },
});

API

import { StatusBar } from 'expo-status-bar';

Component

StatusBar

Type: React.Element<StatusBarProps>

A component that allows you to configure your status bar without directly calling imperative methods like setBarStyle.

You will likely have multiple StatusBar components mounted in the same app at the same time. For example, if you have multiple screens in your app, you may end up using one per screen. The props of each StatusBar component will be merged in the order that they were mounted. This component is built on top of the StatusBar component exported from React Native, and it provides defaults that work better for Expo users.

Android
iOS
Web

animated

Optional • Type: boolean

If the transition between status bar property changes should be animated. Supported for backgroundColor, barStyle and hidden.

Android

backgroundColor

Optional • Type: string

The background color of the status bar.

Android
iOS
Web

hidden

Optional • Type: boolean

If the status bar is hidden.

iOS

hideTransitionAnimation

Optional • Type: StatusBarAnimation • Default: 'fade'

The transition effect when showing and hiding the status bar using the hidden prop.

iOS

networkActivityIndicatorVisible

Optional • Type: boolean

If the network activity indicator should be visible.

Android
iOS
Web

style

Optional • Type: StatusBarStyle • Default: 'auto'

Sets the color of the status bar text. Default value is "auto" which picks the appropriate value according to the active color scheme, eg: if your app is dark mode, the style will be "light".

Android

translucent

Optional • Type: boolean

If the status bar is translucent. When translucent is set to true, the app will draw under the status bar. This is the default behaviour in projects created with Expo tools because it is consistent with iOS.

Methods

Android
iOS
Web

StatusBar.setStatusBarBackgroundColor(color, animated)

ParameterTypeDescription
colorColorValue

Background color.

animated
(optional)
boolean

Animate the style change.


Set the background color for the status bar

Returns:

void

Android
iOS
Web

StatusBar.setStatusBarHidden(hidden, animation)

ParameterTypeDescription
hiddenboolean

The dialog's title.

animation
(optional)
StatusBarAnimation

Optional animation when changing the status bar hidden property.


Show or hide the status bar

Returns:

void

Android
iOS
Web

StatusBar.setStatusBarNetworkActivityIndicatorVisible(visible)

ParameterTypeDescription
visibleboolean

Show the indicator.


Control the visibility of the network activity indicator

Returns:

void

Android
iOS
Web

StatusBar.setStatusBarStyle(style, animated)

ParameterTypeDescription
styleStatusBarStyle

The color of the status bar text.

animated
(optional)
boolean

If the transition should be animated.


Set the bar style of the status bar.

Returns:

void

Android
iOS
Web

StatusBar.setStatusBarTranslucent(translucent)

ParameterTypeDescription
translucentboolean

Set as translucent.


Control the translucency of the status bar

Returns:

void

Types

Android
iOS
Web

StatusBarAnimation

Literal Type: string

Acceptable values are: 'none' | 'fade' | 'slide'

Android
iOS
Web

StatusBarStyle

Literal Type: string

Acceptable values are: 'auto' | 'inverted' | 'light' | 'dark'