ordering-ui-react-native 0.16.90 → 0.16.92
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/business/src/components/BusinessController/index.tsx +1 -0
- package/themes/business/src/components/Chat/index.tsx +1 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/OrdersOption/index.tsx +50 -16
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +13 -3
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/types/index.tsx +2 -1
- package/themes/original/src/components/AddressForm/index.tsx +20 -29
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +20 -19
- package/themes/original/src/components/BusinessListingSearch/index.tsx +34 -9
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +25 -15
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/OrderTypeSelector/index.tsx +6 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +17 -2
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import styled, { css, useTheme } from 'styled-components/native'
|
|
3
3
|
import { useLanguage } from 'ordering-components/native';
|
|
4
4
|
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
|
|
@@ -24,6 +24,10 @@ interface Props {
|
|
|
24
24
|
handleChangeDate?: any,
|
|
25
25
|
rangeDate?: any,
|
|
26
26
|
isCalendarAlwaysVisible?: boolean
|
|
27
|
+
handleClear?: any;
|
|
28
|
+
handleOpenSelect?: any,
|
|
29
|
+
openedSelect?: string,
|
|
30
|
+
selectType?: string
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const Wrapper = styled.View`
|
|
@@ -96,7 +100,11 @@ const ODropDownCalendar = (props: Props) => {
|
|
|
96
100
|
isCalendar,
|
|
97
101
|
handleChangeDate,
|
|
98
102
|
rangeDate,
|
|
99
|
-
isCalendarAlwaysVisible
|
|
103
|
+
isCalendarAlwaysVisible,
|
|
104
|
+
handleClear,
|
|
105
|
+
handleOpenSelect,
|
|
106
|
+
openedSelect,
|
|
107
|
+
selectType
|
|
100
108
|
} = props
|
|
101
109
|
|
|
102
110
|
const theme = useTheme();
|
|
@@ -110,6 +118,7 @@ const ODropDownCalendar = (props: Props) => {
|
|
|
110
118
|
|
|
111
119
|
const onToggle = () => {
|
|
112
120
|
setIsOpen(!isOpen)
|
|
121
|
+
if (!isOpen) handleOpenSelect?.()
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
const onSelectOption = (option: any) => {
|
|
@@ -122,7 +131,7 @@ const ODropDownCalendar = (props: Props) => {
|
|
|
122
131
|
const onDateChange = (date: any, type: any) => {
|
|
123
132
|
if (!date) return
|
|
124
133
|
if (type === 'END_DATE') {
|
|
125
|
-
handleChangeDate(rangeDate.from, date.format('MM/DD/YY'))
|
|
134
|
+
handleChangeDate(rangeDate.from, new Date(date.format('MM/DD/YY')) === rangeDate.from ? '' : date.format('MM/DD/YY'))
|
|
126
135
|
} else {
|
|
127
136
|
handleChangeDate(date.format('MM/DD/YY'), '')
|
|
128
137
|
}
|
|
@@ -142,12 +151,31 @@ const ODropDownCalendar = (props: Props) => {
|
|
|
142
151
|
return (from || to) ? (from + (to ? end : '')) : placeholder
|
|
143
152
|
}
|
|
144
153
|
|
|
154
|
+
const handleClearCalendar = () => {
|
|
155
|
+
handleClear && handleClear()
|
|
156
|
+
if (isOpen) {
|
|
157
|
+
onToggle()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
145
161
|
useEffect(() => {
|
|
146
162
|
const _defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
147
163
|
setSelectedOption(_defaultOption)
|
|
148
164
|
setValue(defaultValue)
|
|
149
165
|
}, [defaultValue, options])
|
|
150
166
|
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (openedSelect !== selectType && typeof openedSelect === 'string') {
|
|
169
|
+
setIsOpen(false)
|
|
170
|
+
}
|
|
171
|
+
}, [openedSelect])
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (rangeDate.to && rangeDate.from) {
|
|
175
|
+
onSelect('calendar')
|
|
176
|
+
}
|
|
177
|
+
}, [rangeDate.to, rangeDate.from])
|
|
178
|
+
|
|
151
179
|
return (
|
|
152
180
|
<Wrapper style={props.style}>
|
|
153
181
|
<Selected
|
|
@@ -165,10 +193,11 @@ const ODropDownCalendar = (props: Props) => {
|
|
|
165
193
|
: `${selectedOption?.content || selectedOption?.name || placeholder}`
|
|
166
194
|
}
|
|
167
195
|
</SelectedLabel>
|
|
168
|
-
<
|
|
169
|
-
name='calendar'
|
|
170
|
-
|
|
171
|
-
|
|
196
|
+
<AntDesign
|
|
197
|
+
name={selectedOption && handleClear ? 'close' : 'calendar'}
|
|
198
|
+
size={20}
|
|
199
|
+
onPress={() => handleClearCalendar()}
|
|
200
|
+
style={{ position: 'absolute', right: 12, top: 13 }}
|
|
172
201
|
/>
|
|
173
202
|
</Selected>
|
|
174
203
|
{isOpen && options && (
|
|
@@ -256,6 +256,7 @@ export interface MessagesOptionParams {
|
|
|
256
256
|
messagesReadList?: any;
|
|
257
257
|
onNavigationRedirect?: any;
|
|
258
258
|
setSortBy?: any;
|
|
259
|
+
getOrders: any
|
|
259
260
|
}
|
|
260
261
|
export interface OrdersOptionParams {
|
|
261
262
|
orderList?: any;
|
|
@@ -409,7 +410,7 @@ export interface MessagesParams {
|
|
|
409
410
|
order?: any;
|
|
410
411
|
orderId?: number;
|
|
411
412
|
messages?: any;
|
|
412
|
-
message
|
|
413
|
+
message: string;
|
|
413
414
|
image?: string;
|
|
414
415
|
messagesToShow?: any;
|
|
415
416
|
sendMessage?: any;
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
Keyboard,
|
|
7
7
|
TouchableWithoutFeedback,
|
|
8
|
-
KeyboardAvoidingView,
|
|
9
8
|
Platform,
|
|
10
9
|
} from 'react-native';
|
|
11
10
|
import {
|
|
@@ -22,7 +21,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
|
|
|
22
21
|
import { useForm, Controller } from 'react-hook-form';
|
|
23
22
|
import Geocoder from 'react-native-geocoding';
|
|
24
23
|
|
|
25
|
-
import { OInput, OButton,
|
|
24
|
+
import { OInput, OButton, OModal, OIcon } from '../shared';
|
|
26
25
|
import { AddressFormParams } from '../../types';
|
|
27
26
|
import { getTraduction } from '../../utils';
|
|
28
27
|
import { useTheme } from 'styled-components/native';
|
|
@@ -57,7 +56,6 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
57
56
|
addressState,
|
|
58
57
|
addressesList,
|
|
59
58
|
saveAddress,
|
|
60
|
-
userCustomerSetup,
|
|
61
59
|
isGuestUser,
|
|
62
60
|
isRequiredField,
|
|
63
61
|
isFromProductsList,
|
|
@@ -599,33 +597,26 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
599
597
|
/>
|
|
600
598
|
)}
|
|
601
599
|
/>
|
|
602
|
-
{hasEditing ? (
|
|
603
|
-
<View style={styles.pinIcon}>
|
|
604
|
-
<GPSButton
|
|
605
|
-
apiKey={googleMapsApiKey}
|
|
606
|
-
handleGPS={(data: any, detail: any) => {
|
|
607
|
-
handleChangeAddress(data, detail);
|
|
608
|
-
setValue(data.address);
|
|
609
|
-
if (googleInput?.current) {
|
|
610
|
-
googleInput?.current?.setAddressText(data.address);
|
|
611
|
-
}
|
|
612
|
-
}}
|
|
613
|
-
IconButton={<OIcon src={theme.images.general.pin} width={16} />}
|
|
614
|
-
/>
|
|
615
|
-
</View>
|
|
616
|
-
) : null}
|
|
617
|
-
</AutocompleteInput>
|
|
618
600
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
601
|
+
{(
|
|
602
|
+
(!isEditing && !formState.changes?.address) ||
|
|
603
|
+
(isEditing && !formState.changes?.address && formState.changes?.address !== undefined)) &&
|
|
604
|
+
(
|
|
605
|
+
<View style={styles.pinIcon}>
|
|
606
|
+
<GPSButton
|
|
607
|
+
apiKey={googleMapsApiKey}
|
|
608
|
+
handleGPS={(data: any, detail: any) => {
|
|
609
|
+
handleChangeAddress(data, detail);
|
|
610
|
+
setValue('address', data.address);
|
|
611
|
+
if (googleInput?.current) {
|
|
612
|
+
googleInput?.current?.setAddressText(data.address);
|
|
613
|
+
}
|
|
614
|
+
}}
|
|
615
|
+
IconButton={<OIcon src={theme.images.general.pin} width={16} />}
|
|
616
|
+
/>
|
|
617
|
+
</View>
|
|
618
|
+
)}
|
|
619
|
+
</AutocompleteInput>
|
|
629
620
|
|
|
630
621
|
{(locationChange || formState.changes?.location) && (
|
|
631
622
|
<View
|
|
@@ -59,7 +59,7 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const uniqueAddressesList = (addressList.addresses && addressList.addresses.filter(
|
|
62
|
-
(address: any, i: number, self: any) =>
|
|
62
|
+
(address: any, i: number, self: any) => address.address &&
|
|
63
63
|
i === self.findIndex((obj: any) => (
|
|
64
64
|
address.address === obj.address &&
|
|
65
65
|
address.address_notes === obj.address_notes &&
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image'
|
|
3
4
|
import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
4
5
|
import { useTheme } from 'styled-components/native';
|
|
5
6
|
import { OIcon, OText, OModal } from '../shared';
|
|
@@ -55,13 +56,13 @@ export const BusinessBasicInformation = (
|
|
|
55
56
|
headerStyle: {
|
|
56
57
|
height: isChewLayout ? 170 : 260,
|
|
57
58
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
logoStyle: {
|
|
60
|
+
width: 72,
|
|
61
|
+
height: 72,
|
|
62
|
+
borderRadius: 7.6,
|
|
63
|
+
justifyContent: 'flex-start',
|
|
64
|
+
alignItems: 'flex-start'
|
|
65
|
+
},
|
|
65
66
|
businessInfo: {
|
|
66
67
|
paddingHorizontal: 40,
|
|
67
68
|
paddingTop: isChewLayout ? 0 : 56,
|
|
@@ -270,11 +271,9 @@ export const BusinessBasicInformation = (
|
|
|
270
271
|
? styles.businesInfoheaderStyle
|
|
271
272
|
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
272
273
|
}
|
|
273
|
-
source
|
|
274
|
-
uri:
|
|
275
|
-
|
|
276
|
-
optimizeImage(businessState?.business?.header, 'h_250,c_limit'),
|
|
277
|
-
}}
|
|
274
|
+
{...(!loading && { source: {
|
|
275
|
+
uri: header || optimizeImage(businessState?.business?.header, 'h_250,c_limit')
|
|
276
|
+
}})}
|
|
278
277
|
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
279
278
|
>
|
|
280
279
|
{!isBusinessInfoShow && !isChewLayout && (
|
|
@@ -282,7 +281,7 @@ export const BusinessBasicInformation = (
|
|
|
282
281
|
<OIcon src={theme.images.general.info} width={24} />
|
|
283
282
|
</WrapBusinessInfo>
|
|
284
283
|
)}
|
|
285
|
-
{isChewLayout && (
|
|
284
|
+
{isChewLayout && !loading && (
|
|
286
285
|
<View style={styles.headerChewStyle}>
|
|
287
286
|
<OText size={24} weight={'600'} mBottom={-5}>
|
|
288
287
|
{business?.name}
|
|
@@ -302,12 +301,14 @@ export const BusinessBasicInformation = (
|
|
|
302
301
|
{showLogo && (
|
|
303
302
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
304
303
|
{!isBusinessInfoShow && (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
optimizeImage(businessState?.business?.logo, 'h_70,c_limit')
|
|
309
|
-
|
|
310
|
-
|
|
304
|
+
<FastImage
|
|
305
|
+
style={styles.logoStyle}
|
|
306
|
+
source={{
|
|
307
|
+
uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit'),
|
|
308
|
+
priority: FastImage.priority.high,
|
|
309
|
+
cache:FastImage.cacheControl.web
|
|
310
|
+
}}
|
|
311
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
311
312
|
/>
|
|
312
313
|
)}
|
|
313
314
|
</BusinessLogo>
|
|
@@ -25,7 +25,8 @@ import {
|
|
|
25
25
|
BrandItem,
|
|
26
26
|
PriceFilterWrapper,
|
|
27
27
|
OptionTitle,
|
|
28
|
-
BContainer
|
|
28
|
+
BContainer,
|
|
29
|
+
WrapperButtons
|
|
29
30
|
} from './styles'
|
|
30
31
|
import FastImage from 'react-native-fast-image'
|
|
31
32
|
import { convertHoursToMinutes } from '../../utils'
|
|
@@ -134,7 +135,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
134
135
|
borderWidth: 0
|
|
135
136
|
},
|
|
136
137
|
applyButton: {
|
|
137
|
-
paddingHorizontal:
|
|
138
|
+
paddingHorizontal: 10,
|
|
138
139
|
width: '100%',
|
|
139
140
|
marginTop: 20
|
|
140
141
|
}
|
|
@@ -145,10 +146,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
const handleCloseFilters = () => {
|
|
148
|
-
|
|
149
|
+
clearFilters()
|
|
149
150
|
setOpenFilters(false)
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
const clearFilters = () => {
|
|
154
|
+
setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
|
|
155
|
+
}
|
|
156
|
+
|
|
152
157
|
const handleChangeActiveBusinessType = (type: any) => {
|
|
153
158
|
if (type?.id === null) {
|
|
154
159
|
handleChangeFilters('business_types', [])
|
|
@@ -482,22 +487,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
482
487
|
</PriceFilterWrapper>
|
|
483
488
|
{orderState?.options?.type === 1 && (
|
|
484
489
|
<MaxSectionItem
|
|
490
|
+
filters={filters}
|
|
485
491
|
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
486
492
|
options={maxDeliveryFeeOptions}
|
|
487
493
|
filter='max_delivery_price'
|
|
494
|
+
handleChangeFilters={handleChangeFilters}
|
|
488
495
|
/>
|
|
489
496
|
)}
|
|
490
497
|
{[1, 2].includes(orderState?.options?.type) && (
|
|
491
498
|
<MaxSectionItem
|
|
499
|
+
filters={filters}
|
|
492
500
|
title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
|
|
493
501
|
options={maxTimeOptions}
|
|
494
502
|
filter='max_eta'
|
|
503
|
+
handleChangeFilters={handleChangeFilters}
|
|
495
504
|
/>
|
|
496
505
|
)}
|
|
497
506
|
<MaxSectionItem
|
|
507
|
+
filters={filters}
|
|
498
508
|
title={t('MAX_DISTANCE', 'Max distance')}
|
|
499
509
|
options={maxDistanceOptions}
|
|
500
510
|
filter='max_distance'
|
|
511
|
+
handleChangeFilters={handleChangeFilters}
|
|
501
512
|
/>
|
|
502
513
|
{businessTypes?.length > 0 && (
|
|
503
514
|
<TagsContainer>
|
|
@@ -517,12 +528,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
517
528
|
</TagsContainer>
|
|
518
529
|
)}
|
|
519
530
|
</ScrollView>
|
|
520
|
-
<
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
531
|
+
<WrapperButtons>
|
|
532
|
+
<View style={{ width: '50%' }}>
|
|
533
|
+
<OButton
|
|
534
|
+
text={t('APPLY', 'Apply')}
|
|
535
|
+
parentStyle={styles.applyButton}
|
|
536
|
+
textStyle={{ color: '#fff' }}
|
|
537
|
+
onClick={() => handleApplyFilters()}
|
|
538
|
+
/>
|
|
539
|
+
</View>
|
|
540
|
+
<View style={{ width: '50%' }}>
|
|
541
|
+
<OButton
|
|
542
|
+
text={t('CLEAR_FILTERS', 'Clear')}
|
|
543
|
+
bgColor={theme.colors.white}
|
|
544
|
+
borderColor={theme.colors.primary}
|
|
545
|
+
parentStyle={styles.applyButton}
|
|
546
|
+
textStyle={{ color: theme.colors.primary }}
|
|
547
|
+
onClick={() => clearFilters()}
|
|
548
|
+
/>
|
|
549
|
+
</View>
|
|
550
|
+
</WrapperButtons>
|
|
526
551
|
</OModal>
|
|
527
552
|
</BContainer>
|
|
528
553
|
)
|
|
@@ -293,7 +293,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
293
293
|
</Placeholder>
|
|
294
294
|
</NearBusiness>
|
|
295
295
|
)}
|
|
296
|
-
{!hideBusinessNearCity && businessState?.business?.city_id && (
|
|
296
|
+
{!loading && !hideBusinessNearCity && businessState?.business?.city_id && (
|
|
297
297
|
<NearBusiness>
|
|
298
298
|
<BusinessesListing
|
|
299
299
|
logosLayout
|
|
@@ -165,16 +165,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
165
165
|
const [favoriteIds, setFavoriteIds] = useState<any>([])
|
|
166
166
|
const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
|
|
167
167
|
|
|
168
|
-
// const panResponder = useRef(
|
|
169
|
-
// PanResponder.create({
|
|
170
|
-
// onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
171
|
-
// const { dx, dy } = gestureState;
|
|
172
|
-
// resetInactivityTimeout()
|
|
173
|
-
// return (Math.abs(dx) > 20) || (Math.abs(dy) > 20);
|
|
174
|
-
// },
|
|
175
|
-
// })
|
|
176
|
-
// ).current
|
|
177
|
-
|
|
178
168
|
const handleMomentClick = () => {
|
|
179
169
|
if (isPreorderEnabled) {
|
|
180
170
|
navigation.navigate('MomentOption')
|
|
@@ -296,7 +286,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
296
286
|
|
|
297
287
|
if (logosLayout) {
|
|
298
288
|
return (
|
|
299
|
-
<BusinessLogosContainer
|
|
289
|
+
<BusinessLogosContainer
|
|
290
|
+
horizontal
|
|
291
|
+
showsHorizontalScrollIndicator={false}
|
|
292
|
+
>
|
|
300
293
|
{businessesList?.loading ? (
|
|
301
294
|
<Placeholder Animation={Fade}>
|
|
302
295
|
<View style={{ flexDirection: 'row' }}>
|
|
@@ -310,14 +303,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
310
303
|
) : (
|
|
311
304
|
<>
|
|
312
305
|
{businessesList.businesses
|
|
313
|
-
?.filter(business => business?.
|
|
306
|
+
?.filter(business => business?.open)
|
|
314
307
|
?.map(business => (
|
|
315
308
|
<TouchableOpacity
|
|
316
309
|
key={business?.id}
|
|
317
310
|
onPress={() => handleBusinessClick && handleBusinessClick(business)}
|
|
311
|
+
style={{
|
|
312
|
+
width: 57,
|
|
313
|
+
height: 58,
|
|
314
|
+
borderBottomColor: theme.colors.primary,
|
|
315
|
+
borderBottomWidth: business?.slug === actualSlug ? 2 : 0,
|
|
316
|
+
marginRight: 5
|
|
317
|
+
}}
|
|
318
318
|
>
|
|
319
319
|
<FastImage
|
|
320
|
-
style={{
|
|
320
|
+
style={{
|
|
321
|
+
width: 56,
|
|
322
|
+
height: 56,
|
|
323
|
+
marginRight: 20,
|
|
324
|
+
borderTopLeftRadius: 7.6,
|
|
325
|
+
borderTopRightRadius: 7.6
|
|
326
|
+
}}
|
|
321
327
|
source={{
|
|
322
328
|
uri: business?.logo,
|
|
323
329
|
priority: FastImage.priority.normal,
|
|
@@ -333,7 +339,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
333
339
|
}
|
|
334
340
|
|
|
335
341
|
return (
|
|
336
|
-
<IOScrollView
|
|
342
|
+
<IOScrollView
|
|
343
|
+
style={styles.container}
|
|
344
|
+
onScroll={(e) => handleScroll(e)}
|
|
345
|
+
showsVerticalScrollIndicator={false}
|
|
337
346
|
refreshControl={
|
|
338
347
|
<RefreshControl
|
|
339
348
|
refreshing={refreshing}
|
|
@@ -463,11 +472,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
463
472
|
handleChangeBusinessType={handleChangeBusinessType}
|
|
464
473
|
isChewLayout
|
|
465
474
|
chewOrderTypes={chewOrderTypes}
|
|
475
|
+
handleChangeType={setOrderTypeValue}
|
|
466
476
|
/>
|
|
467
477
|
</OrderTypesContainer>
|
|
468
478
|
)}
|
|
469
479
|
|
|
470
|
-
{!hideCities && (
|
|
480
|
+
{!hideCities && orderTypeValue === 2 && (
|
|
471
481
|
<View style={{ marginTop: 20 }}>
|
|
472
482
|
<TouchableOpacity
|
|
473
483
|
style={styles.buttonCityStyle}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
3
|
-
import Geolocation from '@react-native-community/geolocation'
|
|
4
2
|
import Geocoder from 'react-native-geocoding'
|
|
5
|
-
import { GpsButtonStyle } from './styles'
|
|
6
|
-
import { View } from 'react-native'
|
|
7
|
-
import { OText } from '../shared'
|
|
8
3
|
import { ActivityIndicator } from 'react-native-paper'
|
|
4
|
+
import Geolocation from '@react-native-community/geolocation'
|
|
5
|
+
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
6
|
+
|
|
7
|
+
import { OText } from '../shared'
|
|
8
|
+
import { GpsButtonStyle } from './styles'
|
|
9
9
|
|
|
10
10
|
export const GPSButton = (props: any) => {
|
|
11
11
|
const {
|
|
12
12
|
handleGPS,
|
|
13
13
|
apiKey,
|
|
14
|
-
googleReady,
|
|
15
14
|
IconButton,
|
|
16
15
|
IconLoadingButton
|
|
17
16
|
} = props
|
|
@@ -56,25 +55,27 @@ export const GPSButton = (props: any) => {
|
|
|
56
55
|
})
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
const getCurrentPosition = async () => {
|
|
60
59
|
let trackingStatus = await getTrackingStatus()
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setLoading(true)
|
|
60
|
+
if (trackingStatus === 'not-determined') {
|
|
61
|
+
trackingStatus = await requestTrackingPermission()
|
|
62
|
+
}
|
|
63
|
+
if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
|
|
64
|
+
setLoading(true)
|
|
66
65
|
Geolocation.getCurrentPosition((pos) => {
|
|
67
|
-
geoCodePosition(pos.coords)
|
|
66
|
+
geoCodePosition(pos.coords)
|
|
68
67
|
}, (err) => {
|
|
69
68
|
setLoading(false);
|
|
70
|
-
console.log(err)
|
|
71
|
-
}
|
|
69
|
+
console.log(`ERROR(${err.code}): ${err.message}`)
|
|
70
|
+
}, {
|
|
71
|
+
enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
|
|
72
|
+
})
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
Geocoder.init(apiKey);
|
|
78
|
+
}, [])
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<GpsButtonStyle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
OrderTypeControl,
|
|
4
4
|
useLanguage,
|
|
@@ -17,6 +17,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
17
17
|
const {
|
|
18
18
|
navigation,
|
|
19
19
|
handleChangeOrderType,
|
|
20
|
+
handleChangeType,
|
|
20
21
|
typeSelected,
|
|
21
22
|
defaultValue,
|
|
22
23
|
configTypes,
|
|
@@ -51,6 +52,10 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
handleChangeType(typeSelected)
|
|
57
|
+
}, [typeSelected])
|
|
58
|
+
|
|
54
59
|
return (
|
|
55
60
|
<Wrapper>
|
|
56
61
|
{isChewLayout ? (
|
|
@@ -97,7 +97,7 @@ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) =>
|
|
|
97
97
|
const [orderState] = useOrder()
|
|
98
98
|
const windowWidth = Dimensions.get('window').width;
|
|
99
99
|
const onBusinessClick = (business: any) => {
|
|
100
|
-
onNavigationRedirect('Business', { store: business.slug })
|
|
100
|
+
onNavigationRedirect('Business', { store: business.slug, logo: business.logo, header: business.header })
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const styles = StyleSheet.create({
|
|
@@ -15,7 +15,7 @@ import Swiper from 'react-native-swiper'
|
|
|
15
15
|
import FastImage from 'react-native-fast-image';
|
|
16
16
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
17
17
|
import YoutubePlayer from "react-native-youtube-iframe"
|
|
18
|
-
import { TextInput } from 'react-native'
|
|
18
|
+
import { Keyboard, TextInput } from 'react-native'
|
|
19
19
|
import {
|
|
20
20
|
Grayscale
|
|
21
21
|
} from 'react-native-color-matrix-image-filters'
|
|
@@ -183,6 +183,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
183
183
|
const [headerRefHeight, setHeaderRefHeight] = useState(0)
|
|
184
184
|
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
185
185
|
const [isScrollAvailable, setIsScrollAvailable] = useState(null)
|
|
186
|
+
const [isKeyboardShow, setIsKeyboardShow] = useState(false)
|
|
186
187
|
|
|
187
188
|
const isError = (id: number) => {
|
|
188
189
|
let bgColor = theme.colors.white;
|
|
@@ -454,6 +455,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
454
455
|
)
|
|
455
456
|
}
|
|
456
457
|
|
|
458
|
+
useEffect(() => {
|
|
459
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
460
|
+
setIsKeyboardShow(true)
|
|
461
|
+
})
|
|
462
|
+
const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
|
|
463
|
+
setIsKeyboardShow(false)
|
|
464
|
+
})
|
|
465
|
+
return () => {
|
|
466
|
+
keyboardDidShowListener.remove()
|
|
467
|
+
keyboardDidHideListener.remove()
|
|
468
|
+
}
|
|
469
|
+
}, [])
|
|
470
|
+
|
|
471
|
+
|
|
457
472
|
return (
|
|
458
473
|
<SafeAreaView style={{ flex: 1 }}>
|
|
459
474
|
<TopHeader>
|
|
@@ -947,7 +962,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
947
962
|
</>
|
|
948
963
|
)}
|
|
949
964
|
{!product?.hide_special_instructions && (
|
|
950
|
-
<ProductComment>
|
|
965
|
+
<ProductComment pb={isKeyboardShow && Platform.OS === 'ios' && 320}>
|
|
951
966
|
<SectionTitle>
|
|
952
967
|
<OText size={16} weight={'600'} lineHeight={24}>
|
|
953
968
|
{t('SPECIAL_COMMENT', 'Special comment')}
|