Rocket.Chat.ReactNative/app/containers/StatusBar.tsx

28 lines
678 B
TypeScript
Raw Normal View History

import React from 'react';
2019-03-12 16:23:06 +00:00
import { StatusBar as StatusBarRN } from 'react-native';
import { useTheme } from '../theme';
const supportedStyles = {
'light-content': 'light-content',
'dark-content': 'dark-content'
};
2019-03-12 16:23:06 +00:00
interface IStatusBar {
barStyle?: keyof typeof supportedStyles;
backgroundColor?: string;
}
const StatusBar = ({ barStyle, backgroundColor }: IStatusBar) => {
const { theme, colors } = useTheme();
if (!barStyle) {
barStyle = 'light-content';
if (theme === 'light') {
barStyle = 'dark-content';
}
}
return <StatusBarRN backgroundColor={backgroundColor ?? colors.headerBackground} barStyle={barStyle} animated />;
};
2019-03-12 16:23:06 +00:00
export default StatusBar;