1import React, {useEffect} from 'react'; 2import {StatusBar, StatusBarProps, View} from 'react-native'; 3import useColors from '@/hooks/useColors'; 4 5interface IStatusBarProps extends StatusBarProps {} 6 7export default function (props: IStatusBarProps) { 8 const colors = useColors(); 9 const {backgroundColor, barStyle} = props; 10 11 useEffect(() => { 12 if (barStyle) { 13 StatusBar.setBarStyle(barStyle); 14 } else { 15 StatusBar.setBarStyle('light-content'); 16 } 17 }, [barStyle]); 18 19 return ( 20 <View 21 style={{ 22 zIndex: 10000, 23 position: 'absolute', 24 top: 0, 25 backgroundColor: 26 backgroundColor ?? colors.appBar ?? colors.primary, 27 width: '100%', 28 height: StatusBar.currentHeight, 29 }} 30 /> 31 ); 32} 33