Chore: StatusBar theme and style props (#3906)
* chore: clean status bar and remove useless theme * mend * wip * remove unused props
This commit is contained in:
parent
8a12924904
commit
1a3d2fbc10
|
@ -2,22 +2,27 @@ import React from 'react';
|
||||||
import { StatusBar as StatusBarRN } from 'react-native';
|
import { StatusBar as StatusBarRN } from 'react-native';
|
||||||
|
|
||||||
import { themes } from '../constants/colors';
|
import { themes } from '../constants/colors';
|
||||||
import { withTheme } from '../theme';
|
import { useTheme } from '../theme';
|
||||||
|
|
||||||
|
const supportedStyles = {
|
||||||
|
'light-content': 'light-content',
|
||||||
|
'dark-content': 'dark-content'
|
||||||
|
};
|
||||||
|
|
||||||
interface IStatusBar {
|
interface IStatusBar {
|
||||||
theme?: string;
|
barStyle?: keyof typeof supportedStyles;
|
||||||
barStyle?: any;
|
|
||||||
backgroundColor?: string;
|
backgroundColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatusBar = React.memo(({ theme, barStyle, backgroundColor }: IStatusBar) => {
|
const StatusBar = React.memo(({ barStyle, backgroundColor }: IStatusBar) => {
|
||||||
|
const { theme } = useTheme();
|
||||||
if (!barStyle) {
|
if (!barStyle) {
|
||||||
barStyle = 'light-content';
|
barStyle = 'light-content';
|
||||||
if (theme === 'light') {
|
if (theme === 'light') {
|
||||||
barStyle = 'dark-content';
|
barStyle = 'dark-content';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return <StatusBarRN backgroundColor={backgroundColor ?? themes[theme!].headerBackground} barStyle={barStyle} animated />;
|
return <StatusBarRN backgroundColor={backgroundColor ?? themes[theme].headerBackground} barStyle={barStyle} animated />;
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withTheme(StatusBar);
|
export default StatusBar;
|
||||||
|
|
|
@ -164,7 +164,7 @@ class E2EEncryptionSecurityView extends React.Component<IE2EEncryptionSecurityVi
|
||||||
const { theme } = this.props;
|
const { theme } = this.props;
|
||||||
return (
|
return (
|
||||||
<SafeAreaView testID='e2e-encryption-security-view' style={{ backgroundColor: themes[theme].backgroundColor }}>
|
<SafeAreaView testID='e2e-encryption-security-view' style={{ backgroundColor: themes[theme].backgroundColor }}>
|
||||||
<StatusBar theme={theme} />
|
<StatusBar />
|
||||||
<List.Container>
|
<List.Container>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{this.renderChangePassword()}
|
{this.renderChangePassword()}
|
||||||
|
|
Loading…
Reference in New Issue