ordering-ui-react-native 0.21.68 → 0.21.70
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/DriverMap/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +16 -8
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +105 -91
- package/themes/original/src/components/Wallets/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -382,7 +382,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
382
382
|
<View style={styles.view}>
|
|
383
383
|
<OIcon
|
|
384
384
|
style={styles.image}
|
|
385
|
-
|
|
385
|
+
src={typeof location.icon === 'number' ? location.icon : { uri: location.icon }}
|
|
386
386
|
width={25}
|
|
387
387
|
height={25}
|
|
388
388
|
/>
|
|
@@ -491,8 +491,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
491
491
|
{business?.categories?.length > 0 && isOpenFiltProducts && (
|
|
492
492
|
<FiltProductsContainer
|
|
493
493
|
style={{
|
|
494
|
-
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ?
|
|
495
|
-
top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
494
|
+
height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 10 : 0),
|
|
495
|
+
top: Platform.OS === 'ios' ? viewOrderButtonVisible ? (searchBarHeight - 10) + insets.top + 10 : (searchBarHeight - 10) + insets.top : searchBarHeight,
|
|
496
496
|
}}
|
|
497
497
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
498
498
|
>
|
|
@@ -217,7 +217,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
217
217
|
style={{ margin: 0, marginTop: 4 }}
|
|
218
218
|
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
219
219
|
>
|
|
220
|
-
{t(item
|
|
220
|
+
{t(item?.gateway?.toUpperCase(), item.name)}
|
|
221
221
|
</OText>
|
|
222
222
|
</PMItem>
|
|
223
223
|
</TouchableOpacity>
|
|
@@ -58,6 +58,8 @@ import NavBar from '../NavBar';
|
|
|
58
58
|
import { orderTypeList } from '../../utils';
|
|
59
59
|
import { ActionButton } from './ActionButton'
|
|
60
60
|
import { ExtraOptions } from './ExtraOptions'
|
|
61
|
+
import { IOScrollView } from 'react-native-intersection-observer';
|
|
62
|
+
|
|
61
63
|
const windowWidth = Dimensions.get('window').width;
|
|
62
64
|
|
|
63
65
|
|
|
@@ -286,14 +288,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
286
288
|
setQtyBy({ [val]: true, [!val]: false })
|
|
287
289
|
}
|
|
288
290
|
|
|
289
|
-
const onStateChange = useCallback((state) => {
|
|
291
|
+
const onStateChange = useCallback((state : string) => {
|
|
290
292
|
if (state === "ended") {
|
|
291
293
|
setPlaying(false);
|
|
292
294
|
}
|
|
293
295
|
}, []);
|
|
294
296
|
|
|
295
297
|
const togglePlaying = useCallback(() => {
|
|
296
|
-
setPlaying((prev) => !prev);
|
|
298
|
+
setPlaying((prev : any) => !prev);
|
|
297
299
|
}, []);
|
|
298
300
|
|
|
299
301
|
const onChangeProductCartQuantity = (quantity: number) => {
|
|
@@ -327,6 +329,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
327
329
|
let _optionLayout: any = {}
|
|
328
330
|
|
|
329
331
|
const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
|
|
332
|
+
if (suboptionsLength >= 200) {
|
|
333
|
+
return
|
|
334
|
+
}
|
|
330
335
|
_optionLayout = { ..._optionLayout }
|
|
331
336
|
const optionKey = 'id:' + optionId
|
|
332
337
|
_optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
|
|
@@ -436,6 +441,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
436
441
|
selOpt
|
|
437
442
|
}
|
|
438
443
|
|
|
444
|
+
const suboptionsLength = product.extras.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
|
|
445
|
+
|
|
439
446
|
return (
|
|
440
447
|
<SafeAreaView style={{ flex: 1 }}>
|
|
441
448
|
<View style={styles.wrapperNavbar}>
|
|
@@ -462,7 +469,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
462
469
|
</TopHeader>
|
|
463
470
|
</View>
|
|
464
471
|
{!error && (
|
|
465
|
-
<
|
|
472
|
+
<IOScrollView
|
|
466
473
|
ref={scrollViewRef}
|
|
467
474
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
468
475
|
stickyHeaderIndices={[2]}
|
|
@@ -488,7 +495,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
488
495
|
showsButtons={true}
|
|
489
496
|
style={styles.mainSwiper}
|
|
490
497
|
showsPagination={false}
|
|
491
|
-
onIndexChanged={(index) => handleChangeMainIndex(index)}
|
|
498
|
+
onIndexChanged={(index : any) => handleChangeMainIndex(index)}
|
|
492
499
|
prevButton={
|
|
493
500
|
<View style={styles.swiperButton}>
|
|
494
501
|
<IconAntDesign
|
|
@@ -510,7 +517,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
510
517
|
</View>
|
|
511
518
|
}
|
|
512
519
|
>
|
|
513
|
-
{gallery && gallery?.length > 0 && gallery.map((img, i) => (
|
|
520
|
+
{gallery && gallery?.length > 0 && gallery.map((img : any, i: number) => (
|
|
514
521
|
<View
|
|
515
522
|
style={styles.slide1}
|
|
516
523
|
key={i}
|
|
@@ -545,7 +552,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
545
552
|
paddingVertical: 15
|
|
546
553
|
}}
|
|
547
554
|
>
|
|
548
|
-
{gallery?.length > 1 && gallery.map((img, index) => (
|
|
555
|
+
{gallery?.length > 1 && gallery.map((img: any, index: number) => (
|
|
549
556
|
<TouchableOpacity
|
|
550
557
|
key={index}
|
|
551
558
|
onPress={() => handleClickThumb(index)}
|
|
@@ -727,7 +734,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
727
734
|
</OText>
|
|
728
735
|
</TouchableOpacity>
|
|
729
736
|
)}
|
|
730
|
-
{product?.extras?.map((extra: any) =>
|
|
737
|
+
{suboptionsLength < 200 && product?.extras?.map((extra: any) =>
|
|
731
738
|
<ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
|
|
732
739
|
)}
|
|
733
740
|
</ExtraOptionWrap>
|
|
@@ -842,6 +849,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
842
849
|
}
|
|
843
850
|
setIsScrollAvailable={setIsScrollAvailable}
|
|
844
851
|
error={errors[`id:${option.id}`]}
|
|
852
|
+
enableIntersection={suboptionsLength >= 200}
|
|
845
853
|
/>
|
|
846
854
|
);
|
|
847
855
|
},
|
|
@@ -882,7 +890,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
882
890
|
{!!error && error?.length > 0 && (
|
|
883
891
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
884
892
|
)}
|
|
885
|
-
</
|
|
893
|
+
</IOScrollView>
|
|
886
894
|
)}
|
|
887
895
|
{!loading && !error && product && (
|
|
888
896
|
<ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
Logo
|
|
20
20
|
} from './styles'
|
|
21
21
|
import { OIcon, OText } from '../shared'
|
|
22
|
+
import { InView } from 'react-native-intersection-observer'
|
|
23
|
+
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
22
24
|
|
|
23
25
|
export const ProductOptionSubOptionUI = (props: any) => {
|
|
24
26
|
const {
|
|
@@ -32,7 +34,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
32
34
|
changePosition,
|
|
33
35
|
disabled,
|
|
34
36
|
setIsScrollAvailable,
|
|
35
|
-
image
|
|
37
|
+
image,
|
|
38
|
+
enableIntersection
|
|
36
39
|
} = props
|
|
37
40
|
|
|
38
41
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
@@ -43,6 +46,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
43
46
|
const [{ parsePrice, optimizeImage }] = useUtils()
|
|
44
47
|
const [showMessage, setShowMessage] = useState(false)
|
|
45
48
|
const [isDirty, setIsDirty] = useState(false)
|
|
49
|
+
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
46
50
|
|
|
47
51
|
const iconsSize = 20
|
|
48
52
|
|
|
@@ -67,6 +71,10 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
const handleChangeInterSection = (inView: boolean) => {
|
|
75
|
+
setIsIntersectionObserver(inView)
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
useEffect(() => {
|
|
71
79
|
if (balance === option?.max && state?.selected && isDirty) {
|
|
72
80
|
setIsDirty(false)
|
|
@@ -81,104 +89,110 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
81
89
|
}, [balance])
|
|
82
90
|
|
|
83
91
|
return (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
<
|
|
87
|
-
{(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
state?.selected ? (
|
|
95
|
-
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
92
|
+
<InView onChange={(inView: boolean) => handleChangeInterSection(inView)} triggerOnce={true}>
|
|
93
|
+
{isIntersectionObserver ? (
|
|
94
|
+
<Container onPress={!((option?.with_half_option || option?.allow_suboption_quantity) && state?.selected) ? () => handleSuboptionClick() : null}>
|
|
95
|
+
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
96
|
+
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
97
|
+
state?.selected ? (
|
|
98
|
+
<OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
|
|
99
|
+
) : (
|
|
100
|
+
<OIcon src={theme.images.general.check_nor} color={theme.colors.disabled} width={16} />
|
|
101
|
+
)
|
|
96
102
|
) : (
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
state?.selected ? (
|
|
104
|
+
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
105
|
+
) : (
|
|
106
|
+
<OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
|
|
107
|
+
)
|
|
108
|
+
)}
|
|
109
|
+
{image && (
|
|
110
|
+
<Logo style={styles.logo}>
|
|
111
|
+
<FastImage
|
|
112
|
+
style={styles.icon}
|
|
113
|
+
source={{
|
|
114
|
+
uri: optimizeImage(image, 'h_100,c_limit'),
|
|
115
|
+
priority: FastImage.priority.normal,
|
|
116
|
+
}}
|
|
117
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
118
|
+
/>
|
|
119
|
+
</Logo>
|
|
120
|
+
)}
|
|
121
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={5} style={{ flex: 1 }}>
|
|
122
|
+
{suboption?.name}
|
|
123
|
+
</OText>
|
|
124
|
+
</IconControl>
|
|
125
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
126
|
+
<QuantityControl>
|
|
127
|
+
<>
|
|
128
|
+
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
129
|
+
<IconAntDesign
|
|
130
|
+
name='minuscircleo'
|
|
131
|
+
size={iconsSize}
|
|
132
|
+
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
133
|
+
/>
|
|
134
|
+
</Checkbox>
|
|
135
|
+
<OText size={12}>
|
|
136
|
+
{state.quantity}
|
|
137
|
+
</OText>
|
|
138
|
+
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
139
|
+
<IconAntDesign
|
|
140
|
+
name='pluscircleo'
|
|
141
|
+
size={iconsSize}
|
|
142
|
+
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
143
|
+
/>
|
|
144
|
+
</Checkbox>
|
|
145
|
+
</>
|
|
146
|
+
</QuantityControl>
|
|
99
147
|
)}
|
|
100
|
-
{
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
148
|
+
{option?.with_half_option && state?.selected && (
|
|
149
|
+
<PositionControl>
|
|
150
|
+
<>
|
|
151
|
+
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
152
|
+
<OIcon
|
|
153
|
+
src={theme.images.general.half_l}
|
|
154
|
+
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
155
|
+
width={20}
|
|
156
|
+
height={20}
|
|
157
|
+
style={styles.inverse}
|
|
158
|
+
/>
|
|
159
|
+
</Circle>
|
|
160
|
+
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
161
|
+
<OIcon
|
|
162
|
+
src={theme.images.general.half_f}
|
|
163
|
+
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
164
|
+
width={20}
|
|
165
|
+
height={20}
|
|
166
|
+
/>
|
|
167
|
+
</Circle>
|
|
168
|
+
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
169
|
+
<OIcon
|
|
170
|
+
src={theme.images.general.half_r}
|
|
171
|
+
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
172
|
+
width={20}
|
|
173
|
+
height={20}
|
|
174
|
+
/>
|
|
175
|
+
</Circle>
|
|
176
|
+
</>
|
|
177
|
+
</PositionControl>
|
|
111
178
|
)}
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
124
|
-
/>
|
|
125
|
-
</Checkbox>
|
|
126
|
-
<OText size={12}>
|
|
127
|
-
{state.quantity}
|
|
128
|
-
</OText>
|
|
129
|
-
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
130
|
-
<IconAntDesign
|
|
131
|
-
name='pluscircleo'
|
|
132
|
-
size={iconsSize}
|
|
133
|
-
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
134
|
-
/>
|
|
135
|
-
</Checkbox>
|
|
136
|
-
</>
|
|
137
|
-
</QuantityControl>
|
|
138
|
-
)}
|
|
139
|
-
{option?.with_half_option && state?.selected && (
|
|
140
|
-
<PositionControl>
|
|
141
|
-
<>
|
|
142
|
-
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
143
|
-
<OIcon
|
|
144
|
-
src={theme.images.general.half_l}
|
|
145
|
-
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
146
|
-
width={20}
|
|
147
|
-
height={20}
|
|
148
|
-
style={styles.inverse}
|
|
149
|
-
/>
|
|
150
|
-
</Circle>
|
|
151
|
-
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
152
|
-
<OIcon
|
|
153
|
-
src={theme.images.general.half_f}
|
|
154
|
-
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
155
|
-
width={20}
|
|
156
|
-
height={20}
|
|
157
|
-
/>
|
|
158
|
-
</Circle>
|
|
159
|
-
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
160
|
-
<OIcon
|
|
161
|
-
src={theme.images.general.half_r}
|
|
162
|
-
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
163
|
-
width={20}
|
|
164
|
-
height={20}
|
|
165
|
-
/>
|
|
166
|
-
</Circle>
|
|
167
|
-
</>
|
|
168
|
-
</PositionControl>
|
|
169
|
-
)}
|
|
170
|
-
{price > 0 && (
|
|
171
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ width: 70, maxWidth: 70 }}>
|
|
172
|
-
+ {parsePrice(price)}
|
|
173
|
-
</OText>
|
|
174
|
-
)}
|
|
175
|
-
</Container>
|
|
179
|
+
{price > 0 && (
|
|
180
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ width: 70, maxWidth: 70 }}>
|
|
181
|
+
+ {parsePrice(price)}
|
|
182
|
+
</OText>
|
|
183
|
+
)}
|
|
184
|
+
</Container>
|
|
185
|
+
) : (
|
|
186
|
+
<Placeholder>
|
|
187
|
+
<PlaceholderLine height={25} />
|
|
188
|
+
</Placeholder>
|
|
189
|
+
)}
|
|
176
190
|
{showMessage && (
|
|
177
191
|
<OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>
|
|
178
192
|
{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}
|
|
179
193
|
</OText>
|
|
180
194
|
)}
|
|
181
|
-
</
|
|
195
|
+
</InView>
|
|
182
196
|
)
|
|
183
197
|
}
|
|
184
198
|
|
|
@@ -129,7 +129,7 @@ const WalletsUI = (props: any) => {
|
|
|
129
129
|
flexDirection: !hideWalletsTheme ? 'column' : 'row',
|
|
130
130
|
justifyContent: !hideWalletsTheme ? 'flex-start' : 'space-between',
|
|
131
131
|
alignItems: !hideWalletsTheme ? 'flex-start' : 'center',
|
|
132
|
-
marginTop: !hideWalletsTheme ? 30 : 10,
|
|
132
|
+
marginTop: !hideWalletsTheme ? Platform.OS === 'ios' ? 20 : 30 : 10,
|
|
133
133
|
},
|
|
134
134
|
}}>
|
|
135
135
|
<NavBar
|