import * as React from 'react' import styled from 'styled-components/native' import { OIcon, OButton, OText } from '../shared' import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native' import { useConfig, useLanguage, useOrder } from 'ordering-components/native' import { useTheme } from 'styled-components/native' const Wrapper = styled.View` background-color: ${(props: any) => props.theme.colors.white}; padding: 10px 0px 20px 0px; flex-direction: row; justify-content: center; align-items: center; position: relative; border-bottom-color: #E1E8ED; border-bottom-width: 1px; margin-top: ${Platform.OS === 'ios' ? '10px' : '0px'}; ` const TitleWrapper = styled.View` flex-direction: column; padding-horizontal: 10px; ` const TitleTopWrapper = styled.View` flex-grow: 1; flex-direction: row; align-items: center; ` const btnBackArrow = { borderWidth: 0, backgroundColor: '#FFF', borderColor: '#FFF', shadowColor: '#FFF', paddingTop: '5%' } interface Props { navigation?: any, route?: any, title?: string, subTitle?: any, titleColor?: string, titleAlign?: any, withIcon?: boolean, icon?: any, leftImg?: any, isBackStyle?: boolean, onActionLeft?: () => void, rightComponent?: any, showCall?: boolean, titleStyle?: TextStyle, btnStyle?: TextStyle, style?: TextStyle, paddingTop?: number, includeOrderTypeSelector?: boolean, imgLeftStyle?: ImageStyle onClickTypes?: any } const NavBar = (props: Props) => { const theme = useTheme(); const [orderState] = useOrder() const [, t] = useLanguage(); const selectedOrderType = orderState?.options?.type; return ( {(props?.onActionLeft || props?.leftImg) && ( ) } {props.withIcon ? ( ) : null } {props.title || ''} {props.subTitle ? (props.subTitle) : null } {props?.includeOrderTypeSelector && ( {t('THIS_ORDER_IS_TO', 'This order is to')} {selectedOrderType === 2 && t('TAKE_OUT', 'Take out')} {selectedOrderType === 3 && t('EAT_IN', 'Eat in')} )} { props.rightComponent } ) } NavBar.defaultProps = { title: '', textAlign: 'center', }; export default NavBar;