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:
Gleidson Daniel Silva 2022-03-21 16:10:11 -03:00 committed by GitHub
parent 8a12924904
commit 1a3d2fbc10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -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;

View File

@ -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()}