ordering-ui-react-native 0.14.54 → 0.14.57

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.
Files changed (25) hide show
  1. package/package.json +1 -1
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/StripeElementsForm/index.tsx +28 -13
  4. package/src/components/TaxInformation/index.tsx +1 -1
  5. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  6. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  7. package/themes/original/index.tsx +2 -0
  8. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  9. package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
  10. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -2
  11. package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
  12. package/themes/original/src/components/BusinessesListing/index.tsx +5 -5
  13. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
  14. package/themes/original/src/components/LogoutButton/index.tsx +2 -2
  15. package/themes/original/src/components/MomentOption/index.tsx +209 -196
  16. package/themes/original/src/components/MomentOption/styles.tsx +18 -42
  17. package/themes/original/src/components/ProductForm/index.tsx +6 -3
  18. package/themes/original/src/components/ProductOptionSubOption/index.tsx +51 -49
  19. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
  20. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  21. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
  22. package/themes/original/src/components/TaxInformation/index.tsx +1 -1
  23. package/themes/original/src/components/VerifyEmail/index.tsx +303 -0
  24. package/themes/original/src/components/VerifyEmail/styles.tsx +77 -0
  25. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,18 +1,18 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
2
- import moment, { Moment } from 'moment';
1
+ import React, { useState, useEffect } from 'react';
2
+ import moment from 'moment';
3
+ import CalendarStrip from 'react-native-calendar-strip'
3
4
  import {
4
5
  useLanguage,
5
6
  useConfig,
6
- useUtils,
7
7
  useOrder,
8
8
  MomentOption as MomentOptionController,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
11
12
  import {
12
- ImageStore,
13
13
  StyleSheet,
14
- useWindowDimensions,
15
14
  View,
15
+ TouchableOpacity
16
16
  } from 'react-native';
17
17
  import Spinner from 'react-native-loading-spinner-overlay';
18
18
  import { MomentOptionParams } from '../../types';
@@ -20,25 +20,17 @@ import NavBar from '../NavBar';
20
20
  import { OButton, OIcon, OText } from '../shared';
21
21
  import { Container } from '../../layouts/Container';
22
22
  import {
23
- HeaderTitle,
24
23
  WrapSelectOption,
25
- Days,
26
- Day,
27
- WrapHours,
28
- Hours,
29
- Hour,
30
- WrapDelveryTime,
24
+ OrderTimeWrapper,
25
+ TimeListWrapper,
26
+ TimeContentWrapper,
27
+ TimeItem
31
28
  } from './styles';
32
- import CalendarPicker from 'react-native-calendar-picker';
33
- import { TouchableRipple } from 'react-native-paper';
34
29
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
35
- import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
36
- import SelectDropdown from 'react-native-select-dropdown';
37
30
 
38
31
  const MomentOptionUI = (props: MomentOptionParams) => {
39
32
  const {
40
33
  navigation,
41
- nopadding,
42
34
  datesList,
43
35
  hoursList,
44
36
  dateSelected,
@@ -84,12 +76,62 @@ const MomentOptionUI = (props: MomentOptionParams) => {
84
76
  paddingHorizontal: 16,
85
77
  flexDirection: 'row',
86
78
  alignItems: 'center'
79
+ },
80
+ calendar: {
81
+ paddingBottom: 15,
82
+ borderBottomWidth: 1,
83
+ borderColor: theme.colors.backgroundGray200,
84
+ height: 100
85
+ },
86
+ calendarHeaderContainer: {
87
+ flex: 1,
88
+ justifyContent: 'flex-start',
89
+ textAlign: 'left',
90
+ marginBottom: 17,
91
+ borderBottomWidth: 1,
92
+ borderColor: theme.colors.backgroundGray200
93
+ },
94
+ calendarHeader: {
95
+ color: '#344050',
96
+ alignSelf: 'flex-start',
97
+ fontSize: 14,
98
+ fontWeight: '400'
99
+ },
100
+ dateNumber: {
101
+ color: '#B1BCCC',
102
+ fontSize: 16,
103
+ fontWeight: '500',
104
+ },
105
+ dateName: {
106
+ color: '#B1BCCC',
107
+ fontSize: 12,
108
+ textTransform: 'capitalize',
109
+ },
110
+ highlightDateName: {
111
+ color: '#344050',
112
+ fontSize: 12,
113
+ textTransform: 'capitalize',
114
+ },
115
+ highlightDateNumber: {
116
+ color: '#344050',
117
+ fontSize: 16,
118
+ textTransform: 'capitalize',
119
+ },
120
+ disabledDateName: {
121
+ color: '#B1BCCC',
122
+ fontSize: 10,
123
+ textTransform: 'capitalize',
124
+ opacity: 1,
125
+ },
126
+ disabledDateNumber: {
127
+ color: '#B1BCCC',
128
+ fontSize: 14,
129
+ fontWeight: '500'
87
130
  }
88
131
  });
89
132
 
90
133
  const [, t] = useLanguage();
91
134
  const [{ configs }] = useConfig();
92
- const [{ parseTime }] = useUtils();
93
135
  const [orderState] = useOrder();
94
136
  const [optionSelected, setOptionSelected] = useState({
95
137
  isAsap: false,
@@ -99,14 +141,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
99
141
  isLoading: 0,
100
142
  isEditing: false,
101
143
  });
102
- const { width } = useWindowDimensions();
103
144
  const { bottom } = useSafeAreaInsets();
104
145
 
105
- const [toggleTime, setToggleTime] = useState(false);
106
- const [selectedTime, setSelectedTime] = useState(timeSelected);
107
- const [minDate, setMinDate] = useState(new Date())
108
- const [maxDate, setMaxDate] = useState(new Date)
109
- const [alert, setAlert] = useState<any>({ show: false })
146
+ const [selectedTime, setSelectedTime] = useState(null);
147
+ const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
148
+ const [selectDate, setSelectedDate] = useState<any>(null)
110
149
 
111
150
  const goToBack = () => navigation?.canGoBack() && navigation.goBack();
112
151
 
@@ -134,19 +173,6 @@ const MomentOptionUI = (props: MomentOptionParams) => {
134
173
  .utc()
135
174
  .format('YYYY-MM-DD HH:mm:ss');
136
175
 
137
- const getTwoChar = (ori: string) => {
138
- return ori.substring(0, 2);
139
- };
140
- const weekDays = [
141
- getTwoChar(t('SUNDAY_ABBREVIATION', 'Su')),
142
- getTwoChar(t('MONDAY_ABBREVIATION', 'Mo')),
143
- getTwoChar(t('TUESDAY_ABBREVIATION', 'Tu')),
144
- getTwoChar(t('WEDNESDAY_ABBREVIATION', 'We')),
145
- getTwoChar(t('THURSDAY_ABBREVIATION', 'Th')),
146
- getTwoChar(t('FRIDAY_ABBREVIATION', 'Fr')),
147
- getTwoChar(t('SATURDAY_ABBREVIATION', 'Sa')),
148
- ];
149
-
150
176
  useEffect(() => {
151
177
  if (orderState.options?.moment) {
152
178
  setOptionSelected({ isAsap: false, isSchedule: true });
@@ -168,176 +194,163 @@ const MomentOptionUI = (props: MomentOptionParams) => {
168
194
  }
169
195
  }, [momentState.isLoading]);
170
196
 
171
- const customDayHeaderStylesCallback = () => {
172
- return {
173
- textStyle: {
174
- color: theme.colors.disabled,
175
- fontSize: 12,
176
- },
177
- };
178
- };
197
+ const onSelectDate = (val: any) => {
198
+ setSelectedDate(val)
199
+ if (handleChangeDate) handleChangeDate(moment(val).format('YYYY-MM-DD'))
200
+ }
201
+
202
+ const LeftSelector = () => {
203
+ return (
204
+ <View style={{ height: '100%', justifyContent: 'flex-end' }}>
205
+ <IconAntDesign
206
+ name='caretleft'
207
+ color={theme.colors.textNormal}
208
+ size={16}
209
+ />
210
+ </View>
211
+ )
212
+ }
213
+
214
+ const RightSelector = () => {
215
+ return (
216
+ <View style={{ height: '100%', justifyContent: 'flex-end' }}>
217
+ <IconAntDesign
218
+ name='caretright'
219
+ color={theme.colors.textNormal}
220
+ size={16}
221
+ />
222
+ </View>
223
+ )
224
+ }
179
225
 
180
226
  useEffect(() => {
181
227
  if (datesList?.length > 0) {
182
- const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
183
- const minDateParts = _datesList[0].split('-')
184
- const maxDateParts = _datesList[_datesList.length - 1].split('-')
185
- const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
186
- const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
187
- setMinDate(_minDate)
188
- setMaxDate(_maxDate)
228
+ const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
229
+ const minDateParts = _datesList[0].split('-')
230
+ const maxDateParts = _datesList[_datesList.length - 1].split('-')
231
+ const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
232
+ const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
233
+ setDateWhitelist([{ start: _minDate, end: _maxDate }])
189
234
  }
190
235
  }, [datesList])
191
236
 
237
+ useEffect(() => {
238
+ if (dateSelected) {
239
+ const dateParts = dateSelected.split('-')
240
+ const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
241
+ setSelectedDate(_dateSelected)
242
+ }
243
+ }, [dateSelected])
244
+
245
+ useEffect(() => {
246
+ setSelectedTime(timeSelected)
247
+ }, [timeSelected])
248
+
192
249
  return (
193
250
  <>
194
- <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
195
- <View style={{ paddingBottom: 90 }}>
196
- <NavBar
197
- onActionLeft={() => goToBack()}
198
- btnStyle={{ paddingLeft: 0 }}
199
- paddingTop={0}
200
- style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
201
- title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
202
- titleAlign={'center'}
203
- titleStyle={{ fontSize: 14, marginRight: 0, marginLeft: 0 }}
204
- titleWrapStyle={{ paddingHorizontal: 0 }}
205
- />
251
+ <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
252
+ <View style={{ paddingBottom: 90 }}>
253
+ <NavBar
254
+ onActionLeft={() => goToBack()}
255
+ btnStyle={{ paddingLeft: 0 }}
256
+ paddingTop={0}
257
+ style={{ paddingBottom: 0, flexDirection: 'column', alignItems: 'flex-start' }}
258
+ title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
259
+ titleAlign={'center'}
260
+ titleStyle={{ fontSize: 14, marginRight: 0, marginLeft: 0 }}
261
+ titleWrapStyle={{ paddingHorizontal: 0 }}
262
+ />
206
263
 
207
- <WrapSelectOption
208
- onPress={() => _handleAsap()}
209
- disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
210
- {optionSelected.isAsap ? (
211
- <OIcon
212
- src={theme.images.general.option_checked}
213
- width={16}
214
- style={{ marginEnd: 24 }}
215
- />
216
- ) : (
217
- <OIcon
218
- src={theme.images.general.option_normal}
219
- width={16}
220
- style={{ marginEnd: 24 }}
221
- />
222
- )}
223
- <OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM d, yyyy h:mm A')} + delivery time)`}</OText>
224
- </WrapSelectOption>
225
- <WrapSelectOption
226
- onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
227
- disabled={orderState.loading}>
228
- {optionSelected.isSchedule ? (
229
- <OIcon
230
- src={theme.images.general.option_checked}
231
- width={16}
232
- style={{ marginEnd: 24 }}
233
- />
234
- ) : (
235
- <OIcon
236
- src={theme.images.general.option_normal}
237
- width={16}
238
- style={{ marginEnd: 24 }}
239
- />
240
- )}
241
- <OText color={optionSelected.isSchedule ? theme.colors.textNormal : theme.colors.disabled}>{t('SCHEDULE_FOR_LATER', 'Schedule for later')}</OText>
242
- </WrapSelectOption>
264
+ <WrapSelectOption
265
+ onPress={() => _handleAsap()}
266
+ disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
267
+ {optionSelected.isAsap ? (
268
+ <OIcon
269
+ src={theme.images.general.option_checked}
270
+ width={16}
271
+ style={{ marginEnd: 24 }}
272
+ />
273
+ ) : (
274
+ <OIcon
275
+ src={theme.images.general.option_normal}
276
+ width={16}
277
+ style={{ marginEnd: 24 }}
278
+ />
279
+ )}
280
+ <OText color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}>{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM d, yyyy h:mm A')} + delivery time)`}</OText>
281
+ </WrapSelectOption>
282
+ <WrapSelectOption
283
+ onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
284
+ disabled={orderState.loading}>
285
+ {optionSelected.isSchedule ? (
286
+ <OIcon
287
+ src={theme.images.general.option_checked}
288
+ width={16}
289
+ style={{ marginEnd: 24 }}
290
+ />
291
+ ) : (
292
+ <OIcon
293
+ src={theme.images.general.option_normal}
294
+ width={16}
295
+ style={{ marginEnd: 24 }}
296
+ />
297
+ )}
298
+ <OText color={optionSelected.isSchedule ? theme.colors.textNormal : theme.colors.disabled}>{t('SCHEDULE_FOR_LATER', 'Schedule for later')}</OText>
299
+ </WrapSelectOption>
243
300
 
244
- {optionSelected.isSchedule && (
245
- <WrapDelveryTime>
246
- {datesList.length > 0 && (
247
- <View style={styles.dateWrap}>
248
- <View style={styles.dateLabel}>
249
- <OText size={12} color={theme.colors.textNormal}>{dateSelected}</OText>
250
- </View>
251
- <SelectDropdown
252
- defaultButtonText={timeSelected ? timeSelected : t('DELIVERY_TIME', 'Delivery Time')}
253
- defaultValue={74}
254
- data={hoursList}
255
- disabled={orderState.loading}
256
- onSelect={(selectedItem, index) => {
257
- setSelectedTime(selectedItem.startTime)
258
- }}
259
- buttonTextAfterSelection={(selectedItem, index) => {
260
- return `${selectedItem.startTime} - ${selectedItem.endTime}`
261
- }}
262
- rowTextForSelection={(item, index) => {
263
- return `${item.startTime} - ${item.endTime}`
264
- }}
265
- buttonStyle={{
266
- backgroundColor: theme.colors.white,
267
- borderColor: theme.colors.border,
268
- borderWidth: 1,
269
- borderRadius: 8,
270
- height: 40,
271
- width: '100%',
272
- flexDirection: 'column',
273
- alignItems: 'flex-start',
274
- marginBottom: 20
275
- }}
276
- buttonTextStyle={{
277
- color: theme.colors.textNormal,
278
- fontSize: 12,
279
- paddingTop: 10
280
- }}
281
- dropdownStyle={{
282
- borderRadius: 8,
283
- borderColor: theme.colors.lightGray,
284
- }}
285
- rowStyle={{
286
- borderBottomColor: theme.colors.white,
287
- backgroundColor: theme.colors.white,
288
- height: 40,
289
- flexDirection: 'column',
290
- alignItems: 'flex-start',
291
- paddingTop: 8,
292
- paddingLeft: 22
293
- }}
294
- rowTextStyle={{
295
- color: theme.colors.textNormal,
296
- fontSize: 14,
297
- }}
298
- />
299
- <CalendarPicker
300
- nextTitle=">"
301
- width={width - 80}
302
- previousTitle="<"
303
- nextComponent={
304
- <OIcon
305
- src={theme.images.general.chevron_right}
306
- color={theme.colors.disabled}
307
- width={12}
308
- style={{ marginHorizontal: 4 }}
309
- />
310
- }
311
- previousComponent={
312
- <OIcon
313
- src={theme.images.general.chevron_left}
314
- color={theme.colors.disabled}
315
- width={12}
316
- style={{ marginHorizontal: 4 }}
317
- />
318
- }
319
- onDateChange={(date: moment.Moment) =>
320
- handleChangeDate(date.format('YYYY-MM-DD'))
321
- }
322
- selectedDayColor={theme.colors.primaryContrast}
323
- todayBackgroundColor={theme.colors.border}
324
- dayLabelsWrapper={{ borderColor: theme.colors.clear }}
325
- customDayHeaderStyles={customDayHeaderStylesCallback}
326
- weekdays={weekDays}
327
- selectedStartDate={momento}
328
- minDate={minDate}
329
- maxDate={maxDate}
330
- />
301
+ {optionSelected.isSchedule && (
302
+ <OrderTimeWrapper>
303
+ <View style={{ flex: 1 }}>
304
+ {selectDate && datesWhitelist[0]?.start !== null && (
305
+ <CalendarStrip
306
+ scrollable
307
+ style={styles.calendar}
308
+ calendarHeaderContainerStyle={styles.calendarHeaderContainer}
309
+ calendarHeaderStyle={styles.calendarHeader}
310
+ dateNumberStyle={styles.dateNumber}
311
+ dateNameStyle={styles.dateName}
312
+ iconContainer={{ flex: 0.1 }}
313
+ highlightDateNameStyle={styles.highlightDateName}
314
+ highlightDateNumberStyle={styles.highlightDateNumber}
315
+ dayContainerStyle={{ height: '100%' }}
316
+ highlightDateContainerStyle={{ height: '100%' }}
317
+ calendarHeaderFormat='MMMM, YYYY'
318
+ iconStyle={{ borderWidth: 1 }}
319
+ selectedDate={selectDate}
320
+ datesWhitelist={datesWhitelist}
321
+ disabledDateNameStyle={styles.disabledDateName}
322
+ disabledDateNumberStyle={styles.disabledDateNumber}
323
+ disabledDateOpacity={0.6}
324
+ onDateSelected={(date) => onSelectDate(date)}
325
+ leftSelector={<LeftSelector />}
326
+ rightSelector={<RightSelector />}
327
+ />
328
+ )}
331
329
  </View>
332
- )}
333
- </WrapDelveryTime>
334
- )}
335
- </View>
336
- <Spinner visible={momentState.isLoading === 1} />
337
- </Container>
338
- <View style={{position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%'}}>
339
- <OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{borderRadius: 7.6, height: 44, shadowOpacity: 0}} textStyle={{color: 'white', fontSize: 14}} showNextIcon />
340
- </View>
330
+ <TimeListWrapper nestedScrollEnabled={true}>
331
+ <TimeContentWrapper>
332
+ {hoursList.map((time: any, i: number) => (
333
+ <TouchableOpacity key={i} onPress={() => setSelectedTime(time.startTime)}>
334
+ <TimeItem active={selectedTime === time.startTime}>
335
+ <OText
336
+ size={14}
337
+ color={selectedTime === time.startTime ? theme.colors.primary : theme.colors.textNormal}
338
+ style={{
339
+ lineHeight: 24
340
+ }}
341
+ >{time.startTime}</OText>
342
+ </TimeItem>
343
+ </TouchableOpacity>
344
+ ))}
345
+ {hoursList.length % 3 === 2 && (
346
+ <TimeItem style={{ backgroundColor: 'transparent' }} />
347
+ )}
348
+ </TimeContentWrapper>
349
+ </TimeListWrapper>
350
+ </OrderTimeWrapper>
351
+ )}
352
+ </View>
353
+ </Container>
341
354
  </>
342
355
  );
343
356
  };
@@ -6,61 +6,37 @@ export const Container = styled.ScrollView`
6
6
  padding: 0 20px;
7
7
  padding-bottom: 20px;
8
8
  `
9
- export const HeaderTitle = styled.View`
10
- flex-direction: column;
11
- margin-bottom: 20px;
12
- `
9
+
13
10
  export const WrapSelectOption = styled.TouchableOpacity`
14
11
  flex-direction: row;
15
12
  align-items: center;
16
13
  margin-vertical: 5px;
17
14
  `
18
- export const Days = styled.View`
19
- flex-wrap: wrap;
20
- flex-direction: row;
21
- margin-vertical: 10px;
15
+ export const OrderTimeWrapper = styled.View`
16
+ margin-top: 34px;
22
17
  `
23
- export const Day = styled.TouchableOpacity`
24
- display: flex;
25
- flex-direction: column;
26
- align-items: center;
27
- justify-content: center;
28
- border-right-width: 1px;
29
- width: 25%;
30
- margin-vertical: 10px;
31
- border-color: ${(props: any) => props.theme.colors.textSecondary};
32
18
 
33
- ${(props: any) => props.borderLeftShow && css`
34
- border-left-width: 1px;
35
- `}
36
- `
37
- export const WrapHours = styled.ScrollView`
38
- border-width: 1px;
39
- border-color: ${(props: any) => props.theme.colors.border};
40
- border-radius: 7.6px;
41
- margin-top: 6px;
42
- height: 140px;
43
- max-height: 140px;
19
+ export const TimeListWrapper = styled.ScrollView`
20
+ margin-top: 30px;
21
+ max-height: 160px;
44
22
  `
45
- export const Hours = styled.View`
23
+
24
+ export const TimeContentWrapper = styled.View`
46
25
  flex: 1;
47
26
  flex-wrap: wrap;
48
27
  flex-direction: row;
49
28
  justify-content: space-between;
50
- margin: 0 20px;
51
29
  `
52
- export const Hour = styled.TouchableOpacity`
53
- flex-direction: row;
30
+
31
+ export const TimeItem = styled.View`
32
+ width: 86px;
33
+ height: 34px;
34
+ background: #E9ECEF;
35
+ border-radius: 7.6px;
54
36
  justify-content: center;
55
37
  align-items: center;
56
- padding: 5px;
57
- border-width: 1px;
58
- border-radius: 7.6px;
59
- border-color: ${(props: any) => props.theme.colors.border};
60
- width: 90px;
61
- margin-vertical: 7px;
62
- `
63
-
64
- export const WrapDelveryTime = styled.View`
65
- flex: 1;
38
+ margin: 10px 0px;
39
+ ${({ active }: any) => active && css`
40
+ background: #F5F9FF;
41
+ `}
66
42
  `
@@ -155,7 +155,7 @@ export const ProductOptionsUI = (props: any) => {
155
155
  const { product, loading, error } = productObject;
156
156
  const [gallery, setGallery] = useState([])
157
157
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
158
-
158
+ const [indexGallery, setIndexGallery] = useState(0)
159
159
  const [selOpt, setSelectedOpt] = useState(0);
160
160
  const [isHaveWeight, setIsHaveWeight] = useState(false)
161
161
  const [qtyBy, setQtyBy] = useState({
@@ -208,7 +208,10 @@ export const ProductOptionsUI = (props: any) => {
208
208
  }
209
209
 
210
210
  const handleClickThumb = (index: number) => {
211
- swiperRef?.current.scrollBy(index - thumbsSwiper, true);
211
+ if (index !== indexGallery) {
212
+ swiperRef?.current.scrollBy(index - thumbsSwiper, true);
213
+ setIndexGallery(index)
214
+ }
212
215
  }
213
216
 
214
217
  const handleRedirectLogin = () => {
@@ -455,7 +458,7 @@ export const ProductOptionsUI = (props: any) => {
455
458
  textDecorationLine: 'line-through',
456
459
  marginLeft: 7,
457
460
  marginRight: 7
458
- }}>{parsePrice(product?.offer_price)}</OText>
461
+ }}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
459
462
  )}
460
463
  </View>
461
464
  )}