minor improvement in performance

This commit is contained in:
ammarahm-ed
2020-10-18 13:15:24 +05:00
parent f490e04fd2
commit 5c30d1aa84
21 changed files with 119 additions and 229 deletions

View File

@@ -4,30 +4,21 @@ import * as Animatable from 'react-native-animatable';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {useTracked} from '../../provider';
import {eSendEvent} from '../../services/EventManager';
import NavigationService from '../../services/Navigation';
import {useHideHeader} from '../../utils/Hooks';
import {dWidth} from '../../utils';
import {ActionIcon} from '../ActionIcon';
import {HeaderMenu} from './HeaderMenu';
import {HeaderTitle} from './HeaderTitle';
import {SIZE} from "../../utils/SizeUtils";
import {DDS} from "../../services/DeviceDetection";
import {HeaderLeftMenu} from "./HeaderLeftMenu";
export const Header = ({showSearch, root}) => {
const [state, dispatch] = useTracked();
const {colors, syncing, headerState} = state;
const [state, ] = useTracked();
const {colors, syncing} = state;
const insets = useSafeAreaInsets();
const hideHeader = useHideHeader();
const onLeftButtonPress = () => {
if (!headerState.canGoBack) {
NavigationService.openDrawer();
return;
}
NavigationService.goBack();
};
return (
<View
style={[
@@ -39,20 +30,7 @@ export const Header = ({showSearch, root}) => {
},
]}>
<View style={styles.leftBtnContainer}>
{!DDS.isTab ? (
<ActionIcon
testID="left_menu_button"
customStyle={styles.leftBtn}
onPress={onLeftButtonPress}
name={headerState.canGoBack ? 'arrow-left' : 'menu'}
size={SIZE.xxxl}
color={colors.pri}
iconStyle={{
marginLeft: headerState.canGoBack ? -5 : 0,
}}
/>
) : undefined}
<HeaderLeftMenu/>
{Platform.OS === 'android' ? <HeaderTitle root={root} /> : null}
</View>
{Platform.OS !== 'android' ? <HeaderTitle root={root} /> : null}