regression: attachment view is changing the color of status bar (#5167)

This commit is contained in:
Reinaldo Neto 2023-08-14 15:11:45 -03:00 committed by GitHub
parent b23df26d42
commit 0c8b2f565e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 18 deletions

View File

@ -1,8 +1,7 @@
import React, { useEffect } from 'react';
import React from 'react';
import { StatusBar as StatusBarRN } from 'react-native';
import { useTheme } from '../theme';
import { isAndroid } from '../lib/methods/helpers';
const supportedStyles = {
'light-content': 'light-content',
@ -14,23 +13,15 @@ interface IStatusBar {
backgroundColor?: string;
}
const StatusBar = React.memo(({ barStyle, backgroundColor }: IStatusBar) => {
const StatusBar = ({ barStyle, backgroundColor }: IStatusBar) => {
const { theme, colors } = useTheme();
useEffect(() => {
if (!barStyle) {
barStyle = 'light-content';
if (theme === 'light') {
barStyle = 'dark-content';
}
if (!barStyle) {
barStyle = 'light-content';
if (theme === 'light') {
barStyle = 'dark-content';
}
if (isAndroid) {
StatusBarRN.setBackgroundColor(backgroundColor ?? colors.headerBackground);
}
StatusBarRN.setBarStyle(barStyle, true);
}, [theme, barStyle, backgroundColor]);
return <StatusBarRN />;
});
}
return <StatusBarRN backgroundColor={backgroundColor ?? colors.headerBackground} barStyle={barStyle} animated />;
};
export default StatusBar;