I'm facing a persistent Status Bar issue in my React Native app using Expo. The Status Bar displays correctly during development and on first app install, but becomes white with unreadable content after killing and reopening the APK.
The Problem:
✅ Works fine in development (
npx expo run:android)✅ Works on first APK launch after installation
❌ Fails after killing app and reopening - Status Bar turns completely white
✅ Manually changing theme fixes it temporarily
What I've Tried:
Using
expo-status-barwith style and backgroundColor propsImplementing
AppStatelistener to detect app foreground stateAdding timeouts to force status bar updates
The theme context works correctly (proven by manual theme change fixing it)
Here's my currentApp.tsximplementation:import { NavigationContainer } from "@react-navigation/native"; import { StatusBar } from "expo-status-bar"; import { AppState, Platform, useRef, useEffect } from "react-native"; import { SafeAreaProvider } from "react-native-safe-area-context"; import RootNavigator from "./src/navigation/RootNavigator"; import { ThemeProvider, useTheme } from "./src/shared/contexts/ThemeContext"; const ThemedStatusBar = () => { const { isDarkMode, theme } = useTheme(); const appState = useRef(AppState.currentState); useEffect(() => { const subscription = AppState.addEventListener('change', nextAppState => { if (appState.current.match(/inactive|background/) && nextAppState === 'active') { if (Platform.OS === 'android') { setTimeout(() => { // Attempt to force status bar update }, 100); } } appState.current = nextAppState; }); return () => subscription.remove(); }, [isDarkMode, theme]); return ( <StatusBar style={isDarkMode ? "light" : "dark"} backgroundColor={theme.colors.background} /> ); }; function Main() { return ( <SafeAreaProvider> <NavigationContainer> <ThemedStatusBar /> <RootNavigator /> </NavigationContainer> </SafeAreaProvider> ); } export default function App() { return ( <ThemeProvider> <Main /> </ThemeProvider> ); }What I need help with:
What is the correct approach to ensure the Status Bar style persists correctly when the app is reopened from a killed state? The theme context is available and working, but the Status Bar doesn't initialize properly on cold starts.