Skip to main content

StatusBar

Component to control the app status bar.

Usage with Navigatorโ€‹

It is possible to have multiple StatusBar components mounted at the same time. The props will be merged in the order the StatusBar components were mounted.

Imperative APIโ€‹

For cases where using a component is not ideal, there is also an imperative API exposed as static functions on the component. It is however not recommended to use the static API and the component for the same prop because any value set by the static API will get overridden by the one set by the component in the next render.


Reference

Constantsโ€‹

currentHeight
Android
โ€‹

The height of the status bar, which includes the notch height, if present.


Propsโ€‹

animatedโ€‹

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

TypeRequiredDefault
booleanNofalse

backgroundColor
Android
โ€‹

The background color of the status bar.

TypeRequiredDefault
colorNodefault system StatusBar background color, or 'black' if not defined

barStyleโ€‹

Sets the color of the status bar text.

On Android, this will only have an impact on API versions 23 and above.

TypeRequiredDefault
StatusBarStyleNo'default'

hiddenโ€‹

If the status bar is hidden.

TypeRequiredDefault
booleanNofalse

networkActivityIndicatorVisible
iOS
โ€‹

If the network activity indicator should be visible.

TypeDefault
booleanfalse

showHideTransition
iOS
โ€‹

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

TypeDefault
StatusBarAnimation'fade'

translucent
Android
โ€‹

If the status bar is translucent. When translucent is set to true, the app will draw under the status bar. This is useful when using a semi transparent status bar color.

TypeDefault
booleanfalse

Methodsโ€‹

popStackEntry()โ€‹

static popStackEntry(entry: any)

Get and remove the last StatusBar entry from the stack.

Parameters:

NameTypeDescription
entry
Required
anyEntry returned from pushStackEntry.

pushStackEntry()โ€‹

static pushStackEntry(props: any)

Push a StatusBar entry onto the stack. The return value should be passed to popStackEntry when complete.

Parameters:

NameTypeDescription
props
Required
anyObject containing the StatusBar props to use in the stack entry.

replaceStackEntry()โ€‹

static replaceStackEntry(entry: any, props: any)

Replace an existing StatusBar stack entry with new props.

Parameters:

NameTypeDescription
entry
Required
anyEntry returned from pushStackEntry to replace.
props
Required
anyObject containing the StatusBar props to use in the replacement stack entry.

setBackgroundColor()
Android
โ€‹

static setBackgroundColor(color: string, [animated]: boolean)

Set the background color for the status bar.

Parameters:

NameTypeDescription
color
Required
stringBackground color.
animatedbooleanAnimate the style change.

setBarStyle()โ€‹

static setBarStyle(style: StatusBarStyle, [animated]: boolean)

Set the status bar style.

Parameters:

NameTypeDescription
style
Required
StatusBarStyleStatus bar style to set.
animatedbooleanAnimate the style change.

setHidden()โ€‹

static setHidden(hidden: boolean, [animation]: StatusBarAnimation)

Show or hide the status bar.

Parameters:

NameTypeDescription
hidden
Required
booleanHide the status bar.
animation
iOS
StatusBarAnimationAnimation when changing the status bar hidden property.

setNetworkActivityIndicatorVisible()
iOS
โ€‹

static setNetworkActivityIndicatorVisible(visible: boolean)

Control the visibility of the network activity indicator.

Parameters:

NameTypeDescription
visible
Required
booleanShow the indicator.

setTranslucent()
Android
โ€‹

static setTranslucent(translucent: boolean)

Control the translucency of the status bar.

Parameters:

NameTypeDescription
translucent
Required
booleanSet as translucent.

Type Definitionsโ€‹

StatusBarAnimationโ€‹

Status bar animation type for transitions on the iOS.

Type
enum

Constants:

ValueTypeDescription
'fade'stringFade animation
'slide'stringSlide animation
'none'stringNo animation

StatusBarStyleโ€‹

Status bar style type.

Type
enum

Constants:

ValueTypeDescription
'default'stringDefault status bar style (dark for iOS, light for Android)
'light-content'stringDark background, white texts and icons
'dark-content'stringLight background, dark texts and icons (requires API>=23 on Android)