ordering-ui-react-native 0.15.86-release → 0.15.87-release
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/AddressForm/index.tsx +21 -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 +25 -11
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
package/package.json
CHANGED
|
@@ -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,27 @@ 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 && !isGuestUser && !formState.changes?.address) ||
|
|
603
|
+
(isEditing && !isGuestUser && !formState.changes?.address && formState.changes?.address !== undefined)) ||
|
|
604
|
+
(isGuestUser && !formState.changes?.address && formState.changes?.address !== undefined) &&
|
|
605
|
+
(
|
|
606
|
+
<View style={styles.pinIcon}>
|
|
607
|
+
<GPSButton
|
|
608
|
+
apiKey={googleMapsApiKey}
|
|
609
|
+
handleGPS={(data: any, detail: any) => {
|
|
610
|
+
handleChangeAddress(data, detail);
|
|
611
|
+
setValue('address', data.address);
|
|
612
|
+
if (googleInput?.current) {
|
|
613
|
+
googleInput?.current?.setAddressText(data.address);
|
|
614
|
+
}
|
|
615
|
+
}}
|
|
616
|
+
IconButton={<OIcon src={theme.images.general.pin} width={16} />}
|
|
617
|
+
/>
|
|
618
|
+
</View>
|
|
619
|
+
)}
|
|
620
|
+
</AutocompleteInput>
|
|
629
621
|
|
|
630
622
|
{(locationChange || formState.changes?.location) && (
|
|
631
623
|
<View
|
|
@@ -56,7 +56,7 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const uniqueAddressesList = (addressList.addresses && addressList.addresses.filter(
|
|
59
|
-
(address: any, i: number, self: any) =>
|
|
59
|
+
(address: any, i: number, self: any) => address.address &&
|
|
60
60
|
i === self.findIndex((obj: any) => (
|
|
61
61
|
address.address === obj.address &&
|
|
62
62
|
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({
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useCallback } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Keyboard,
|
|
5
|
+
TextInput,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Dimensions,
|
|
9
|
+
I18nManager,
|
|
10
|
+
SafeAreaView,
|
|
11
|
+
Platform,
|
|
12
|
+
Button
|
|
13
|
+
} from 'react-native';
|
|
2
14
|
import {
|
|
3
15
|
ProductForm as ProductOptions,
|
|
4
16
|
useSession,
|
|
@@ -15,17 +27,10 @@ import Swiper from 'react-native-swiper'
|
|
|
15
27
|
import FastImage from 'react-native-fast-image';
|
|
16
28
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
17
29
|
import YoutubePlayer from "react-native-youtube-iframe"
|
|
18
|
-
import { TextInput } from 'react-native'
|
|
19
|
-
import {
|
|
20
|
-
Grayscale
|
|
21
|
-
} from 'react-native-color-matrix-image-filters'
|
|
22
|
-
|
|
23
|
-
import { View, TouchableOpacity, StyleSheet, Dimensions, I18nManager, SafeAreaView, Platform, Button } from 'react-native';
|
|
24
30
|
|
|
25
31
|
import {
|
|
26
32
|
WrapHeader,
|
|
27
33
|
TopHeader,
|
|
28
|
-
WrapContent,
|
|
29
34
|
ProductTitle,
|
|
30
35
|
ProductDescription,
|
|
31
36
|
ProductEditions,
|
|
@@ -45,8 +50,6 @@ import { ScrollView } from 'react-native-gesture-handler';
|
|
|
45
50
|
import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
46
51
|
import { NotFoundSource } from '../NotFoundSource';
|
|
47
52
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
48
|
-
import { useState } from 'react';
|
|
49
|
-
const windowHeight = Dimensions.get('window').height;
|
|
50
53
|
const windowWidth = Dimensions.get('window').width;
|
|
51
54
|
|
|
52
55
|
export const ProductOptionsUI = (props: any) => {
|
|
@@ -454,6 +457,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
454
457
|
)
|
|
455
458
|
}
|
|
456
459
|
|
|
460
|
+
useEffect(() => {
|
|
461
|
+
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
462
|
+
scrollViewRef.current.scrollToEnd({ animated: true })
|
|
463
|
+
})
|
|
464
|
+
return () => {
|
|
465
|
+
keyboardDidShowListener.remove()
|
|
466
|
+
}
|
|
467
|
+
}, [])
|
|
468
|
+
|
|
469
|
+
|
|
457
470
|
return (
|
|
458
471
|
<SafeAreaView style={{ flex: 1 }}>
|
|
459
472
|
<TopHeader>
|
|
@@ -466,7 +479,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
466
479
|
ref={scrollViewRef}
|
|
467
480
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
468
481
|
stickyHeaderIndices={[2]}
|
|
469
|
-
onScroll={handleScroll}
|
|
482
|
+
onScroll={handleScroll}
|
|
483
|
+
>
|
|
470
484
|
<WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
|
|
471
485
|
{loading && !product ? (
|
|
472
486
|
<View style={styles.productHeaderSkeleton}>
|