ordering-ui-react-native 0.24.3 → 0.24.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.24.3",
3
+ "version": "0.24.5",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -33,9 +33,7 @@ const styles = StyleSheet.create({
33
33
 
34
34
  const MapViewComponent = (props: MapViewParams) => {
35
35
  const {
36
- isLoadingBusinessMarkers,
37
- markerGroups,
38
- customerMarkerGroups,
36
+ assingnedOrders,
39
37
  alertState,
40
38
  setAlertState,
41
39
  setDriverLocation,
@@ -65,7 +63,7 @@ const MapViewComponent = (props: MapViewParams) => {
65
63
  return { lat: userLocation?.latitude, lng: userLocation?.longitude }
66
64
  }, [userLocation?.latitude, userLocation?.longitude])
67
65
 
68
- const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
66
+ const haveOrders = Object.values(assingnedOrders?.orders)?.length > 0 && assingnedOrders?.orders?.some(order => order?.customer?.id)
69
67
  const closeAlert = () => {
70
68
  setAlertState({
71
69
  open: false,
@@ -165,7 +163,7 @@ const MapViewComponent = (props: MapViewParams) => {
165
163
  return (
166
164
  <SafeAreaView style={{ flex: 1 }}>
167
165
  <View style={{ flex: 1 }}>
168
- {(isDeliveryApp || (!isLoadingBusinessMarkers && isFocused)) && !!initialPosition?.latitude && !!initialPosition?.longitude && (
166
+ {(isDeliveryApp || (!assingnedOrders?.loading && isFocused)) && !!initialPosition?.latitude && !!initialPosition?.longitude && (
169
167
  <View style={{ flex: 1 }}>
170
168
  <MapView
171
169
  ref={mapRef}
@@ -185,20 +183,18 @@ const MapViewComponent = (props: MapViewParams) => {
185
183
  onTouchStart={() => (following.current = false)}
186
184
  >
187
185
  <>
188
- {Object.values(markerGroups).map((marker: any) => (
186
+ {assingnedOrders?.orders.map((marker: any) => (
189
187
  <RenderMarker
190
188
  {...renderMarkerDefaultProps}
191
- key={marker[0]?.business_id}
192
- marker={marker[0]}
193
- orderIds={marker.map((order: any) => order.id).join(', ')}
189
+ key={`${marker?.id}_${marker?.business_id}`}
190
+ marker={marker}
194
191
  />
195
192
  ))}
196
- {Object.values(customerMarkerGroups).map((marker: any) => (
193
+ {assingnedOrders?.orders.map((marker: any) => (
197
194
  <RenderMarker
198
195
  {...renderMarkerDefaultProps}
199
- key={marker[0]?.customer_id}
200
- marker={marker[0]}
201
- orderIds={marker.map((order: any) => order.id).join(', ')}
196
+ key={`${marker?.id}_${marker?.customer_id}`}
197
+ marker={marker}
202
198
  customer
203
199
  />
204
200
  ))}
@@ -623,7 +623,8 @@ export interface MapViewParams {
623
623
  markerGroups: Array<any>,
624
624
  customerMarkerGroups: Array<any>,
625
625
  alertState: { open: boolean, content: Array<string>, key?: string | null },
626
- setAlertState: ({ open, content, key }: { open: boolean, content: Array<string>, key?: string | null }) => void
626
+ setAlertState: ({ open, content, key }: { open: boolean, content: Array<string>, key?: string | null }) => void,
627
+ assingnedOrders?: any
627
628
  }
628
629
 
629
630
  export interface ReviewCustomerParams {
@@ -657,7 +658,7 @@ export interface SessionsParams {
657
658
  }
658
659
 
659
660
  export interface RenderMarkerParams {
660
- key?: number,
661
+ key?: string,
661
662
  marker: any,
662
663
  customer?: boolean,
663
664
  orderIds?: Array<number>
@@ -76,6 +76,8 @@ const AddressFormUI = (props: AddressFormParams) => {
76
76
 
77
77
  const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
78
78
 
79
+ const isEmptyField = (key: any, str: any) => isRequiredField && isRequiredField(key) && (!str || str.trim().length === 0)
80
+
79
81
  const tagsName = [
80
82
  { icon: theme.images.general.tag_home, value: 'home' },
81
83
  { icon: theme.images.general.tag_building, value: 'office' },
@@ -748,9 +750,9 @@ const AddressFormUI = (props: AddressFormParams) => {
748
750
  <OInput
749
751
  name="internal_number"
750
752
  placeholder={t('INTERNAL_NUMBER', 'Internal number')}
751
- onChange={(text: string) => {
752
- handleChangeInput(text);
753
- setValue('internal_number', text);
753
+ onChange={(data: any) => {
754
+ handleChangeInput(data);
755
+ setValue('internal_number', isEmptyField('internal_number', data?.target?.value) ? null : data);
754
756
  }}
755
757
  value={
756
758
  address?.internal_number ||
@@ -795,9 +797,9 @@ const AddressFormUI = (props: AddressFormParams) => {
795
797
  <OInput
796
798
  name="zipcode"
797
799
  placeholder={t('ZIP_CODE', 'Zip code')}
798
- onChange={(text: string) => {
799
- handleChangeInput(text);
800
- setValue('zipcode', text);
800
+ onChange={(data: any) => {
801
+ handleChangeInput(data);
802
+ setValue('zipcode', isEmptyField('zipcode', data?.target?.value) ? null : data);
801
803
  }}
802
804
  value={
803
805
  address?.zipcode ||