import React, { useState } from 'react' import { View } from 'react-native' import MaterialIcons from '@expo/vector-icons/MaterialIcons' import { tw, theme, MyText, MyTouchableOpacity } from 'common-ui' import { useRegion } from '@/src/hooks/useRegion' import AddressSwitcherSheet from '@/src/components/location/AddressSwitcherSheet' /** * Location bar shown at the top of every top-level tab screen. * Rendered INSIDE the scroll content (first item / ListHeaderComponent) so it * scrolls out with the page instead of sticking. Tapping opens the address * switcher: pick a saved address (region follows it) or add a new one. */ const LocationBar: React.FC = () => { const [sheetOpen, setSheetOpen] = useState(false) const { region } = useRegion() return ( setSheetOpen(true)} style={tw`flex-row items-center bg-white border border-gray-100 rounded-2xl px-4 py-3 shadow-sm`} > Deliver to {region?.name ?? 'Choose your address'} setSheetOpen(false)} /> ) } export default LocationBar