import React from 'react';
import FastImage from 'react-native-fast-image'
import { StyleSheet, TouchableOpacity, useWindowDimensions } from 'react-native';
import {
AddressDetails as AddressDetailsController,
useOrder,
useLanguage,
} from 'ordering-components/native';
import { useTheme } from 'styled-components/native';
import { ADContainer, ADHeader, ADAddress, ADMap } from './styles';
import { OText } from '../shared';
import { getTypesText } from '../../utils';
const AddressDetailsUI = (props: any) => {
const {
navigation,
addressToShow,
isCartPending,
googleMapsUrl,
apiKey
} = props;
const theme = useTheme();
const [orderState] = useOrder();
const [{ options }] = useOrder();
const [, t] = useLanguage();
const { width } = useWindowDimensions();
const orderTypeText = {
key: getTypesText(options?.type || 1),
value: t(getTypesText(options?.type || 1), 'Delivery')
}
const styles = StyleSheet.create({
productStyle: {
width,
height: 151,
marginVertical: 10
}
})
return (
{props.HeaderTitle ?? (
{t(`${orderTypeText.key}_ADDRESS`, `${orderTypeText.value} address`)}
)}
{!!apiKey && googleMapsUrl && (
)}
{addressToShow || orderState?.options?.address?.address}
{orderState?.options?.address?.address_notes}
{orderState?.options?.type === 1 && !isCartPending && (
navigation.navigate('AddressList', { isFromCheckout: true })
}>
{t('CHANGE', 'Change')}
)}
);
};
export const AddressDetails = (props: any) => {
const addressDetailsProps = {
...props,
UIComponent: AddressDetailsUI,
};
return ;
};