ordering-ui-react-native 0.17.16-release → 0.17.17-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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, TouchableOpacity, Linking, Pressable, Image } from 'react-native';
|
|
3
3
|
import FastImage from 'react-native-fast-image'
|
|
4
4
|
import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
BusinessInfo,
|
|
22
22
|
BusinessInfoItem,
|
|
23
23
|
WrapReviews,
|
|
24
|
-
WrapBusinessInfo,
|
|
25
24
|
TitleWrapper,
|
|
26
25
|
RibbonBox,
|
|
27
26
|
SocialListWrapper
|
|
@@ -46,6 +45,7 @@ export const BusinessBasicInformation = (
|
|
|
46
45
|
const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
|
|
47
46
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
48
47
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
48
|
+
const [imageRealSize, setImageRealSize] = useState({ width: 16, height: 9, loading: true })
|
|
49
49
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
50
50
|
const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
51
51
|
const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
|
|
@@ -62,7 +62,7 @@ export const BusinessBasicInformation = (
|
|
|
62
62
|
height: 150,
|
|
63
63
|
},
|
|
64
64
|
headerStyle: {
|
|
65
|
-
|
|
65
|
+
aspectRatio: imageRealSize?.width / imageRealSize?.height
|
|
66
66
|
},
|
|
67
67
|
logoStyle: {
|
|
68
68
|
width: 72,
|
|
@@ -101,11 +101,11 @@ export const BusinessBasicInformation = (
|
|
|
101
101
|
borderRadius: 3,
|
|
102
102
|
borderColor: theme.colors.border,
|
|
103
103
|
borderWidth: isChewLayout ? 0 : 1,
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
104
|
+
width: 30,
|
|
105
|
+
height: 30,
|
|
106
106
|
justifyContent: 'center',
|
|
107
107
|
alignItems: 'center',
|
|
108
|
-
marginRight:
|
|
108
|
+
marginRight: 10,
|
|
109
109
|
marginBottom: 7
|
|
110
110
|
},
|
|
111
111
|
tiktokIcon: {
|
|
@@ -166,7 +166,7 @@ export const BusinessBasicInformation = (
|
|
|
166
166
|
<MaterialComIcon
|
|
167
167
|
name={iconTitle}
|
|
168
168
|
color={isChewLayout ? theme.colors.black : theme.colors.textNormal}
|
|
169
|
-
size={isChewLayout ?
|
|
169
|
+
size={isChewLayout ? 25 : 22}
|
|
170
170
|
/>
|
|
171
171
|
</TouchableOpacity>
|
|
172
172
|
)
|
|
@@ -196,6 +196,20 @@ export const BusinessBasicInformation = (
|
|
|
196
196
|
}
|
|
197
197
|
}, [businessState?.business])
|
|
198
198
|
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
const bannerImage = header || businessState?.business?.header
|
|
201
|
+
if (!bannerImage) {
|
|
202
|
+
setImageRealSize({ width: 16, height: 9, loading: false })
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
Image.getSize(bannerImage, (width: number, height: number) => {
|
|
206
|
+
setImageRealSize({ width: width, height: height, loading: false });
|
|
207
|
+
}, (error: any) => {
|
|
208
|
+
setImageRealSize({ ...imageRealSize, loading: false });
|
|
209
|
+
console.log(error);
|
|
210
|
+
});
|
|
211
|
+
}, [header, businessState?.business?.header])
|
|
212
|
+
|
|
199
213
|
const SocialIcons = () => {
|
|
200
214
|
return (
|
|
201
215
|
<>
|
|
@@ -284,18 +298,13 @@ export const BusinessBasicInformation = (
|
|
|
284
298
|
? styles.businesInfoheaderStyle
|
|
285
299
|
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
300
|
}
|
|
287
|
-
{...(!loading && {
|
|
288
|
-
source: (header || businessState?.business?.header) ? {
|
|
289
|
-
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header
|
|
301
|
+
{...(!loading && !imageRealSize?.loading && {
|
|
302
|
+
source: (header || businessState?.business?.header || typeof theme?.images?.dummies?.businessHeader === 'string') ? {
|
|
303
|
+
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header || theme?.images?.dummies?.businessHeader
|
|
290
304
|
} : theme?.images?.dummies?.businessHeader
|
|
291
305
|
})}
|
|
292
306
|
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
293
307
|
>
|
|
294
|
-
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
295
|
-
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
296
|
-
<OIcon src={theme.images.general.info} width={24} />
|
|
297
|
-
</WrapBusinessInfo>
|
|
298
|
-
)}
|
|
299
308
|
{isChewLayout && !loading && (
|
|
300
309
|
<View style={styles.headerChewStyle}>
|
|
301
310
|
<OText size={24} weight={'600'} mBottom={-5}>
|
|
@@ -317,21 +326,31 @@ export const BusinessBasicInformation = (
|
|
|
317
326
|
{!hideLogo && (
|
|
318
327
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
319
328
|
{!isBusinessInfoShow && (
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
style={styles.logoStyle}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
<>
|
|
330
|
+
{loading ? (
|
|
331
|
+
<View style={styles.logoStyle}>
|
|
332
|
+
<Placeholder Animation={Fade}>
|
|
333
|
+
<PlaceholderLine height={72} style={{ borderRadius: 8 }} />
|
|
334
|
+
</Placeholder>
|
|
335
|
+
</View>
|
|
336
|
+
) : (
|
|
337
|
+
logo || businessState?.business?.logo || typeof theme.images.dummies.businessLogo === 'string' ?
|
|
338
|
+
<FastImage
|
|
339
|
+
style={styles.logoStyle}
|
|
340
|
+
source={{
|
|
341
|
+
uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit') || theme.images.dummies.businessLogo,
|
|
342
|
+
priority: FastImage.priority.high,
|
|
343
|
+
cache: FastImage.cacheControl.web
|
|
344
|
+
}}
|
|
345
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
346
|
+
/>
|
|
347
|
+
:
|
|
348
|
+
<OIcon
|
|
349
|
+
src={theme?.images?.dummies?.businessLogo}
|
|
350
|
+
style={styles.logoStyle}
|
|
351
|
+
/>
|
|
352
|
+
)}
|
|
353
|
+
</>
|
|
335
354
|
)}
|
|
336
355
|
</BusinessLogo>
|
|
337
356
|
)}
|
|
@@ -453,13 +472,28 @@ export const BusinessBasicInformation = (
|
|
|
453
472
|
</>
|
|
454
473
|
)}
|
|
455
474
|
{!hideReviewsPopup && (
|
|
456
|
-
|
|
475
|
+
<>
|
|
476
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
477
|
+
<OText
|
|
478
|
+
color={theme.colors.primary}
|
|
479
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
480
|
+
size={12}
|
|
481
|
+
>
|
|
482
|
+
{t('REVIEWS', 'Reviews')}
|
|
483
|
+
</OText>
|
|
484
|
+
</TouchableOpacity>
|
|
485
|
+
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
486
|
+
</>
|
|
487
|
+
)}
|
|
488
|
+
|
|
489
|
+
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
490
|
+
<TouchableOpacity onPress={() => handleClickBusinessInformation()}>
|
|
457
491
|
<OText
|
|
458
492
|
color={theme.colors.primary}
|
|
459
493
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
460
494
|
size={12}
|
|
461
495
|
>
|
|
462
|
-
{t('
|
|
496
|
+
{t('INFORMATION', 'Information')}
|
|
463
497
|
</OText>
|
|
464
498
|
</TouchableOpacity>
|
|
465
499
|
)}
|
|
@@ -8,9 +8,6 @@ export const BusinessContainer = styled.View`
|
|
|
8
8
|
export const BusinessHeader = styled.ImageBackground`
|
|
9
9
|
width: 100%;
|
|
10
10
|
position: relative;
|
|
11
|
-
max-height: 258px;
|
|
12
|
-
height: 258px;
|
|
13
|
-
resize-mode: cover;
|
|
14
11
|
`;
|
|
15
12
|
export const BusinessLogo = styled.View`
|
|
16
13
|
position: absolute;
|