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

29 lines
735 B
TypeScript
Raw Normal View History

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';
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 = React.memo(({ barStyle, backgroundColor }: IStatusBar) => {
const { theme } = useTheme();
if (!barStyle) {
barStyle = 'light-content';
if (theme === 'light') {
barStyle = 'dark-content';
}
2019-03-12 16:23:06 +00:00
}
return <StatusBarRN backgroundColor={backgroundColor ?? themes[theme].headerBackground} barStyle={barStyle} animated />;
2019-03-12 16:23:06 +00:00
});
export default StatusBar;