ordering-ui-react-native 0.17.15 → 0.17.17

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.15",
3
+ "version": "0.17.17",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -488,8 +488,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
488
488
  size={13}
489
489
  numberOfLines={2}
490
490
  adjustsFontSizeToFit>
491
- {`${travelTime.toFixed(2)} - ${isMin ? t('MINNUTES', 'mins') : t('HOURS', 'hours')
492
- } ${distancesFromTwoPlacesKm.toFixed(2)} km`}
491
+ {`${travelTime.toFixed(2)} - ${isMin ? t('MINNUTES', 'mins') : t('HOURS', 'hours')}`}
493
492
  </OText>
494
493
  </View>
495
494
  </View>
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
3
3
  import { IOScrollView } from 'react-native-intersection-observer'
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
4
5
  import { useTheme } from 'styled-components/native';
5
6
  import {
6
7
  BusinessAndProductList,
@@ -68,6 +69,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
68
69
  onBusinessClick
69
70
  } = props
70
71
 
72
+ const insets = useSafeAreaInsets()
71
73
  const theme = useTheme();
72
74
  const [, t] = useLanguage()
73
75
  const [{ auth }] = useSession()
@@ -245,12 +247,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
245
247
 
246
248
  return (
247
249
  <>
248
- <ContainerSafeAreaView
249
- style={{ flex: 1 }}
250
- isOpenFiltProducts={isOpenFiltProducts}
251
- >
250
+ <View style={{ flex: 1 }}>
252
251
  <Animated.View style={{ position: 'relative' }}>
253
- <TopHeader isIos={Platform.OS === 'ios'}>
252
+ <TopHeader
253
+ style={{
254
+ marginTop: Platform.OS === 'ios' ? insets.top : '40px'
255
+ }}
256
+ >
254
257
  {!isOpenSearchBar && (
255
258
  <>
256
259
  <TopActions onPress={() => handleBackNavigation()}>
@@ -512,7 +515,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
512
515
  onAccept={() => setAlertState({ open: false, content: [] })}
513
516
  onClose={() => setAlertState({ open: false, content: [] })}
514
517
  />
515
- </ContainerSafeAreaView>
518
+ </View>
516
519
  <OModal
517
520
  open={openService}
518
521
  onClose={() => setOpenService(false)}
@@ -1,8 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const ContainerSafeAreaView = styled.SafeAreaView`
4
- `
5
-
6
3
  export const WrapHeader = styled.View`
7
4
  position: relative;
8
5
  `
@@ -14,7 +11,6 @@ export const TopHeader = styled.View`
14
11
  z-index: 1;
15
12
  height: 60px;
16
13
  min-height: 60px;
17
- margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
18
14
  `
19
15
  export const AddressInput = styled.TouchableOpacity`
20
16
  flex: 1;
@@ -35,8 +35,8 @@ const DriverTipsUI = (props: any) => {
35
35
  const theme = useTheme();
36
36
 
37
37
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
38
+ semicircle: {
39
+ borderRadius: 8
40
40
  },
41
41
  inputStyle: {
42
42
  flex: 1,
@@ -75,10 +75,10 @@ const DriverTipsUI = (props: any) => {
75
75
  onPress={() => handlerChangeOption(option)}
76
76
  >
77
77
  <DTCard
78
- style={style.circle}
78
+ style={style.semicircle}
79
79
  isActive={option === optionSelected}
80
80
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
81
+ <OText size={12} numberOfLines={2} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
82
82
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
83
  </OText>
84
84
  </DTCard>
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -1,9 +1,10 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage } from 'ordering-components/native';
3
- import { View, StyleSheet, RefreshControl } from 'react-native';
3
+ import { View, StyleSheet, RefreshControl, Platform } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OrdersOption } from '../OrdersOption'
6
- import { HeaderTitle, OText } from '../shared'
7
+ import { HeaderTitle, OButton, OText } from '../shared'
7
8
  import { ScrollView } from 'react-native-gesture-handler';
8
9
  import { Tab } from './styles'
9
10
  import { useTheme } from 'styled-components/native';
@@ -11,6 +12,7 @@ import { Container } from '../../layouts/Container';
11
12
 
12
13
  export const MyOrders = (props: any) => {
13
14
  const {
15
+ navigation,
14
16
  hideOrders,
15
17
  businessesSearchList
16
18
  } = props
@@ -33,6 +35,9 @@ export const MyOrders = (props: any) => {
33
35
  { key: 'business', value: t('BUSINESS', 'Business') },
34
36
  { key: 'products', value: t('PRODUCTS', 'Products') }
35
37
  ]
38
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
39
+
40
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
36
41
 
37
42
  const handleOnRefresh = () => {
38
43
  setRefreshOrders(true);
@@ -67,7 +72,47 @@ export const MyOrders = (props: any) => {
67
72
  onRefresh={() => handleOnRefresh()}
68
73
  />
69
74
  }>
70
- {!hideOrders && (
75
+ {isChewLayout && (
76
+ <View style={{
77
+ width: '100%',
78
+ display: 'flex',
79
+ flexDirection: 'row',
80
+ alignItems: 'center',
81
+ paddingHorizontal: 40
82
+ }}>
83
+ <OText
84
+ size={24}
85
+ style={{
86
+ marginTop: Platform.OS === 'android' ? 50 : 30,
87
+ paddingHorizontal: 20,
88
+ textTransform: 'capitalize'
89
+ }}
90
+ >
91
+ <OButton
92
+ imgLeftStyle={{ width: 18 }}
93
+ imgRightSrc={null}
94
+ style={{
95
+ borderWidth: 0,
96
+ width: 26,
97
+ height: 26,
98
+ backgroundColor: '#FFF',
99
+ borderColor: '#FFF',
100
+ shadowColor: '#FFF',
101
+ paddingLeft: 0,
102
+ paddingRight: 0,
103
+ }}
104
+ onClick={goToBack}
105
+ icon={AntDesignIcon}
106
+ iconProps={{
107
+ name: 'arrowleft',
108
+ size: 26
109
+ }}
110
+ />
111
+ {t('MY_ORDERS', 'My Orders')}
112
+ </OText>
113
+ </View>
114
+ )}
115
+ {!hideOrders && !isChewLayout && (
71
116
  <HeaderTitle text={t('MY_ORDERS', 'My Orders')} />
72
117
  )}
73
118
  {!allEmpty && (
@@ -12,7 +12,7 @@ import {
12
12
  } from 'react-native';
13
13
  import { PreviousBusinessOrderedParams } from '../../../types';
14
14
 
15
- const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, style }: any) => {
15
+ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, handleCustomUpdate, style }: any) => {
16
16
  return (
17
17
  <>
18
18
  {businesses?.result?.map((business: any, i: number) => (
@@ -31,6 +31,7 @@ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, order
31
31
  businessDeliveryTime={business?.delivery_time}
32
32
  businessPickupTime={business?.pickup_time}
33
33
  businessDistance={business?.distance}
34
+ handleCustomUpdate={handleCustomUpdate}
34
35
  style={style}
35
36
  />
36
37
  ))}
@@ -92,6 +93,7 @@ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) =>
92
93
  businesses,
93
94
  onNavigationRedirect,
94
95
  isBusinessesSearchList,
96
+ handleUpdateBusinesses,
95
97
  } = props
96
98
 
97
99
  const [orderState] = useOrder()
@@ -117,6 +119,7 @@ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) =>
117
119
  orderState={orderState}
118
120
  navigation={navigation}
119
121
  businesses={businesses}
122
+ handleCustomUpdate={handleUpdateBusinesses}
120
123
  />
121
124
  )}
122
125
  </>
@@ -130,6 +133,7 @@ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) =>
130
133
  orderState={orderState}
131
134
  navigation={navigation}
132
135
  businesses={businesses}
136
+ handleCustomUpdate={handleUpdateBusinesses}
133
137
  />
134
138
  )}
135
139
  </ListWrapper>
@@ -49,7 +49,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
49
49
  BusinessControllerSkeletons,
50
50
  businesses,
51
51
  businessPaginationProps,
52
- handleUpdateProducts
52
+ handleUpdateProducts,
53
+ handleUpdateBusinesses
53
54
  } = props
54
55
 
55
56
  const theme = useTheme();
@@ -228,6 +229,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
228
229
  onNavigationRedirect={onNavigationRedirect}
229
230
  isBusinessesSearchList={!!businessesSearchList}
230
231
  businesses={businesses}
232
+ handleUpdateBusinesses={handleUpdateBusinesses}
231
233
  />
232
234
  )}
233
235
 
@@ -141,7 +141,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
141
141
 
142
142
  const handleSaveService = () => {
143
143
  const updated = {
144
- serviceTime: dateSelected,
144
+ serviceTime: moment(dateSelected).utc().format('YYYY-MM-DD HH:mm:00'),
145
145
  professional: currentProfessional
146
146
  }
147
147
  handleSave && handleSave(updated)
@@ -17,7 +17,7 @@ import { LanguageSelector } from '../LanguageSelector'
17
17
  import MessageCircle from 'react-native-vector-icons/AntDesign'
18
18
  import Ionicons from 'react-native-vector-icons/Ionicons'
19
19
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
20
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
20
+ import FontAwesome from 'react-native-vector-icons/FontAwesome'
21
21
  import FastImage from 'react-native-fast-image'
22
22
  import { OAlert } from '../../../../../src/components/shared'
23
23
 
@@ -111,6 +111,7 @@ const ProfileListUI = (props: ProfileParams) => {
111
111
 
112
112
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
113
113
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
114
115
  const onRedirect = (route: string, params?: any) => {
115
116
  navigation.navigate(route, params)
116
117
  }
@@ -199,6 +200,12 @@ const ProfileListUI = (props: ProfileParams) => {
199
200
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
200
201
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MESSAGES', 'Messages')}</OText>
201
202
  </ListItem>
203
+ {isChewLayout && (
204
+ <ListItem onPress={() => onRedirect('MyOrders', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
205
+ <FontAwesome name='list-alt' style={styles.messageIconStyle} color={theme.colors.textNormal} />
206
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_ORDERS', 'My Orders')}</OText>
207
+ </ListItem>
208
+ )}
202
209
  {isWalletEnabled && (
203
210
  <ListItem onPress={() => onRedirect('Wallets', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
204
211
  <Ionicons name='wallet-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -216,6 +216,7 @@ export interface BusinessControllerParams {
216
216
  setFavoriteIds?: any;
217
217
  handleUpdateBusinessList?: any;
218
218
  enableIntersection?: boolean;
219
+ handleCustomUpdate?: (businessId: number, changes: any) => {};
219
220
  }
220
221
  export interface BusinessProductsListingParams {
221
222
  navigation?: any;
@@ -362,6 +363,7 @@ export interface OrdersOptionParams {
362
363
  setRefreshOrders?: (value: boolean) => void,
363
364
  handleUpdateOrderList?: (orderId: number, changes: any) => {},
364
365
  handleUpdateProducts?: (productId: number, changes: any) => {},
366
+ handleUpdateBusinesses?: (businessId: number, changes: any) => {},
365
367
  isBusiness?: boolean,
366
368
  isProducts?: boolean,
367
369
  businessOrderIds?: any,
@@ -726,6 +728,7 @@ export interface PreviousBusinessOrderedParams {
726
728
  isBusinessesSearchList?: any,
727
729
  businessLoading?: boolean,
728
730
  businesses?: any
731
+ handleUpdateBusinesses?: (businessId: number, changes: any) => {},
729
732
  }
730
733
 
731
734
  export interface ServiceFormParams {