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