ordering-ui-react-native 0.21.4 → 0.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/original/src/components/BusinessInformation/index.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -0
- package/themes/original/src/components/GoogleMap/index.tsx +46 -2
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/types/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -105,6 +105,7 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
105
105
|
readOnly
|
|
106
106
|
location={businessLocation.location}
|
|
107
107
|
markerTitle={businessState?.business?.name}
|
|
108
|
+
businessZones={businessState?.business?.zones}
|
|
108
109
|
/>
|
|
109
110
|
</WrapBusinessMap>
|
|
110
111
|
)}
|
|
@@ -569,6 +569,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
569
569
|
{
|
|
570
570
|
!businessId && !props.franchiseId && (
|
|
571
571
|
<HighestRatedBusinesses
|
|
572
|
+
propsToFetch={props.propsToFetch}
|
|
572
573
|
onBusinessClick={handleBusinessClick}
|
|
573
574
|
navigation={navigation}
|
|
574
575
|
favoriteIds={favoriteIds}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import { Dimensions, StyleSheet, View, Platform } from 'react-native';
|
|
3
|
-
import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, } from 'react-native-maps'
|
|
3
|
+
import MapView, { PROVIDER_DEFAULT, PROVIDER_GOOGLE, Marker, Region, Polygon, Circle } from 'react-native-maps'
|
|
4
4
|
import Geocoder from 'react-native-geocoding';
|
|
5
5
|
import { useLanguage, useConfig } from 'ordering-components/native'
|
|
6
6
|
import { GoogleMapsParams } from '../../types';
|
|
@@ -19,7 +19,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
19
19
|
setSaveLocation,
|
|
20
20
|
handleToggleMap,
|
|
21
21
|
locations,
|
|
22
|
-
isIntGeoCoder
|
|
22
|
+
isIntGeoCoder,
|
|
23
|
+
businessZones
|
|
23
24
|
} = props
|
|
24
25
|
|
|
25
26
|
const [, t] = useLanguage()
|
|
@@ -44,6 +45,19 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
44
45
|
ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
const units: any = {
|
|
49
|
+
mi: 1609,
|
|
50
|
+
km: 1000
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const types: any = [1, 2, 5]
|
|
54
|
+
|
|
55
|
+
const fillStyles = {
|
|
56
|
+
fillColor: 'rgba(44, 123, 229, 0.3)',
|
|
57
|
+
strokeColor: 'rgba(44, 123, 229, 1)',
|
|
58
|
+
strokeWidth: 2
|
|
59
|
+
}
|
|
60
|
+
|
|
47
61
|
const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion ?: boolean) => {
|
|
48
62
|
Geocoder.from({
|
|
49
63
|
latitude: pos.latitude,
|
|
@@ -230,6 +244,36 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
230
244
|
title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
|
|
231
245
|
/>
|
|
232
246
|
)}
|
|
247
|
+
{businessZones?.length > 0 && businessZones.filter((item: any) => types.includes(item?.type)).map((businessZone: any, i: number) => (
|
|
248
|
+
<React.Fragment key={i}>
|
|
249
|
+
{businessZone?.type === 2 && Array.isArray(businessZone?.data) && (
|
|
250
|
+
<Polygon
|
|
251
|
+
coordinates={businessZone?.data.map((item: any) => ({ latitude: item.lat, longitude: item.lng}))}
|
|
252
|
+
fillColor={fillStyles.fillColor}
|
|
253
|
+
strokeColor={fillStyles.strokeColor}
|
|
254
|
+
strokeWidth={fillStyles.strokeWidth}
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
257
|
+
{(businessZone.type === 1 && businessZone?.data?.center && businessZone?.data?.radio) && (
|
|
258
|
+
<Circle
|
|
259
|
+
center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
|
|
260
|
+
radius={businessZone?.data.radio * 1000}
|
|
261
|
+
fillColor={fillStyles.fillColor}
|
|
262
|
+
strokeColor={fillStyles.strokeColor}
|
|
263
|
+
strokeWidth={fillStyles.strokeWidth}
|
|
264
|
+
/>
|
|
265
|
+
)}
|
|
266
|
+
{(businessZone.type === 5 && businessZone?.data?.distance) && (
|
|
267
|
+
<Circle
|
|
268
|
+
center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
|
|
269
|
+
radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
|
|
270
|
+
fillColor={fillStyles.fillColor}
|
|
271
|
+
strokeColor={fillStyles.strokeColor}
|
|
272
|
+
strokeWidth={fillStyles.strokeWidth}
|
|
273
|
+
/>
|
|
274
|
+
)}
|
|
275
|
+
</React.Fragment>
|
|
276
|
+
))}
|
|
233
277
|
</MapView>
|
|
234
278
|
<Alert
|
|
235
279
|
open={alertState.open}
|
|
@@ -613,7 +613,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
613
613
|
>
|
|
614
614
|
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
615
615
|
<FastImage
|
|
616
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio:
|
|
616
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 4 / 3 }}
|
|
617
617
|
source={typeof img !== 'number' ? {
|
|
618
618
|
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
619
619
|
priority: FastImage.priority.normal,
|
|
@@ -632,7 +632,8 @@ export interface GoogleMapsParams {
|
|
|
632
632
|
locations?: Array<any>,
|
|
633
633
|
setSaveLocation?: (val: boolean) => void,
|
|
634
634
|
handleToggleMap?: () => void,
|
|
635
|
-
isIntGeoCoder: boolean
|
|
635
|
+
isIntGeoCoder: boolean,
|
|
636
|
+
businessZones?: any
|
|
636
637
|
}
|
|
637
638
|
|
|
638
639
|
export interface HelpParams {
|