2019-03-12 16:23:06 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StatusBar as StatusBarRN } from 'react-native';
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../constants/colors';
|
2020-10-30 13:59:44 +00:00
|
|
|
import { withTheme } from '../theme';
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IStatusBar {
|
|
|
|
theme: string;
|
|
|
|
barStyle: any;
|
|
|
|
backgroundColor: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const StatusBar = React.memo(({ theme, barStyle, backgroundColor }: IStatusBar) => {
|
2020-06-26 20:22:56 +00:00
|
|
|
if (!barStyle) {
|
|
|
|
barStyle = 'light-content';
|
2020-07-06 20:56:28 +00:00
|
|
|
if (theme === 'light') {
|
2020-06-26 20:22:56 +00:00
|
|
|
barStyle = 'dark-content';
|
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
}
|
2020-06-26 20:22:56 +00:00
|
|
|
return <StatusBarRN backgroundColor={backgroundColor ?? themes[theme].headerBackground} barStyle={barStyle} animated />;
|
2019-03-12 16:23:06 +00:00
|
|
|
});
|
|
|
|
|
2020-10-30 13:59:44 +00:00
|
|
|
export default withTheme(StatusBar);
|