Command palette

@yasinsensoy/native

React Native · Components

SystemBars

Sets the bars declaratively.

8 exports

Import

import { SystemBars, resolveSystemBars, setSystemBars } from "@yasinsensoy/native";

SystemBars

component

Sets the bars declaratively. Put it inside a screen: it applies while the screen is open, and the previous setting returns when it closes. If several are mounted the last mounted wins (field by field). "auto" follows the app theme (UIProvider).

On Android and iOS the app draws edge-to-edge; the bar background is the content itself. To keep content out from under the bars use the safe area (@yasinsensoy/native/safe-area).

SystemBars({ style, hidden }: SystemBarsProps): null

Merges the layers: the field given by the upper layer wins.

resolveSystemBars(stack: readonly SystemBarsLayer[], root?: SystemBarsProps): ResolvedSystemBars

Sets the bars imperatively (the base layer). Mounted <SystemBars> components override it in the fields they give.

setSystemBars(props: SystemBarsProps): void

Color of the bar icons:

  • "light": light (white) icons; for a dark background.
  • "dark": dark icons; for a light background.
  • "auto": by the app theme (UIProvider; otherwise the system theme); light icons in the dark theme.
type SystemBarStyle = "auto" | "light" | "dark"

PerBar

type

One value or a separate value per bar.

type PerBar = T | { statusBar?: T; navigationBar?: T; }

Setting of SystemBars and setSystemBars.

NameTypeDescription
style?PerBar<SystemBarStyle>Icon color.
hidden?PerBar<boolean>Hide. On Android a hidden bar appears temporarily when swiping from the edge; on iOS the navigation bar's counterpart is the home indicator (it fades after a while).

Resolved state sent to the native side.

NameTypeDescription
statusBarStyle"light" | "dark"Status bar icon color.
navigationBarStyle"light" | "dark"Navigation bar icon color.
statusBarHiddenbooleanWhether the status bar is hidden.
navigationBarHiddenbooleanWhether the navigation bar is hidden.

One <SystemBars> layer.

NameTypeDescription
propsSystemBarsPropsProps of the layer.
scheme"light" | "dark" | undefinedTheme used to resolve "auto".