xref: /MusicFree/src/components/base/statusBar.tsx (revision 1119c2ea435417cd5c53719f91691ff2b1aa8670)
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        }
15    }, [barStyle]);
16
17    return (
18        <View
19            style={{
20                zIndex: 10000,
21                position: 'absolute',
22                top: 0,
23                backgroundColor: backgroundColor ?? colors.primary,
24                width: '100%',
25                height: StatusBar.currentHeight,
26            }}
27        />
28    );
29}
30