ordering-ui-react-native 0.17.25 → 0.17.27

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.25",
3
+ "version": "0.17.27",
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
 
@@ -1,7 +1,7 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { LanguageSelector as LanguageSelectorController, useOrder, useLanguage } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
- import { Platform, StyleSheet, View } from 'react-native'
4
+ import { StyleSheet, View } from 'react-native'
5
5
 
6
6
  import RNPickerSelect from 'react-native-picker-select'
7
7
  import { Container, DummyContainer } from './styles'
@@ -9,10 +9,17 @@ import { LanguageSelectorParams } from '../../types'
9
9
  import { OIcon } from '../shared'
10
10
 
11
11
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
12
+ const {
13
+ languagesState,
14
+ currentLanguage,
15
+ handleChangeLanguage,
16
+ iconColor,
17
+ pickerStyle
18
+ } = props
12
19
 
13
20
  const [orderState] = useOrder()
14
21
  const [state] = useLanguage()
15
-
22
+ const [languagePressed, setLanguagePressed] = useState(currentLanguage)
16
23
  const theme = useTheme();
17
24
 
18
25
  const _pickerStyle = StyleSheet.create({
@@ -42,14 +49,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
42
49
  color: theme.colors.secundaryContrast
43
50
  }
44
51
  })
45
-
46
- const {
47
- languagesState,
48
- currentLanguage,
49
- handleChangeLanguage,
50
- iconColor,
51
- pickerStyle
52
- } = props
52
+
53
+ const changeLanguage = (lang : string) => {
54
+ setLanguagePressed(lang)
55
+ handleChangeLanguage(lang)
56
+ }
53
57
 
54
58
  const _languages = languagesState?.languages?.map((language: any) => {
55
59
  return {
@@ -68,14 +72,14 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
68
72
  <>
69
73
  {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
70
74
  <RNPickerSelect
71
- onValueChange={handleChangeLanguage}
75
+ onValueChange={changeLanguage}
72
76
  items={_languages || []}
73
77
  value={currentLanguage}
74
78
  style={pickerStyle ? pickerStyle : _pickerStyle}
75
79
  useNativeAndroidPickerStyle={false}
76
80
  placeholder={{}}
77
81
  Icon={() => <View style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} /></View>}
78
- disabled={orderState.loading || state.loading}
82
+ disabled={orderState.loading || state.loading || state?.language?.code !== languagePressed}
79
83
  />
80
84
  </>
81
85
  ) : <DummyContainer />}
@@ -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}
@@ -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) => {}