ordering-ui-react-native 0.16.48 → 0.16.49
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/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -2
- package/themes/original/src/components/BusinessController/index.tsx +115 -107
- package/themes/original/src/components/BusinessListingSearch/index.tsx +26 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +20 -19
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -2
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +54 -5
- package/themes/original/src/components/OrdersOption/index.tsx +10 -3
- package/themes/original/src/components/SingleOrderCard/index.tsx +89 -96
- package/themes/original/src/components/SingleProductCard/index.tsx +102 -93
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
useLanguage,
|
|
4
4
|
useConfig,
|
|
@@ -10,6 +10,8 @@ import { useTheme } from 'styled-components/native';
|
|
|
10
10
|
import { SingleProductCardParams } from '../../types';
|
|
11
11
|
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
12
12
|
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
|
|
13
|
+
import { InView } from 'react-native-intersection-observer'
|
|
14
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
13
15
|
import { OText } from '../shared';
|
|
14
16
|
import FastImage from 'react-native-fast-image'
|
|
15
17
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
@@ -87,7 +89,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
87
89
|
const [stateConfig] = useConfig();
|
|
88
90
|
const [{ parsePrice, optimizeImage }] = useUtils();
|
|
89
91
|
const [orderState] = useOrder();
|
|
90
|
-
|
|
92
|
+
const [isIntersectionObserver, setIsIntersectionObserver] = useState(false)
|
|
91
93
|
const editMode = typeof product?.code !== 'undefined';
|
|
92
94
|
|
|
93
95
|
const removeToBalance = editMode ? product?.quantity : 0;
|
|
@@ -117,103 +119,110 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
return (
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<View style={styles.titleWrapper}>
|
|
136
|
-
<OText
|
|
137
|
-
size={12}
|
|
138
|
-
weight={'500'}
|
|
139
|
-
numberOfLines={1}
|
|
140
|
-
ellipsizeMode="tail"
|
|
141
|
-
style={styles.line18}>
|
|
142
|
-
{product?.name}
|
|
143
|
-
</OText>
|
|
144
|
-
<TouchableOpacity
|
|
145
|
-
onPress={handleChangeFavorite}
|
|
146
|
-
>
|
|
147
|
-
<IconAntDesign
|
|
148
|
-
name={product?.favorite ? 'heart' : 'hearto'}
|
|
149
|
-
color={theme.colors.danger5}
|
|
150
|
-
size={18}
|
|
151
|
-
/>
|
|
152
|
-
</TouchableOpacity>
|
|
153
|
-
</View>
|
|
154
|
-
<PricesContainer>
|
|
155
|
-
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
156
|
-
{product?.offer_price !== null && product?.in_offer && (
|
|
157
|
-
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
122
|
+
<InView style={{ minHeight: 140 }} triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(true)}>
|
|
123
|
+
{isIntersectionObserver && (
|
|
124
|
+
<CardContainer
|
|
125
|
+
style={[
|
|
126
|
+
styles.container,
|
|
127
|
+
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
128
|
+
(style && { ...style }),
|
|
129
|
+
]}
|
|
130
|
+
onPress={() => onProductClick?.(product)}>
|
|
131
|
+
{productAddedToCartLength > 0 && (
|
|
132
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
133
|
+
transform: [{ translateX: 10 }, { translateY: -10 }],
|
|
134
|
+
}]}>
|
|
135
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
136
|
+
</QuantityContainer>
|
|
158
137
|
)}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
138
|
+
<CardInfo>
|
|
139
|
+
<View style={styles.titleWrapper}>
|
|
140
|
+
<OText
|
|
141
|
+
size={12}
|
|
142
|
+
weight={'500'}
|
|
143
|
+
numberOfLines={1}
|
|
144
|
+
ellipsizeMode="tail"
|
|
145
|
+
style={styles.line18}>
|
|
146
|
+
{product?.name}
|
|
147
|
+
</OText>
|
|
148
|
+
<TouchableOpacity
|
|
149
|
+
onPress={handleChangeFavorite}
|
|
150
|
+
>
|
|
151
|
+
<IconAntDesign
|
|
152
|
+
name={product?.favorite ? 'heart' : 'hearto'}
|
|
153
|
+
color={theme.colors.danger5}
|
|
154
|
+
size={18}
|
|
155
|
+
/>
|
|
156
|
+
</TouchableOpacity>
|
|
157
|
+
</View>
|
|
158
|
+
<PricesContainer>
|
|
159
|
+
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
160
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
161
|
+
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
162
|
+
)}
|
|
163
|
+
</PricesContainer>
|
|
176
164
|
<OText
|
|
177
165
|
size={10}
|
|
178
|
-
weight={'400'}
|
|
179
|
-
color={theme.colors.white}
|
|
180
166
|
numberOfLines={2}
|
|
181
|
-
ellipsizeMode=
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{product?.
|
|
167
|
+
ellipsizeMode="tail"
|
|
168
|
+
color={theme.colors.textSecondary}
|
|
169
|
+
style={styles.line15}>
|
|
170
|
+
{product?.description}
|
|
185
171
|
</OText>
|
|
186
|
-
</
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
172
|
+
</CardInfo>
|
|
173
|
+
<LogoWrapper>
|
|
174
|
+
{product?.ribbon?.enabled && (
|
|
175
|
+
<RibbonBox
|
|
176
|
+
bgColor={product?.ribbon?.color}
|
|
177
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
178
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
179
|
+
>
|
|
180
|
+
<OText
|
|
181
|
+
size={10}
|
|
182
|
+
weight={'400'}
|
|
183
|
+
color={theme.colors.white}
|
|
184
|
+
numberOfLines={2}
|
|
185
|
+
ellipsizeMode='tail'
|
|
186
|
+
lineHeight={13}
|
|
187
|
+
>
|
|
188
|
+
{product?.ribbon?.text}
|
|
189
|
+
</OText>
|
|
190
|
+
</RibbonBox>
|
|
191
|
+
)}
|
|
192
|
+
{product?.images ? (
|
|
193
|
+
<>
|
|
194
|
+
{isIntersectionObserver && (
|
|
195
|
+
<FastImage
|
|
196
|
+
style={styles.productStyle}
|
|
197
|
+
source={{
|
|
198
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
199
|
+
priority: FastImage.priority.normal,
|
|
200
|
+
}}
|
|
201
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
</>
|
|
205
|
+
) : (
|
|
206
|
+
<FastImage
|
|
207
|
+
style={styles.productStyle}
|
|
208
|
+
source={{
|
|
209
|
+
uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
|
|
210
|
+
priority: FastImage.priority.normal,
|
|
211
|
+
}}
|
|
212
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
215
|
+
</LogoWrapper>
|
|
216
|
+
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
217
|
+
<SoldOut>
|
|
218
|
+
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
219
|
+
{t('SOLD_OUT', 'SOLD OUT')}
|
|
220
|
+
</OText>
|
|
221
|
+
</SoldOut>
|
|
222
|
+
)}
|
|
223
|
+
</CardContainer>
|
|
215
224
|
)}
|
|
216
|
-
</
|
|
225
|
+
</InView >
|
|
217
226
|
);
|
|
218
227
|
}, SingleProductCardPropsAreEqual);
|
|
219
228
|
|