The StatusBar component in React Native allows you to control the appearance of the device’s status bar such as background color, text color, visibility, and transparency. It helps create immersive and platform-consistent mobile UI experiences.
The StatusBar component is imported from react-native and used inside your component tree. On Android, you can change background color and translucency, while on iOS you mainly control text style and visibility.
// Import StatusBar from react-native
import { StatusBar } from "react-native";
// Basic StatusBar usage
<StatusBar barStyle="dark-content" />
// Full example demonstrating StatusBar customization
import React from "react";
import { View, Text, StatusBar } from "react-native";
export default function App() {
return (
<View style={{{ flex: 1, backgroundColor: "#2563eb", justifyContent: "center", alignItems: "center" }}}>
<StatusBar backgroundColor="#2563eb" barStyle="light-content" />
<Text style={{{ color: "white", fontSize: 18 }}}>StatusBar Example</Text>
</View>
);
}
The status bar background becomes blue on Android, and the text/icons turn white. On iOS, only the text color changes to light, matching the app’s visual theme.
Use the controls below to simulate how the StatusBar props affect the mobile UI. Change the background color and the content style (text color) to see the generated React Native code.
The status bar above reacts to your changes instantly.
light-content on dark backgroundstranslucent on Android