2019-03-12 16:23:06 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StatusBar as StatusBarRN } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { isIOS } from '../utils/deviceInfo';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../constants/colors';
|
2019-03-12 16:23:06 +00:00
|
|
|
|
2020-06-26 20:22:56 +00:00
|
|
|
const StatusBar = React.memo(({ theme, barStyle, backgroundColor }) => {
|
|
|
|
if (!barStyle) {
|
|
|
|
barStyle = 'light-content';
|
|
|
|
if (theme === 'light' && isIOS) {
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
StatusBar.propTypes = {
|
2020-06-26 20:22:56 +00:00
|
|
|
theme: PropTypes.string,
|
|
|
|
barStyle: PropTypes.string,
|
|
|
|
backgroundColor: PropTypes.string
|
2019-03-12 16:23:06 +00:00
|
|
|
};
|
|
|
|
|
2020-06-15 14:00:46 +00:00
|
|
|
export default StatusBar;
|