import React from 'react'; import {Platform, StatusBar, Text, TouchableOpacity, View} from 'react-native'; import * as Animatable from 'react-native-animatable'; import Icon from 'react-native-vector-icons/Feather'; import {DDS} from '../../../App'; import {SIZE, WEIGHT} from '../../common/common'; import {useTracked} from '../../provider'; import {eSendEvent} from '../../services/eventManager'; import {eCloseLoginDialog} from '../../services/events'; import NavigationService from '../../services/NavigationService'; import {SideMenuEvent} from '../../utils/utils'; import {moveNoteHideEvent} from '../DialogManager'; let isOpen = false; export const Header = ({ heading, canGoBack = true, hide, showSearch, menu, verticalMenu = false, sendHeight = e => {}, preventDefaultMargins, navigation = null, isLoginNavigator, }) => { const [state, dispatch] = useTracked(); const {colors} = state; return ( {canGoBack ? ( { if (navigation && preventDefaultMargins) { if (navigation.state.routeName === 'Folders') { moveNoteHideEvent(); } else { navigation.goBack(); } } else if (navigation && isLoginNavigator) { if (navigation.state.routeName === 'Login') { eSendEvent(eCloseLoginDialog); } else { navigation.goBack(); } } else { NavigationService.goBack(); } }} style={{ justifyContent: 'center', alignItems: 'flex-start', height: 40, width: 50, marginTop: 2.5, }}> ) : ( undefined )} {menu && !DDS.isTab ? ( { SideMenuEvent.open(); }} style={{ justifyContent: 'center', alignItems: 'flex-start', height: 40, marginTop: 2.5, width: 60, }}> ) : ( undefined )} {heading} showSearch()} style={{ justifyContent: 'center', alignItems: 'flex-end', height: 40, width: 60, paddingRight: 0, }}> {verticalMenu ? ( ) : null} ); };