1*1119c2eaS猫头猫import React, {useEffect} from 'react'; 219dc08ecS猫头猫import {StatusBar, StatusBarProps, View} from 'react-native'; 319dc08ecS猫头猫import useColors from '@/hooks/useColors'; 419dc08ecS猫头猫 519dc08ecS猫头猫interface IStatusBarProps extends StatusBarProps {} 619dc08ecS猫头猫 719dc08ecS猫头猫export default function (props: IStatusBarProps) { 819dc08ecS猫头猫 const colors = useColors(); 9*1119c2eaS猫头猫 const {backgroundColor, barStyle} = props; 10*1119c2eaS猫头猫 11*1119c2eaS猫头猫 useEffect(() => { 12*1119c2eaS猫头猫 if (barStyle) { 13*1119c2eaS猫头猫 StatusBar.setBarStyle(barStyle); 14*1119c2eaS猫头猫 } 15*1119c2eaS猫头猫 }, [barStyle]); 1619dc08ecS猫头猫 1719dc08ecS猫头猫 return ( 1819dc08ecS猫头猫 <View 1919dc08ecS猫头猫 style={{ 2020e2869eS猫头猫 zIndex: 10000, 2119dc08ecS猫头猫 position: 'absolute', 2219dc08ecS猫头猫 top: 0, 2319dc08ecS猫头猫 backgroundColor: backgroundColor ?? colors.primary, 244ddc4470S猫头猫 width: '100%', 2519dc08ecS猫头猫 height: StatusBar.currentHeight, 264060c00aS猫头猫 }} 274060c00aS猫头猫 /> 2819dc08ecS猫头猫 ); 2919dc08ecS猫头猫} 30