regression: attachment view is changing the color of status bar (#5167)
This commit is contained in:
parent
b23df26d42
commit
0c8b2f565e
|
@ -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();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!barStyle) {
|
if (!barStyle) {
|
||||||
barStyle = 'light-content';
|
barStyle = 'light-content';
|
||||||
if (theme === 'light') {
|
if (theme === 'light') {
|
||||||
barStyle = 'dark-content';
|
barStyle = 'dark-content';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAndroid) {
|
return <StatusBarRN backgroundColor={backgroundColor ?? colors.headerBackground} barStyle={barStyle} animated />;
|
||||||
StatusBarRN.setBackgroundColor(backgroundColor ?? colors.headerBackground);
|
};
|
||||||
}
|
|
||||||
StatusBarRN.setBarStyle(barStyle, true);
|
|
||||||
}, [theme, barStyle, backgroundColor]);
|
|
||||||
|
|
||||||
return <StatusBarRN />;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default StatusBar;
|
export default StatusBar;
|
||||||
|
|
Loading…
Reference in New Issue