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

29 lines
732 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';
import { themes } from '../lib/constants';
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;