ordering-ui-react-native 0.18.21 → 0.18.23

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.18.21",
3
+ "version": "0.18.23",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -271,8 +271,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
271
271
  <LottieAnimation
272
272
  type='favorite'
273
273
  onClick={handleChangeFavorite}
274
- initialValue={business?.favorite ? 0.75 : 0}
275
- toValue={business?.favorite ? 0 : 0.75}
274
+ initialValue={business?.favorite ? 0.5 : 0}
275
+ toValue={business?.favorite ? 0 : 0.5}
276
276
  disableAnimation={!auth}
277
277
  iconProps={{ color: theme.colors.danger5, size: 18 }}
278
278
  isActive={business?.favorite}
@@ -302,8 +302,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
302
302
  <LottieAnimation
303
303
  type='favorite'
304
304
  onClick={handleChangeFavorite}
305
- initialValue={business?.favorite ? 0.75 : 0}
306
- toValue={business?.favorite ? 0 : 0.75}
305
+ initialValue={business?.favorite ? 0.5 : 0}
306
+ toValue={business?.favorite ? 0 : 0.5}
307
307
  disableAnimation={!auth}
308
308
  iconProps={{ color: theme.colors.danger5, size: 18 }}
309
309
  isActive={business?.favorite}
@@ -275,7 +275,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
275
275
  }}
276
276
  />
277
277
  )}
278
-
279
278
  {businessesSearchList.businesses?.length > 0 && (
280
279
  <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
280
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
@@ -372,7 +371,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
372
371
  onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
373
372
  productAddedToCartLength={0}
374
373
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
375
- style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
374
+ style={{
375
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
376
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
377
+ marginRight: 20
378
+ }}
376
379
  />
377
380
  )))}
378
381
 
@@ -585,7 +585,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
585
585
  setBusinessTypes={setBusinessTypes}
586
586
  />
587
587
  )}
588
- {!businessesList.loading && businessesList.businesses.length === 0 && (
588
+ {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
589
589
  <NotFoundSource
590
590
  content={t(
591
591
  'NOT_FOUND_BUSINESSES',
@@ -618,7 +618,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
618
618
  />
619
619
  )
620
620
  )}
621
- {businessesList.loading && (
621
+ {(businessesList.loading || !businessesList?.fetched) && (
622
622
  <>
623
623
  {[
624
624
  ...Array(
@@ -7,6 +7,7 @@ import { CCContainer, CCNotCarts, CCList, CheckoutAction } from './styles';
7
7
  import { Cart } from '../Cart';
8
8
  import { OButton, OText } from '../shared';
9
9
  import Spinner from 'react-native-loading-spinner-overlay';
10
+ import { NotFoundSource } from '../NotFoundSource';
10
11
 
11
12
  export const CartContent = (props: any) => {
12
13
  const {
@@ -103,21 +104,12 @@ export const CartContent = (props: any) => {
103
104
  )}
104
105
  {(!carts || carts?.length === 0) && (
105
106
  <CCNotCarts>
106
- <OText size={24} style={{ textAlign: 'center' }}>
107
- {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
108
- </OText>
109
- <OButton
110
- text={t('START_SHOPPING', 'Start shopping')}
111
- bgColor={theme.colors.primary}
112
- borderColor={theme.colors.primary}
113
- textStyle={{
114
- color: theme.colors.white,
115
- fontSize: 14,
116
- paddingRight: 0
117
- }}
118
- style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
119
- imgRightSrc={null}
120
- onClick={() => onNavigationRedirect('BusinessList')}
107
+ <NotFoundSource
108
+ hideImage
109
+ btnStyle={{ borderRadius: 8 }}
110
+ content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
111
+ btnTitle={t('START_SHOPPING', 'Start shopping')}
112
+ onClickButton={() => onNavigationRedirect('BusinessList')}
121
113
  />
122
114
  </CCNotCarts>
123
115
  )}
@@ -5,13 +5,9 @@ export const CCContainer = styled.View`
5
5
  `
6
6
 
7
7
  export const CCNotCarts = styled.View`
8
- height: 300px;
9
- display: flex;
10
8
  flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- width: 80%;
14
- margin: auto;
9
+ align-items: center;
10
+ margin-top: 40px;
15
11
  `
16
12
 
17
13
  export const CCList = styled.ScrollView`
@@ -222,7 +222,7 @@ const LoginFormUI = (props: LoginParams) => {
222
222
  };
223
223
 
224
224
  const handleChangeInputEmail = (value: string, onChange: any) => {
225
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
225
+ onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
226
226
  };
227
227
 
228
228
  const handleOpenRecaptcha = () => {
@@ -5,74 +5,93 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign'
5
5
  import { useTheme } from 'styled-components';
6
6
 
7
7
  interface Props {
8
- initialValue: number,
9
- onClick: any,
10
- disableAnimation?: boolean
11
- toValue: number,
12
- style?: ViewStyle,
13
- duration?: number,
14
- type: 'favorite', // animation types
15
- isActive: boolean,
16
- animationType?: ((value: number) => number);
17
- useNativeDriver?: boolean,
18
- iconProps?: { color?: string, size?: number, style?: ViewStyle }
8
+ initialValue: number,
9
+ onClick: any,
10
+ disableAnimation?: boolean
11
+ toValue: number,
12
+ style?: ViewStyle,
13
+ duration?: number,
14
+ type: 'favorite', // animation types
15
+ isActive: boolean,
16
+ animationType?: ((value: number) => number);
17
+ useNativeDriver?: boolean,
18
+ iconProps?: { color?: string, size?: number, style?: ViewStyle }
19
19
  }
20
20
 
21
21
  export const LottieAnimation = (props: Props) => {
22
- const {
23
- initialValue,
24
- onClick,
25
- disableAnimation,
26
- toValue,
27
- style,
28
- duration,
29
- type,
30
- isActive,
31
- useNativeDriver,
32
- animationType,
33
- iconProps
34
- } = props
35
- const theme = useTheme()
36
- const animationProgress = useRef(new Animated.Value(initialValue))
37
- const [isHide, setIsHide] = useState(true)
38
- const favoriteArray = ['heart', 'hearto']
39
- const icon = type === 'favorite' ? favoriteArray : []
40
- const animationGif = type === 'favorite' ? theme.images?.general?.heart : ''
41
- const onPressLottie = () => {
42
- if (!disableAnimation) {
43
- setIsHide(false)
44
- Animated.timing(animationProgress.current, {
45
- toValue,
46
- duration: duration || 5000,
47
- easing: animationType || Easing.linear,
48
- useNativeDriver: useNativeDriver ?? true
49
- }).start();
50
- hideLottie()
51
- }
52
- onClick()
53
- }
22
+ const {
23
+ initialValue,
24
+ onClick,
25
+ disableAnimation,
26
+ toValue,
27
+ style,
28
+ duration,
29
+ type,
30
+ isActive,
31
+ useNativeDriver,
32
+ animationType,
33
+ iconProps
34
+ } = props
35
+
36
+ const theme = useTheme()
37
+ const animationProgress = useRef(new Animated.Value(initialValue))
38
+ const favRef = useRef<Lottie>(null)
39
+ const [isHide, setIsHide] = useState(true)
54
40
 
55
- const hideLottie = () => {
56
- setTimeout(() => setIsHide(true), 4500)
41
+ const favoriteArray = ['heart', 'hearto']
42
+ const icon = type === 'favorite' ? favoriteArray : []
43
+ const animationGif = type === 'favorite' ? theme.images?.general?.heart : ''
44
+
45
+ const onPressLottie = () => {
46
+ if (!disableAnimation) {
47
+ if (type === 'favorite') {
48
+ favRef.current?.play()
49
+ } else {
50
+ setIsHide(false)
51
+ Animated.timing(animationProgress.current, {
52
+ toValue,
53
+ duration: duration || 5000,
54
+ easing: animationType || Easing.linear,
55
+ useNativeDriver: useNativeDriver ?? true
56
+ }).start();
57
+ hideLottie()
58
+ }
57
59
  }
60
+ onClick()
61
+ }
62
+
63
+ const hideLottie = () => {
64
+ setTimeout(() => setIsHide(true), 4500)
65
+ }
58
66
 
59
- return (
60
- <TouchableOpacity
61
- onPress={onPressLottie}
62
- style={style}
63
- >
64
- {!isHide &&
65
- <Lottie
66
- progress={animationProgress.current}
67
- source={animationGif}
68
- />
69
- }
70
- <IconAntDesign
71
- name={isActive ? icon[0] : icon[1]}
72
- color={iconProps?.color || theme.colors.danger5}
73
- size={iconProps?.size || 16}
74
- style={iconProps?.style}
67
+ return (
68
+ <TouchableOpacity
69
+ onPress={onPressLottie}
70
+ style={style}
71
+ >
72
+ {type === 'favorite' ? (
73
+ <Lottie
74
+ ref={favRef}
75
+ progress={initialValue}
76
+ style={{ width: 20, height: 20 }}
77
+ source={animationGif}
78
+ />
79
+ ) : (
80
+ <>
81
+ {!isHide &&
82
+ <Lottie
83
+ progress={animationProgress.current}
84
+ source={animationGif}
75
85
  />
76
- </TouchableOpacity>
77
- )
86
+ }
87
+ <IconAntDesign
88
+ name={isActive ? icon[0] : icon[1]}
89
+ color={iconProps?.color || theme.colors.danger5}
90
+ size={iconProps?.size || 16}
91
+ style={iconProps?.style}
92
+ />
93
+ </>
94
+ )}
95
+ </TouchableOpacity>
96
+ )
78
97
  }
@@ -1,8 +1,9 @@
1
1
  import React from 'react'
2
2
  import { View } from 'react-native'
3
- import { OButton, OIcon, OText } from '../shared'
3
+ import { OButton, OText } from '../shared'
4
4
  import { NotFoundSourceParams } from '../../types'
5
5
  import { useTheme } from 'styled-components/native';
6
+ import Foundation from 'react-native-vector-icons/Foundation'
6
7
  import {
7
8
  NotFound,
8
9
  NotFoundImage
@@ -10,34 +11,37 @@ import {
10
11
 
11
12
  export const NotFoundSource = (props: NotFoundSourceParams) => {
12
13
  const {
13
- image,
14
+ hideImage,
14
15
  content,
15
16
  btnTitle,
17
+ btnStyle,
16
18
  conditioned,
17
19
  onClickButton
18
20
  } = props
19
21
 
20
22
  const theme = useTheme();
21
23
 
22
- const errorImage = image || theme.images.general.notFound
23
- const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
24
-
25
24
  return (
26
25
  <NotFound>
27
- {errorImage && (
26
+ {!hideImage && (
28
27
  <NotFoundImage>
29
- <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
28
+ <Foundation
29
+ name='page-search'
30
+ color={theme.colors.primary}
31
+ size={60}
32
+ style={{ marginBottom: 10 }}
33
+ />
30
34
  </NotFoundImage>
31
35
  )}
32
- {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
33
- {content && !conditioned && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
36
+ {content && conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
37
+ {content && !conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
34
38
  {!onClickButton && props.children && (
35
39
  props.children
36
40
  )}
37
41
  {onClickButton && (
38
42
  <View style={{ marginTop: 10, width: '100%' }}>
39
43
  <OButton
40
- style={{ width: '100%', height: 50 }}
44
+ style={{ width: '100%', height: 50, ...btnStyle }}
41
45
  bgColor={theme.colors.primary}
42
46
  borderColor={theme.colors.primary}
43
47
  onClick={() => onClickButton()}
@@ -23,21 +23,21 @@ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) =>
23
23
  },
24
24
  });
25
25
 
26
- const ProductList = ({ style }: any) => {
26
+ const ProductList = () => {
27
27
  return (
28
28
  <>
29
29
  {products?.filter((product : any) => product?.business?.available)?.map((product: any) => (
30
- <SingleProductCard
31
- key={product?.id}
32
- isProductId
33
- isSoldOut={(product.inventoried && !product.quantity)}
34
- product={product}
35
- businessId={product?.business?.id}
36
- onProductClick={onProductClick}
37
- style={style}
38
- productAddedToCartLength={0}
39
- handleUpdateProducts={handleUpdateProducts}
40
- />
30
+ <SingleProductCard
31
+ key={product?.id}
32
+ isProductId
33
+ isSoldOut={(product.inventoried && !product.quantity)}
34
+ product={product}
35
+ businessId={product?.business?.id}
36
+ onProductClick={onProductClick}
37
+ style={{ width: windowWidth - (products?.length > 1 ? 120 : 80), marginRight: 20 }}
38
+ productAddedToCartLength={0}
39
+ handleUpdateProducts={handleUpdateProducts}
40
+ />
41
41
  ))}
42
42
  </>
43
43
  )
@@ -45,7 +45,7 @@ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) =>
45
45
  return (
46
46
  <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
47
47
  {isBusinessesSearchList ? (
48
- <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
48
+ <ProductList />
49
49
  ) : (
50
50
  <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
51
51
  <ProductList />
@@ -10,6 +10,7 @@ import { PreviousProductsOrdered } from './PreviousProductsOrdered'
10
10
  import { OptionTitle, NoOrdersWrapper } from './styles'
11
11
  import { OrdersOptionParams } from '../../types'
12
12
  import { _setStoreData } from '../../providers/StoreUtil';
13
+ import { NotFoundSource } from '../NotFoundSource';
13
14
  import {
14
15
  Placeholder,
15
16
  PlaceholderLine,
@@ -180,16 +181,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
180
181
  <>
181
182
  {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
182
183
  <NoOrdersWrapper>
183
- <OText size={14} numberOfLines={1}>
184
- {t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
185
- </OText>
186
- <OButton
187
- text={t('ORDER_NOW', 'Order now')}
188
- onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
189
- textStyle={{ color: 'white', fontSize: 14 }}
190
- style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
184
+ <NotFoundSource
185
+ hideImage
186
+ btnStyle={{ borderRadius: 8 }}
187
+ content={t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
188
+ btnTitle={t('ORDER_NOW', 'Order now')}
189
+ onClickButton={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
191
190
  />
192
-
193
191
  </NoOrdersWrapper>
194
192
  )}
195
193
  {((ordersLength?.activeOrdersLength > 0 && activeOrders) || (ordersLength?.previousOrdersLength > 0 && !activeOrders)) && (
@@ -10,5 +10,5 @@ export const OptionTitle = styled.View`
10
10
  export const NoOrdersWrapper = styled.View`
11
11
  flex-direction: column;
12
12
  align-items: center;
13
- margin-top: 50px;
13
+ margin-top: 60px;
14
14
  `
@@ -9,6 +9,7 @@ export const PromotionsContainer = styled.View`
9
9
  export const WrapperSingleOffer = styled.View`
10
10
  flex-direction: column;
11
11
  width: 100%;
12
+ margin-bottom: 30px;
12
13
  `
13
14
 
14
15
  export const SingleOfferContainer = styled.View`
@@ -16,12 +17,12 @@ export const SingleOfferContainer = styled.View`
16
17
  width: 100%;
17
18
  justify-content: space-between;
18
19
  align-items: center;
19
- margin-bottom: 20px;
20
+ margin-bottom: 10px;
20
21
  `
21
22
 
22
23
  export const OfferInformation = styled.View`
23
24
  justify-content: space-between;
24
- max-width: 70%;
25
+ max-width: 80%;
25
26
  `
26
27
 
27
28
  export const SearchBarContainer = styled.View`
@@ -323,7 +323,7 @@ const SignupFormUI = (props: SignupParams) => {
323
323
  };
324
324
 
325
325
  const handleChangeInputEmail = (value: string, onChange: any) => {
326
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
326
+ onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
327
327
  };
328
328
 
329
329
  const handleOpenTermsUrl = async (url: any) => {
@@ -352,8 +352,8 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
352
352
  <LottieAnimation
353
353
  type='favorite'
354
354
  onClick={handleChangeFavorite}
355
- initialValue={order?.favorite ? 0.75 : 0}
356
- toValue={order?.favorite ? 0 : 0.75}
355
+ initialValue={order?.favorite ? 0.5 : 0}
356
+ toValue={order?.favorite ? 0 : 0.5}
357
357
  style={{ marginBottom: 5 }}
358
358
  iconProps={{ color: theme.colors.danger5, size: 16, style: { top: 7 } }}
359
359
  isActive={order?.favorite}
@@ -201,8 +201,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
201
201
  <LottieAnimation
202
202
  type='favorite'
203
203
  onClick={handleChangeFavorite}
204
- initialValue={product?.favorite ? 0.75 : 0}
205
- toValue={product?.favorite ? 0 : 0.75}
204
+ initialValue={product?.favorite ? 0.5 : 0}
205
+ toValue={product?.favorite ? 0 : 0.5}
206
206
  disableAnimation={!auth}
207
207
  iconProps={{ color: theme.colors.danger5, size: 18 }}
208
208
  isActive={product?.favorite}
@@ -353,6 +353,8 @@ export interface NotFoundSourceParams {
353
353
  conditioned?: boolean,
354
354
  onClickButton?: any,
355
355
  children?: any
356
+ hideImage?: any
357
+ btnStyle?: any
356
358
  }
357
359
  export interface OrdersOptionParams {
358
360
  orderList?: any,