ordering-ui-react-native 0.15.22 → 0.15.25

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.22",
3
+ "version": "0.15.25",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -71,10 +71,11 @@
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
- "react-native-calendar-strip": "^2.2.5",
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",
78
+ "react-native-device-info": "^8.7.1",
78
79
  "react-native-document-picker": "^5.2.0",
79
80
  "react-native-elements": "^3.0.0-alpha.1",
80
81
  "react-native-fast-image": "^8.3.3",
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions } from 'react-native'
2
+ import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions, Platform, PlatformIOSStatic } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
4
  import { BusinessTypeFilter as BusinessTypeFilterController, useLanguage } from 'ordering-components/native'
5
5
 
@@ -8,6 +8,7 @@ import { OIcon, OText, OModal } from '../shared'
8
8
  import { BusinessTypeFilterParams } from '../../types'
9
9
  import { useTheme } from 'styled-components/native'
10
10
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
11
+ import DeviceInfo from 'react-native-device-info';
11
12
 
12
13
  const windowWidth = Dimensions.get('window').width;
13
14
 
@@ -18,6 +19,10 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
18
19
  handleChangeBusinessType,
19
20
  } = props;
20
21
 
22
+ const platformIOS = Platform as PlatformIOSStatic
23
+ const isIpad = platformIOS.isPad
24
+ const isTablet = DeviceInfo.isTablet();
25
+
21
26
  const theme = useTheme();
22
27
  const [, t] = useLanguage();
23
28
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
@@ -122,7 +127,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
122
127
  {t('BUSINESS_CATEGORIES', 'Business Categories')}
123
128
  </OText>
124
129
  </BusinessCategoriesTitle>
125
- <BusinessCategories>
130
+ <BusinessCategories
131
+ mt={(isIpad || isTablet) ? 65 : null}
132
+ >
126
133
  {typesState?.types.slice(0, 3).map((type: any) => (
127
134
  <RenderTypes
128
135
  key={type.id}
@@ -18,7 +18,7 @@ export const BusinessCategories = styled.View`
18
18
  display: flex;
19
19
  flex-direction: row;
20
20
  justify-content: space-between;
21
- margin: 10px 0px;
21
+ margin: ${(props: any) => props.mt ?? 10}px 0px 10px;
22
22
  width: 100%;
23
23
  `
24
24
  export const Category = styled.View`
@@ -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
- <BusinessLogo
43
- source={business?.logo ? {
44
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
45
- } : theme.images.dummies.businessLogo}
46
- resizeMode='contain'
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}
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components/native';
3
3
  export const Card = styled.TouchableOpacity`
4
4
  display: flex;
5
5
  flex-direction: column;
6
- justify-content: center;
6
+ justify-content: flex-start;
7
7
  align-items: center;
8
8
  margin: 0 15px 20px;
9
9
  width: 120px;
@@ -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 Category = styled.ImageBackground`
63
- position: relative;
64
- height: 150px;
65
- width: ${(props: any) => props.w * 0.45}px;
66
- border-radius: 10px;
67
- padding: 10px;
68
- display: flex;
69
- flex-direction: column;
70
- justify-content: center;
71
- align-items: center;
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
- source={item.images ? {uri: item.images} : theme.images.categories.all}
97
- resizeMode="cover"
98
- w={widthScreen}
99
- borderRadius={16}
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.images ? {uri: category.images} : theme.images.categories.all}
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
- image={{ uri: product?.images }}
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={languagesState.loading}
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
- <MatarialIcon name='keyboard-arrow-down' size={24}/>
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={languagesState.loading}
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, ViewStyle, Platform } from 'react-native';
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
- width: 21%;
11
- margin: 10px 20px;
12
- overflow: hidden;
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 CardBody = styled.View`
16
- padding: 4%;
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 CardBadge = styled.Text`
20
- padding: 2% 4%;
21
- position: absolute;
22
- background-color: ${(props: any) => props.theme.theme.colors.primary};
23
- z-index: 100;
24
- border-radius: 5px;
25
- color: #fff;
26
- font-weight: bold;
27
- margin: 10px 0;
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
- style={{...props.style}}
36
- onPress={props?.onPress}
37
- disabled={!props?.onPress}
38
- activeOpacity={1}
39
- >
40
- {props?.badgeText && (
41
- <CardBadge>
42
- {props?.badgeText}
43
- </CardBadge>
44
- )}
45
- <OImage
46
- source={props.image}
47
- height={120}
48
- resizeMode="cover"
49
- borderRadius={16}
50
- />
51
- <CardBody>
52
- <OText
53
- mLeft={0}
54
- size={18}
55
- numberOfLines={2}
56
- mBottom={8}
57
- style={{...props?.titleStyle}}
58
- >
59
- {props.title}
60
- </OText>
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
- {props?.price && (
74
- <OText>
75
- <OText
76
- color={theme.colors.primary}
77
- weight="bold"
78
- >
79
- {props.price}
80
- </OText>
81
-
82
- <OText
83
- color={theme.colors.mediumGray}
84
- size={12}
85
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
86
- >
87
- {props?.prevPrice ? ` ${props?.prevPrice} ` : ''}
88
- </OText>
89
- </OText>
90
- )}
91
-
92
- </CardBody>
93
- </CardContainer>
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: string | { uri: string };
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?: ViewStyle;
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
- if (error) {
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
  }