ordering-ui-react-native 0.17.26 → 0.17.28

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.17.26",
3
+ "version": "0.17.28",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -23,6 +23,7 @@ import { BusinessProductsList } from '../BusinessProductsList'
23
23
  import { BusinessProductsListingParams } from '../../types'
24
24
  import { _retrieveStoreData, _removeStoreData } from '../../providers/StoreUtil';
25
25
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
26
+ import { useIsFocused } from '@react-navigation/native';
26
27
 
27
28
  import {
28
29
  TopHeader,
@@ -77,6 +78,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
77
78
  const [{ parsePrice }] = useUtils()
78
79
  const [, { showToast }] = useToast()
79
80
  const [{ configs }] = useConfig()
81
+ const isFocused = useIsFocused();
80
82
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
81
83
 
82
84
  const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
@@ -245,6 +247,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
245
247
  removeCartByReOrder()
246
248
  }, [currentCart])
247
249
 
250
+ useEffect(() => {
251
+ if (!isFocused) {
252
+ handleChangeSearch('')
253
+ setIsOpenSearchBar(false)
254
+ }
255
+ }, [isFocused])
256
+
248
257
  return (
249
258
  <>
250
259
  <View style={{ flex: 1 }}>
@@ -12,7 +12,7 @@ export const Container = styled.View`
12
12
  width: 100%;
13
13
  justify-content: space-between;
14
14
  background-color: #FFF;
15
- z-index: 1000;
15
+ z-index: 9999;
16
16
  justify-content: space-between;
17
17
  `
18
18
 
@@ -719,8 +719,9 @@ const LoginFormUI = (props: LoginParams) => {
719
719
  )}
720
720
 
721
721
  {configs && Object.keys(configs).length > 0 ? (
722
- (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
723
- (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null)) &&
722
+ (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value && facebookLoginEnabled) ||
723
+ ((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
724
+ ((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
724
725
  (
725
726
  <>
726
727
  <View
@@ -95,7 +95,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
95
95
  <>
96
96
  <NavBar
97
97
  onActionLeft={() => goToBack()}
98
- btnStyle={{ paddingLeft: 0 }}
98
+ btnStyle={{ paddingLeft: 0, width: 50 }}
99
99
  paddingTop={0}
100
100
  style={{ paddingBottom: 0 }}
101
101
  title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
@@ -262,38 +262,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
262
262
  )}
263
263
  </>
264
264
  )}
265
- {loading && !hideOrders && (
266
- <>
267
- {!activeOrders ? (
268
- <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
269
- <View style={{ width: '100%', flexDirection: 'row' }}>
270
- <PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 35 }} />
271
- <Placeholder>
272
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
273
- <PlaceholderLine width={50} />
274
- <PlaceholderLine width={70} />
275
- </Placeholder>
276
- </View>
277
- </Placeholder>
278
- ) : (
279
- <View style={{ marginTop: 30 }}>
280
- {[...Array(5)].map((item, i) => (
281
- <Placeholder key={i} Animation={Fade}>
282
- <View style={{ width: '100%', flexDirection: 'row' }}>
283
- <PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 20 }} />
284
- <Placeholder>
285
- <PlaceholderLine width={30} style={{ marginTop: 5 }} />
286
- <PlaceholderLine width={50} />
287
- <PlaceholderLine width={20} />
288
- </Placeholder>
289
- </View>
290
- </Placeholder>
291
- ))}
292
- </View>
293
- )}
294
- </>
295
- )}
296
- {!loading && !error && orders.length > 0 && !hideOrders && (
265
+ {!error && orders.length > 0 && !hideOrders && (
297
266
  preOrders ? (
298
267
  <ActiveOrders
299
268
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
@@ -325,9 +294,41 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
325
294
  onNavigationRedirect={onNavigationRedirect}
326
295
  handleReorder={handleReorder}
327
296
  handleUpdateOrderList={handleUpdateOrderList}
297
+ loading={loading}
328
298
  />
329
299
  )
330
300
  )}
301
+ {loading && !hideOrders && (
302
+ <>
303
+ {!activeOrders ? (
304
+ <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
305
+ <View style={{ width: '100%', flexDirection: 'row' }}>
306
+ <PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 35 }} />
307
+ <Placeholder>
308
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
309
+ <PlaceholderLine width={50} />
310
+ <PlaceholderLine width={70} />
311
+ </Placeholder>
312
+ </View>
313
+ </Placeholder>
314
+ ) : (
315
+ <View style={{ marginTop: 30 }}>
316
+ {[...Array(5)].map((item, i) => (
317
+ <Placeholder key={i} Animation={Fade}>
318
+ <View style={{ width: '100%', flexDirection: 'row' }}>
319
+ <PlaceholderLine width={20} height={70} style={{ marginRight: 20, marginBottom: 20 }} />
320
+ <Placeholder>
321
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
322
+ <PlaceholderLine width={50} />
323
+ <PlaceholderLine width={20} />
324
+ </Placeholder>
325
+ </View>
326
+ </Placeholder>
327
+ ))}
328
+ </View>
329
+ )}
330
+ </>
331
+ )}
331
332
  </>
332
333
  )
333
334
  }
@@ -19,7 +19,8 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
19
19
  handleReorder,
20
20
  reorderLoading,
21
21
  orderID,
22
- handleUpdateOrderList
22
+ handleUpdateOrderList,
23
+ loading
23
24
  } = props;
24
25
 
25
26
  const theme = useTheme();
@@ -42,7 +43,7 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
42
43
  handleUpdateOrderList={handleUpdateOrderList}
43
44
  />
44
45
  ))}
45
- {pagination.totalPages && pagination.currentPage < pagination.totalPages && (
46
+ {!loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
46
47
  <WrappButton>
47
48
  <OButton
48
49
  onClick={loadMoreOrders}
@@ -1,15 +1,15 @@
1
1
  import React, { useEffect, useRef, useState, useCallback } from 'react';
2
2
  import {
3
- View,
4
- Keyboard,
5
- TextInput,
6
- TouchableOpacity,
7
- StyleSheet,
8
- Dimensions,
9
- I18nManager,
10
- SafeAreaView,
11
- Platform,
12
- Button
3
+ View,
4
+ Keyboard,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ Dimensions,
9
+ I18nManager,
10
+ SafeAreaView,
11
+ Platform,
12
+ Button
13
13
  } from 'react-native';
14
14
  import {
15
15
  ProductForm as ProductOptions,
@@ -459,13 +459,13 @@ export const ProductOptionsUI = (props: any) => {
459
459
  }
460
460
 
461
461
  useEffect(() => {
462
- const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
462
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
463
463
  scrollViewRef.current.scrollToEnd({ animated: true })
464
- })
465
- return () => {
466
- keyboardDidShowListener.remove()
467
- }
468
- }, [])
464
+ })
465
+ return () => {
466
+ keyboardDidShowListener.remove()
467
+ }
468
+ }, [])
469
469
 
470
470
 
471
471
  return (
@@ -530,7 +530,7 @@ export const ProductOptionsUI = (props: any) => {
530
530
  >
531
531
  {String(img).includes('image') ? (
532
532
  <FastImage
533
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
533
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 3 / 2 }}
534
534
  source={{
535
535
  uri: optimizeImage(img, 'h_1024,c_limit'),
536
536
  priority: FastImage.priority.normal,
@@ -1054,7 +1054,7 @@ export const ProductOptionsUI = (props: any) => {
1054
1054
  width={16}
1055
1055
  color={
1056
1056
  maxProductQuantity <= 0 ||
1057
- (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
1057
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
1058
1058
  ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1059
1059
  isSoldOut
1060
1060
  ? theme.colors.backgroundGray
@@ -1108,20 +1108,20 @@ export const ProductOptionsUI = (props: any) => {
1108
1108
 
1109
1109
 
1110
1110
  export const ProductForm = (props: any) => {
1111
- const productOptionsProps = {
1112
- ...props,
1113
- productCart: {
1114
- ...props.productCart,
1115
- quantity: props.productCart?.code
1116
- ? props.productCart?.quantity
1117
- : props?.product?.minimum_per_order || 1
1118
- },
1119
- UIComponent: ProductOptionsUI
1120
- }
1111
+ const productOptionsProps = {
1112
+ ...props,
1113
+ productCart: {
1114
+ ...props.productCart,
1115
+ quantity: props.productCart?.code
1116
+ ? props.productCart?.quantity
1117
+ : props?.product?.minimum_per_order || 1
1118
+ },
1119
+ UIComponent: ProductOptionsUI
1120
+ }
1121
1121
 
1122
- return <ProductOptions {...productOptionsProps} />
1122
+ return <ProductOptions {...productOptionsProps} />
1123
1123
  };
1124
1124
 
1125
1125
  ProductForm.defaultProps = {
1126
- productAddedToCartLength: 0
1126
+ productAddedToCartLength: 0
1127
1127
  }
@@ -886,64 +886,65 @@ const SignupFormUI = (props: SignupParams) => {
886
886
  </View>
887
887
  )
888
888
  }
889
- <View
890
- style={{
891
- flexDirection: 'row',
892
- width: '100%',
893
- justifyContent: 'space-between',
894
- alignItems: 'center',
895
- marginVertical: 30,
896
- }}>
897
- <View style={style.line} />
898
- <OText
899
- size={14}
900
- mBottom={10}
901
- style={{ paddingHorizontal: 19 }}
902
- color={theme.colors.disabled}>
903
- {t('OR', 'or')}
904
- </OText>
905
- <View style={style.line} />
906
- </View>
907
-
908
889
  {configs && Object.keys(configs).length > 0 && (
909
- (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
910
- (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null)) &&
890
+ (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value && facebookLoginEnabled) ||
891
+ ((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
892
+ ((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
911
893
  (
912
- <ButtonsWrapper>
913
- <SocialButtons>
914
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
915
- configs?.facebook_id?.value &&
916
- facebookLoginEnabled &&
917
- (
918
- <FacebookLogin
894
+ <>
895
+ <View
896
+ style={{
897
+ flexDirection: 'row',
898
+ width: '100%',
899
+ justifyContent: 'space-between',
900
+ alignItems: 'center',
901
+ marginVertical: 30,
902
+ }}>
903
+ <View style={style.line} />
904
+ <OText
905
+ size={14}
906
+ mBottom={10}
907
+ style={{ paddingHorizontal: 19 }}
908
+ color={theme.colors.disabled}>
909
+ {t('OR', 'or')}
910
+ </OText>
911
+ <View style={style.line} />
912
+ </View>
913
+ <ButtonsWrapper>
914
+ <SocialButtons>
915
+ {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
916
+ configs?.facebook_id?.value &&
917
+ facebookLoginEnabled &&
918
+ (
919
+ <FacebookLogin
920
+ notificationState={notificationState}
921
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
922
+ handleLoading={(val: boolean) => setIsFBLoading(val)}
923
+ handleSuccessFacebookLogin={handleSuccessFacebook}
924
+ />
925
+ )}
926
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
927
+ <GoogleLogin
919
928
  notificationState={notificationState}
929
+ webClientId={configs?.google_login_client_id?.value}
920
930
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
921
931
  handleLoading={(val: boolean) => setIsFBLoading(val)}
922
- handleSuccessFacebookLogin={handleSuccessFacebook}
932
+ handleSuccessGoogleLogin={handleSuccessFacebook}
923
933
  />
924
934
  )}
925
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
926
- <GoogleLogin
927
- notificationState={notificationState}
928
- webClientId={configs?.google_login_client_id?.value}
929
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
930
- handleLoading={(val: boolean) => setIsFBLoading(val)}
931
- handleSuccessGoogleLogin={handleSuccessFacebook}
932
- />
933
- )}
934
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
935
- <AppleLogin
936
- notificationState={notificationState}
937
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
938
- handleLoading={(val: boolean) => setIsFBLoading(val)}
939
- handleSuccessAppleLogin={handleSuccessFacebook}
940
- />
941
- )}
942
- </SocialButtons>
943
- </ButtonsWrapper>
935
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
936
+ <AppleLogin
937
+ notificationState={notificationState}
938
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
939
+ handleLoading={(val: boolean) => setIsFBLoading(val)}
940
+ handleSuccessAppleLogin={handleSuccessFacebook}
941
+ />
942
+ )}
943
+ </SocialButtons>
944
+ </ButtonsWrapper>
945
+ </>
944
946
  )
945
947
  )}
946
-
947
948
  </FormSide>
948
949
  <OModal
949
950
  open={willVerifyOtpState}
@@ -64,6 +64,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
64
64
  return found
65
65
  }
66
66
 
67
+ const handleChangeQualification = (index: number) => {
68
+ if (qualification === index) return
69
+ setQualification(index)
70
+ setComments([])
71
+ }
72
+
67
73
  const handleChangeComment = (commentItem: any) => {
68
74
  const found = comments.find((comment: any) => comment?.key === commentItem.key)
69
75
  if (found) {
@@ -132,11 +138,11 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
132
138
  <LikeHandsActionContainer>
133
139
  <LikeHandsButton
134
140
  isLike
135
- onPress={() => setQualification(5)}
141
+ onPress={() => handleChangeQualification(5)}
136
142
  >
137
143
  <AntDesignIcons name='like2' size={20} color={qualification === 5 ? theme.colors.primary : theme.colors.lightGray} />
138
144
  </LikeHandsButton>
139
- <LikeHandsButton onPress={() => setQualification(1)}>
145
+ <LikeHandsButton onPress={() => handleChangeQualification(1)}>
140
146
  <AntDesignIcons name='dislike2' size={20} color={qualification === 1 ? theme.colors.primary : theme.colors.lightGray} />
141
147
  </LikeHandsButton>
142
148
  </LikeHandsActionContainer>
@@ -396,6 +396,7 @@ export interface PreviousOrdersParams {
396
396
  getOrderStatus?: any,
397
397
  orderID?: number
398
398
  reorderLoading?: boolean,
399
+ loading?: boolean,
399
400
  loadMoreOrders?: () => {},
400
401
  handleReorder?: (orderId: number) => {},
401
402
  onNavigationRedirect?: (route: string, params?: any) => {}