import * as React from 'react' import styled, { useTheme } from 'styled-components/native' import { OButton, OIcon, OText } from '../shared' import { Platform, TextStyle, ViewStyle, I18nManager, TouchableOpacity } from 'react-native' import AntDesignIcon from 'react-native-vector-icons/AntDesign' const TitleWrapper = styled.View` flex-direction: column; padding-horizontal: 10px; ` const TitleTopWrapper = styled.View` flex-direction: row; align-items: center; ` const btnBackArrow = { borderWidth: 0, backgroundColor: '#FFF', borderColor: '#fff', shadowColor: '#FFF', paddingLeft: 30, paddingRight: 30 } interface Props { navigation?: any, route?: any, title?: string, subTitle?: any, titleColor?: string, titleAlign?: any, withIcon?: boolean, icon?: any, leftImg?: any, isBackStyle?: boolean, onActionLeft?: () => void, onRightAction?: () => void, showCall?: boolean, titleStyle?: TextStyle, btnStyle?: TextStyle, style?: ViewStyle, titleWrapStyle?: ViewStyle, paddingTop?: number, isVertical?: boolean, noMargin?: any hideArrowLeft?: boolean } const NavBar = (props: Props) => { const theme = useTheme(); const Wrapper = styled.View` background-color: ${theme.colors.white}; padding: 10px 20px 20px 0px; flex-direction: row; position: relative; ` const goSupport = () => { props.navigation.navigate('Supports', {}); } return ( {!props.hideArrowLeft && ( )} {props.withIcon ? ( ) : null } {props.title || ''} {props.subTitle ? (props.subTitle) : null } {props.showCall ? () : null } ) } NavBar.defaultProps = { title: '', textAlign: 'center' }; const areEqual = (prevProps: { route?: any, title?: string }, nextProps: { route?: any, title?: string }) => { return prevProps.route === nextProps.route && JSON.stringify(prevProps.title) === JSON.stringify(nextProps.title) return true } export default React.memo(NavBar, areEqual);