Skip to content

Commit

Permalink
Fix user location coordinates in StoreLocationScreen and StoreMap
Browse files Browse the repository at this point in the history
  • Loading branch information
tortuvshin committed Mar 21, 2024
1 parent 9cde047 commit 9d9dbef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
15 changes: 6 additions & 9 deletions src/features/Shared/StoreLocationScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const StoreLocationScreen = ({ navigation, route }) => {
const isReviewsEnabled = info?.options?.reviews_enabled === true && config('app.storeScreenOptions.reviewsEnabled');

const origin = {
latitude: userLocation?.coordinates[0],
longitude: userLocation?.coordinates[1],
latitude: userLocation?.coords.latitude,
longitude: userLocation?.coords.longitude,
};

const destination = {
Expand Down Expand Up @@ -107,7 +107,7 @@ const StoreLocationScreen = ({ navigation, route }) => {
return (
<View>
<View style={tailwind('bg-white h-full w-full')}>
<View style={[tailwind('absolute w-full z-10 top-0 p-4 bg-gray-900 bg-opacity-50'), { paddingTop: insets.top }]}>
<View style={[tailwind('absolute w-full z-10 top-0 p-4 bg-gray-900 bg-opacity-50')]}>
<View style={tailwind('flex flex-row items-center')}>
<TouchableOpacity onPress={() => navigation.goBack()} style={tailwind('mr-4')}>
<View style={tailwind('rounded-full bg-gray-100 w-10 h-10 flex items-center justify-center')}>
Expand Down Expand Up @@ -192,20 +192,17 @@ const StoreLocationScreen = ({ navigation, route }) => {
longitude: storeLocation.getAttribute('place.location.coordinates.0'),
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
>
}}>
<Marker
coordinate={{
latitude: storeLocation.getAttribute('place.location.coordinates.1'),
longitude: storeLocation.getAttribute('place.location.coordinates.0'),
}}
>
}}>
<View style={tailwind('relative')}>
<View
style={tailwind(
'p-3 absolute bottom-0 left-0 mb-1.5 mr-3 rounded-md bg-white bg-opacity-75 border border-gray-400 shadow flex flex-row items-center z-30'
)}
>
)}>
<View style={tailwind('mr-3')}>
<FastImage source={{ uri: store.getAttribute('logo_url') }} style={tailwind('h-12 w-12 rounded')} />
</View>
Expand Down
10 changes: 4 additions & 6 deletions src/interface/StoreMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,17 @@ const StoreMap = ({ query, location, filters, onPressStore, containerStyle, mapV
showsTraffic={true}
style={[tailwind('w-full h-full rounded-md shadow-sm z-10'), mapViewStyle]}
initialRegion={{
latitude: userLocation.coordinates[0],
longitude: userLocation.coordinates[1],
latitude: userLocation.coords.latitude,
longitude: userLocation.coords.longitude,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
>
}}>
{storeLocations.map((storeLocation, index) => (
<Marker
key={index}
coordinate={{ latitude: storeLocation.getAttribute('place.location.coordinates.1'), longitude: storeLocation.getAttribute('place.location.coordinates.0') }}
onPress={() => handleStorePress(storeLocation)}
style={tailwind(`${focusedLocationIndex === index ? 'z-30' : 'z-10'}`)}
>
style={tailwind(`${focusedLocationIndex === index ? 'z-30' : 'z-10'}`)}>
<TouchableOpacity style={tailwind('flex items-center')}>
<View style={tailwind('flex items-center justify-center')}>
<FastImage source={{ uri: storeLocation.getAttribute('store.logo_url') }} style={tailwind('h-8 w-8')} />
Expand Down
6 changes: 3 additions & 3 deletions src/interface/StoreSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ const StoreSearch = ({ store, wrapperStyle, buttonTitle, buttonStyle, buttonTitl
}, 600);

useEffect(() => {
if (!query) {
if (!query || query.length < 4) {
return;
}

debouncedSearch(query, (results) => {
setResults(results);
setResults(results || []);
});
}, [query]);

Expand All @@ -69,7 +69,7 @@ const StoreSearch = ({ store, wrapperStyle, buttonTitle, buttonStyle, buttonTitl
<View style={tailwind('px-5 py-2 flex flex-row items-center justify-between')}>
<View style={tailwind('flex-1 pr-4')}>
<View style={tailwind('relative overflow-hidden')}>
<View style={tailwind('absolute top-0 bottom-0 left-0 h-full flex items-center justify-center z-10')}>
<View style={tailwind('absolute top-1 bottom-0 left-0 h-full flex items-center justify-center z-10')}>
<FontAwesomeIcon icon={buttonIcon} style={[tailwind('text-gray-800 ml-3'), buttonIconStyle]} />
</View>
<TextInput
Expand Down

0 comments on commit 9d9dbef

Please sign in to comment.