ordering-ui-react-native 0.15.21 → 0.15.24
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 +2 -2
- package/src/components/OrderDetails/index.tsx +24 -3
- package/src/types/index.tsx +1 -0
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/original/src/components/ProductForm/index.tsx +3 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.24",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-native-background-timer": "^2.4.1",
|
|
72
72
|
"react-native-bootsplash": "^3.2.3",
|
|
73
73
|
"react-native-calendar-picker": "^7.1.2",
|
|
74
|
-
|
|
74
|
+
"react-native-calendar-strip": "^2.2.1",
|
|
75
75
|
"react-native-color-matrix-image-filters": "^5.2.10",
|
|
76
76
|
"react-native-country-picker-modal": "^2.0.0",
|
|
77
77
|
"react-native-credit-card-input": "^0.4.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager, AppState } from 'react-native'
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -64,7 +64,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
64
64
|
isFromRoot,
|
|
65
65
|
driverLocation,
|
|
66
66
|
goToBusinessList,
|
|
67
|
-
onNavigationRedirect
|
|
67
|
+
onNavigationRedirect,
|
|
68
|
+
getOrder
|
|
68
69
|
} = props
|
|
69
70
|
|
|
70
71
|
const theme = useTheme()
|
|
@@ -108,6 +109,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
108
109
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
109
110
|
const [openOrderCreating, setOpenOrderCreating] = useState(false)
|
|
110
111
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
112
|
+
const appState = useRef(AppState.currentState)
|
|
113
|
+
|
|
111
114
|
const { order, loading, businessData, error } = props.order
|
|
112
115
|
|
|
113
116
|
const getOrderStatus = (s: string) => {
|
|
@@ -256,6 +259,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
256
259
|
})
|
|
257
260
|
}, [])
|
|
258
261
|
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
const onFocusApp = (nextAppState: any) => {
|
|
264
|
+
if (
|
|
265
|
+
appState.current.match(/inactive|background/) &&
|
|
266
|
+
nextAppState === "active"
|
|
267
|
+
) {
|
|
268
|
+
getOrder && getOrder()
|
|
269
|
+
}
|
|
270
|
+
appState.current = nextAppState;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
AppState.addEventListener("change", onFocusApp);
|
|
274
|
+
return () => {
|
|
275
|
+
AppState.removeEventListener('change', onFocusApp);
|
|
276
|
+
};
|
|
277
|
+
}, [])
|
|
278
|
+
|
|
279
|
+
|
|
259
280
|
return (
|
|
260
281
|
<OrderDetailsContainer keyboardShouldPersistTaps='handled'>
|
|
261
282
|
{order && order?.id && !error && !loading && (
|
package/src/types/index.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
BusinessController as BusinessSingleCard,
|
|
7
7
|
useUtils,
|
|
8
8
|
} from 'ordering-components/native';
|
|
9
|
+
import FastImage from 'react-native-fast-image'
|
|
9
10
|
|
|
10
11
|
import { Card, BusinessLogo } from './styles';
|
|
11
12
|
|
|
@@ -26,6 +27,16 @@ export const BusinessControllerUI = (props: any) => {
|
|
|
26
27
|
alignItems: 'center',
|
|
27
28
|
textAlign: 'center',
|
|
28
29
|
marginTop: 10
|
|
30
|
+
},
|
|
31
|
+
logoStyle: {
|
|
32
|
+
width: 120,
|
|
33
|
+
height: 120,
|
|
34
|
+
borderRadius: 8,
|
|
35
|
+
borderWidth: 1,
|
|
36
|
+
borderColor: theme.colors.border,
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
alignItems: 'center',
|
|
29
40
|
}
|
|
30
41
|
});
|
|
31
42
|
|
|
@@ -39,12 +50,22 @@ export const BusinessControllerUI = (props: any) => {
|
|
|
39
50
|
activeOpacity={1}
|
|
40
51
|
onPress={() => handleBusinessClick(business)}
|
|
41
52
|
>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
{business?.logo ? (
|
|
54
|
+
<FastImage
|
|
55
|
+
style={styles.logoStyle}
|
|
56
|
+
source={{
|
|
57
|
+
uri: business?.logo,
|
|
58
|
+
priority: FastImage.priority.high,
|
|
59
|
+
cache:FastImage.cacheControl.web
|
|
60
|
+
}}
|
|
61
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
62
|
+
/>
|
|
63
|
+
) : (
|
|
64
|
+
<BusinessLogo
|
|
65
|
+
source={theme.images.dummies.businessLogo}
|
|
66
|
+
resizeMode='contain'
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
48
69
|
<OText
|
|
49
70
|
size={WIDTH_SCREEN * 0.012}
|
|
50
71
|
numberOfLines={2}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { View, StyleSheet, ScrollView, TouchableOpacity } from 'react-native'
|
|
2
|
+
import { View, StyleSheet, ScrollView, TouchableOpacity, ImageBackground } from 'react-native'
|
|
3
3
|
import { BusinessAndProductList, useLanguage } from 'ordering-components/native'
|
|
4
4
|
import { BusinessProductsListingParams, Business } from '../../types'
|
|
5
5
|
import { OCard, OText, OIcon } from '../shared'
|
|
@@ -7,6 +7,7 @@ import GridContainer from '../../layouts/GridContainer'
|
|
|
7
7
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
8
8
|
import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
9
9
|
import styled, { useTheme } from 'styled-components/native';
|
|
10
|
+
import FastImage from 'react-native-fast-image'
|
|
10
11
|
|
|
11
12
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
12
13
|
const {navigation, businessState, resetInactivityTimeout, clearInactivityTimeout, bottomSheetVisibility } = props;
|
|
@@ -59,17 +60,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
59
60
|
);
|
|
60
61
|
|
|
61
62
|
const RenderCategories = ({ item, cardStyle, widthScreen }: any) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
const stylesCat = StyleSheet.create({
|
|
64
|
+
categoryStyle: {
|
|
65
|
+
height: 150,
|
|
66
|
+
borderRadius: 10,
|
|
67
|
+
padding: 10,
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
73
74
|
const WrapText = styled.View`
|
|
74
75
|
height: 90px;
|
|
75
76
|
display: flex;
|
|
@@ -78,6 +79,25 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
78
79
|
border-radius: 10px;
|
|
79
80
|
`
|
|
80
81
|
|
|
82
|
+
const Category = (props: any) => {
|
|
83
|
+
const imageProps = {
|
|
84
|
+
style: props.style,
|
|
85
|
+
source: props.source,
|
|
86
|
+
resizeMode: props.resizeMode,
|
|
87
|
+
}
|
|
88
|
+
return (
|
|
89
|
+
props.uri ? (
|
|
90
|
+
<FastImage {...imageProps}>
|
|
91
|
+
{props.children}
|
|
92
|
+
</FastImage>
|
|
93
|
+
) : (
|
|
94
|
+
<ImageBackground {...imageProps}>
|
|
95
|
+
{props.children}
|
|
96
|
+
</ImageBackground>
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
81
101
|
return (
|
|
82
102
|
<TouchableOpacity
|
|
83
103
|
key={item.id}
|
|
@@ -92,11 +112,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
92
112
|
}}
|
|
93
113
|
>
|
|
94
114
|
<Category
|
|
95
|
-
style={cardStyle}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
115
|
+
style={{ ...cardStyle, ...stylesCat.categoryStyle, width: widthScreen * 0.45 }}
|
|
116
|
+
uri={!!item.images}
|
|
117
|
+
source={!!item.images
|
|
118
|
+
? {
|
|
119
|
+
uri: item.images,
|
|
120
|
+
priority: FastImage.priority.high,
|
|
121
|
+
cache:FastImage.cacheControl.web
|
|
122
|
+
}
|
|
123
|
+
: theme.images.categories.all
|
|
124
|
+
}
|
|
125
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
100
126
|
>
|
|
101
127
|
{item?.inventoried && (
|
|
102
128
|
<View style={styles.soldOut}>
|
|
@@ -111,7 +137,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
111
137
|
mLeft={0}
|
|
112
138
|
size={32}
|
|
113
139
|
numberOfLines={1}
|
|
114
|
-
// mBottom={8}
|
|
115
140
|
style={{...props?.titleStyle}}
|
|
116
141
|
weight="bold"
|
|
117
142
|
>
|
|
@@ -121,7 +146,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
121
146
|
<OText
|
|
122
147
|
color={theme.colors.white}
|
|
123
148
|
numberOfLines={1}
|
|
124
|
-
// mBottom={4}
|
|
125
149
|
size={18}
|
|
126
150
|
style={{...props?.descriptionStyle}}
|
|
127
151
|
weight="400"
|
|
@@ -161,7 +185,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
161
185
|
const _renderCategories = (): React.ReactElement => (
|
|
162
186
|
<>
|
|
163
187
|
{_renderTitle(t('CATEGORIES', 'Categories'))}
|
|
164
|
-
<GridContainer
|
|
188
|
+
<GridContainer
|
|
165
189
|
style={{
|
|
166
190
|
paddingLeft: orientationState?.orientation === LANDSCAPE
|
|
167
191
|
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.004 :orientationState?.dimensions?.width * 0.008
|
|
@@ -171,9 +195,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
171
195
|
{_categories && _categories.map((category: any) => (
|
|
172
196
|
<OCard
|
|
173
197
|
key={category.id}
|
|
198
|
+
isCentered
|
|
199
|
+
isUri={!!category.image}
|
|
174
200
|
title={category?.name || ''}
|
|
175
|
-
image={category.
|
|
201
|
+
image={category.image ? {uri: category.image} : theme.images.categories.all}
|
|
176
202
|
style={{
|
|
203
|
+
borderRadius: 10,
|
|
177
204
|
width:
|
|
178
205
|
orientationState?.orientation === LANDSCAPE
|
|
179
206
|
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
|
|
@@ -156,13 +156,17 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
156
156
|
<OCard
|
|
157
157
|
key={product.id}
|
|
158
158
|
title={product?.name}
|
|
159
|
-
|
|
159
|
+
isUri={!!product.images}
|
|
160
|
+
image={product.images ? {uri: product.images} : theme.images.dummies.product}
|
|
161
|
+
price={parsePrice(product?.price)}
|
|
162
|
+
description={product?.description}
|
|
163
|
+
prevPrice={product?.offer_price > 0 && parsePrice(product?.offer_price)}
|
|
160
164
|
style={{
|
|
165
|
+
borderRadius: 10,
|
|
161
166
|
width: orientationState?.orientation === LANDSCAPE
|
|
162
167
|
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
|
|
163
168
|
: orientationState?.dimensions?.width * 0.20
|
|
164
169
|
}}
|
|
165
|
-
titleStyle={{marginTop: Platform.OS === 'ios' ? orientationState?.orientation === LANDSCAPE ? orientationState?.dimensions.height * 0.05 : orientationState?.dimensions.width * 0.05 : 0}}
|
|
166
170
|
onPress={() => {
|
|
167
171
|
resetInactivityTimeout()
|
|
168
172
|
if (isDrawer) {
|
|
@@ -176,9 +180,6 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
176
180
|
});
|
|
177
181
|
}
|
|
178
182
|
}}
|
|
179
|
-
{...(!!product?.description && { description: product?.description } )}
|
|
180
|
-
{...(!!product?.price && { price: parsePrice(product?.price) } )}
|
|
181
|
-
{...(product?.in_offer && { prevPrice: `$${product?.offer_price}` } )}
|
|
182
183
|
/>
|
|
183
184
|
))}
|
|
184
185
|
</GridContainer>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { TouchableOpacity, View, StyleSheet } from 'react-native'
|
|
3
|
-
import { LanguageSelector as LanguageSelectorController } from 'ordering-components/native'
|
|
2
|
+
import { TouchableOpacity, View, StyleSheet, ActivityIndicator } from 'react-native'
|
|
3
|
+
import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
|
|
4
4
|
import CountryPicker, { Flag } from 'react-native-country-picker-modal'
|
|
5
5
|
|
|
6
6
|
import { Container, LanguageItem } from './styles'
|
|
@@ -40,6 +40,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
40
40
|
(a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
+
const [orderState] = useOrder()
|
|
43
44
|
const [isCountryModalVisible, setCountryModalVisible] = useState(false);
|
|
44
45
|
|
|
45
46
|
const countryCodes = _languages?.map((item:any) => item.countryCode);
|
|
@@ -48,7 +49,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<>
|
|
51
|
-
{ languagesState.loading ?
|
|
52
|
+
{ languagesState.loading ?
|
|
52
53
|
(<Container>
|
|
53
54
|
<Placeholder style={{ width: 130, paddingTop: 10 }} Animation={Fade}>
|
|
54
55
|
<PlaceholderLine height={15}/>
|
|
@@ -66,8 +67,8 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
66
67
|
closeButtonStyle={styles.closeIcon}
|
|
67
68
|
renderFlagButton={() => (
|
|
68
69
|
<TouchableOpacity
|
|
69
|
-
onPress={() => setCountryModalVisible(true)}
|
|
70
|
-
disabled={
|
|
70
|
+
onPress={() => orderState.loading ? {} : setCountryModalVisible(true)}
|
|
71
|
+
// disabled={orderState.loading}
|
|
71
72
|
>
|
|
72
73
|
<LanguageItem>
|
|
73
74
|
<Flag
|
|
@@ -76,7 +77,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
76
77
|
countryCode={currentLanguageData?.countryCode}
|
|
77
78
|
/>
|
|
78
79
|
<OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
|
|
79
|
-
|
|
80
|
+
{orderState.loading ? (
|
|
81
|
+
<ActivityIndicator size="small" color={theme.colors.primary} style={{ marginLeft: 5 }} />
|
|
82
|
+
) : (
|
|
83
|
+
<MatarialIcon name='keyboard-arrow-down' size={24}/>
|
|
84
|
+
)}
|
|
80
85
|
</LanguageItem>
|
|
81
86
|
</TouchableOpacity>
|
|
82
87
|
)}
|
|
@@ -87,11 +92,10 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
|
87
92
|
renderItem: ({item} : any) => (
|
|
88
93
|
<TouchableOpacity
|
|
89
94
|
onPress={() => {
|
|
90
|
-
/* @ts-ignore */
|
|
91
95
|
handleChangeLanguage(item.value);
|
|
92
96
|
setCountryModalVisible(false);
|
|
93
97
|
}}
|
|
94
|
-
disabled={
|
|
98
|
+
disabled={orderState.loading}
|
|
95
99
|
>
|
|
96
100
|
<LanguageItem>
|
|
97
101
|
<View style={styles.flagsContainer} />
|
|
@@ -1,110 +1,144 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TextStyle,
|
|
2
|
+
import { TextStyle, ImageBackground, StyleSheet } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import FastImage from 'react-native-fast-image'
|
|
4
5
|
|
|
5
|
-
import styled from 'styled-components/native';
|
|
6
|
-
import OImage from './OImage';
|
|
6
|
+
import styled, { css } from 'styled-components/native';
|
|
7
7
|
import OText from './OText';
|
|
8
8
|
|
|
9
9
|
const CardContainer = styled.TouchableOpacity`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
position: relative;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
border-radius: 10px;
|
|
13
|
+
position: relative;
|
|
14
|
+
margin: 0 30px 30px 0;
|
|
15
|
+
align-self: flex-start;
|
|
13
16
|
`
|
|
14
17
|
|
|
15
|
-
const
|
|
16
|
-
|
|
18
|
+
const WrapPrice = styled.View`
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
align-items: center;
|
|
22
|
+
margin-top: 10px;
|
|
17
23
|
`
|
|
18
24
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const WrapImage = styled.View`
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 120px;
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
const WrapContent = styled.View`
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
${(props: any) => props.isCentered && css`
|
|
34
|
+
align-items: center;
|
|
35
|
+
`}
|
|
28
36
|
`
|
|
29
37
|
|
|
30
38
|
const OCard = (props: Props): React.ReactElement => {
|
|
31
39
|
const theme = useTheme()
|
|
32
40
|
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
textStyle: {
|
|
43
|
+
marginTop: 10
|
|
44
|
+
},
|
|
45
|
+
image: {
|
|
46
|
+
width: '100%',
|
|
47
|
+
height: '100%',
|
|
48
|
+
borderBottomLeftRadius: 0,
|
|
49
|
+
borderBottomRightRadius: 0,
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
33
53
|
return (
|
|
34
54
|
<CardContainer
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{props?.description && (
|
|
63
|
-
<OText
|
|
64
|
-
color={theme.colors.mediumGray}
|
|
65
|
-
numberOfLines={3}
|
|
66
|
-
mBottom={8}
|
|
67
|
-
style={{...props?.descriptionStyle}}
|
|
68
|
-
>
|
|
69
|
-
{props.description}
|
|
70
|
-
</OText>
|
|
55
|
+
activeOpacity={1}
|
|
56
|
+
style={props.style}
|
|
57
|
+
onPress={props?.onPress}
|
|
58
|
+
disabled={!props?.onPress}
|
|
59
|
+
>
|
|
60
|
+
<WrapImage>
|
|
61
|
+
{props.isUri ? (
|
|
62
|
+
<FastImage
|
|
63
|
+
style={[styles.image, props.style]}
|
|
64
|
+
source={{
|
|
65
|
+
uri: props.image?.uri,
|
|
66
|
+
priority: FastImage.priority.normal,
|
|
67
|
+
// cache:FastImage.cacheControl.web
|
|
68
|
+
}}
|
|
69
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
70
|
+
/>
|
|
71
|
+
) : (
|
|
72
|
+
<ImageBackground
|
|
73
|
+
style={[styles.image, props.style]}
|
|
74
|
+
source={props.image}
|
|
75
|
+
imageStyle={{
|
|
76
|
+
borderBottomLeftRadius: 0,
|
|
77
|
+
borderBottomRightRadius: 0,
|
|
78
|
+
borderRadius: 10
|
|
79
|
+
}}
|
|
80
|
+
resizeMode='cover'
|
|
81
|
+
/>
|
|
71
82
|
)}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
</WrapImage>
|
|
84
|
+
<WrapContent isCentered={props.isCentered}>
|
|
85
|
+
<OText
|
|
86
|
+
size={18}
|
|
87
|
+
numberOfLines={1}
|
|
88
|
+
ellipsizeMode='tail'
|
|
89
|
+
style={styles.textStyle}
|
|
90
|
+
>
|
|
91
|
+
{props.title}
|
|
92
|
+
</OText>
|
|
93
|
+
{!!props?.description && (
|
|
94
|
+
<OText
|
|
95
|
+
color={theme.colors.mediumGray}
|
|
96
|
+
size={18}
|
|
97
|
+
numberOfLines={3}
|
|
98
|
+
ellipsizeMode='tail'
|
|
99
|
+
style={styles.textStyle}
|
|
100
|
+
>
|
|
101
|
+
{props?.description}
|
|
102
|
+
</OText>
|
|
103
|
+
)}
|
|
104
|
+
<WrapPrice>
|
|
105
|
+
<OText
|
|
106
|
+
size={18}
|
|
107
|
+
>
|
|
108
|
+
{props.price}
|
|
109
|
+
</OText>
|
|
110
|
+
{props?.prevPrice && (
|
|
111
|
+
<OText
|
|
112
|
+
size={18}
|
|
113
|
+
color={theme.colors.mediumGray}
|
|
114
|
+
style={{
|
|
115
|
+
textDecorationLine: 'line-through',
|
|
116
|
+
textDecorationStyle: 'solid',
|
|
117
|
+
marginLeft: 20,
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
{props?.prevPrice}
|
|
121
|
+
</OText>
|
|
122
|
+
)}
|
|
123
|
+
</WrapPrice>
|
|
124
|
+
</WrapContent>
|
|
125
|
+
</CardContainer>
|
|
126
|
+
)
|
|
95
127
|
}
|
|
96
128
|
|
|
97
129
|
interface Props {
|
|
98
130
|
badgeText?: string;
|
|
131
|
+
isUri?: boolean;
|
|
99
132
|
onPress?(): void;
|
|
100
|
-
image:
|
|
133
|
+
image: any;
|
|
134
|
+
isCentered?: any;
|
|
101
135
|
title: string;
|
|
102
136
|
titleStyle?: TextStyle;
|
|
103
137
|
description?: string;
|
|
104
138
|
descriptionStyle?: TextStyle;
|
|
105
139
|
price?: string;
|
|
106
140
|
prevPrice?: string;
|
|
107
|
-
style?:
|
|
141
|
+
style?: any;
|
|
108
142
|
}
|
|
109
143
|
|
|
110
144
|
export default OCard;
|
|
@@ -991,14 +991,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
991
991
|
? t('UPDATE', 'Update')
|
|
992
992
|
: t('ADD', 'Add')
|
|
993
993
|
}`}
|
|
994
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order}
|
|
994
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
995
995
|
textStyle={{
|
|
996
996
|
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
997
997
|
fontSize: orderState.loading || editMode ? 10 : 14
|
|
998
998
|
}}
|
|
999
999
|
style={{
|
|
1000
|
-
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.lightGray : theme.colors.primary,
|
|
1001
|
-
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.white : theme.colors.primary,
|
|
1000
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
|
|
1001
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
|
|
1002
1002
|
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
1003
1003
|
borderRadius: 7.6,
|
|
1004
1004
|
height: 44,
|
|
@@ -40,9 +40,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
40
40
|
|
|
41
41
|
const handleSuboptionClick = () => {
|
|
42
42
|
toggleSelect()
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
if (balance === option?.max - 1 && !state.selected) {
|
|
44
45
|
scrollDown(option?.id)
|
|
45
46
|
}
|
|
47
|
+
|
|
46
48
|
if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
|
|
47
49
|
setShowMessage(true)
|
|
48
50
|
}
|