ordering-ui-react-native 0.18.1 → 0.18.2

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.1",
3
+ "version": "0.18.2",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -29,6 +29,10 @@ import { ReviewCustomer } from '../ReviewCustomer'
29
29
 
30
30
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
31
31
 
32
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
33
+
34
+ const { useDeviceOrientation } = DeviceOrientationMethods
35
+
32
36
  interface OrderContent {
33
37
  order: any,
34
38
  logisticOrderStatus?: Array<number>,
@@ -44,7 +48,9 @@ export const OrderContentComponent = (props: OrderContent) => {
44
48
  const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
45
49
  const [{ parsePrice, parseNumber }] = useUtils();
46
50
  const [{ configs }] = useConfig();
47
- const distanceUnit = configs?.distance_unit?.value
51
+ const [orientationState] = useDeviceOrientation();
52
+
53
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
48
54
 
49
55
  const [openReviewModal, setOpenReviewModal] = useState(false)
50
56
 
@@ -103,7 +109,7 @@ export const OrderContentComponent = (props: OrderContent) => {
103
109
  }
104
110
 
105
111
  const onTextLayout = useCallback((e: any) => {
106
- setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
112
+ setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
107
113
  },[]);
108
114
 
109
115
  return (
@@ -9,12 +9,15 @@ import {
9
9
 
10
10
  //Components
11
11
  import {
12
+ OIcon,
12
13
  OIconButton,
13
14
  OText,
14
15
  } from '../shared'
15
16
 
16
17
  import { useTheme } from 'styled-components/native';
17
- import { StyleSheet, View } from 'react-native';
18
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
19
+ import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'
20
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
18
21
 
19
22
  import {
20
23
  useLanguage,
@@ -54,6 +57,19 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
54
57
  height: 40,
55
58
  padding: 10,
56
59
  alignItems: 'flex-end',
60
+ color: theme.colors.textGray,
61
+ },
62
+ btnBackArrow: {
63
+ borderWidth: 0,
64
+ width: 32,
65
+ height: 32,
66
+ tintColor: theme.colors.textGray,
67
+ backgroundColor: theme.colors.clear,
68
+ borderColor: theme.colors.clear,
69
+ shadowColor: theme.colors.clear,
70
+ paddingLeft: 0,
71
+ paddingRight: 0,
72
+ marginTop: 10
57
73
  },
58
74
  })
59
75
 
@@ -108,42 +124,30 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
108
124
  <>
109
125
  {!props.isCustomView && (
110
126
  <Header>
111
- <OIconButton
112
- icon={theme.images.general.arrow_left}
113
- iconStyle={{ width: 20, height: 20 }}
114
- borderColor={theme.colors.clear}
115
- style={{ ...styles.icons, justifyContent: 'flex-end' }}
116
- onClick={() => handleArrowBack()}
117
- />
118
-
127
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
128
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
129
+ </TouchableOpacity>
119
130
  {(!order?.isLogistic || (!logisticOrderStatus?.includes(order?.status) && !order?.order_group)) && (
120
131
  <Actions>
121
132
  {getOrderStatus(order?.status, t)?.value !==
122
133
  t('PENDING', 'Pending') && (
123
134
  <>
124
- <OIconButton
125
- icon={theme.images.general.copy}
126
- iconStyle={{
127
- width: 20,
128
- height: 25,
129
- top: 2,
130
- tintColor: theme.colors.backArrow,
131
- }}
132
- borderColor={theme.colors.clear}
133
- style={styles.icons}
134
- onClick={() => handleCopyClipboard?.()}
135
- />
136
- <OIconButton
137
- icon={theme.images.general.print}
138
- iconStyle={{
139
- width: 25,
140
- height: 22,
141
- tintColor: theme.colors.backArrow,
142
- }}
143
- borderColor={theme.colors.clear}
144
- style={styles.icons}
145
- onClick={() => handleViewSummaryOrder?.()}
146
- />
135
+ <TouchableOpacity onPress={() => handleCopyClipboard?.()}>
136
+ <MaterialCommunityIcons
137
+ name='content-copy'
138
+ color={theme.colors.textGray}
139
+ size={20}
140
+ style={styles.icons}
141
+ />
142
+ </TouchableOpacity>
143
+ <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
144
+ <SimpleLineIcons
145
+ name='printer'
146
+ color={theme.colors.textGray}
147
+ size={20}
148
+ style={styles.icons}
149
+ />
150
+ </TouchableOpacity>
147
151
  </>
148
152
  )}
149
153
  <OIconButton
@@ -151,7 +155,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
151
155
  iconStyle={{
152
156
  width: 20,
153
157
  height: 20,
154
- tintColor: theme.colors.backArrow,
158
+ tintColor: theme.colors.textGray,
155
159
  }}
156
160
  borderColor={theme.colors.clear}
157
161
  style={styles.icons}
@@ -163,7 +167,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
163
167
  iconStyle={{
164
168
  width: 20,
165
169
  height: 20,
166
- tintColor: theme.colors.backArrow,
170
+ tintColor: theme.colors.textGray,
167
171
  }}
168
172
  borderColor={theme.colors.clear}
169
173
  style={styles.icons}
@@ -193,29 +197,22 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
193
197
  {getOrderStatus(order?.status, t)?.value !==
194
198
  t('PENDING', 'Pending') && (
195
199
  <>
196
- <OIconButton
197
- icon={theme.images.general.copy}
198
- iconStyle={{
199
- width: 20,
200
- height: 25,
201
- top: 2,
202
- tintColor: theme.colors.backArrow,
203
- }}
204
- borderColor={theme.colors.clear}
205
- style={styles.icons}
206
- onClick={() => handleCopyClipboard?.()}
207
- />
208
- <OIconButton
209
- icon={theme.images.general.print}
210
- iconStyle={{
211
- width: 25,
212
- height: 22,
213
- tintColor: theme.colors.backArrow,
214
- }}
215
- borderColor={theme.colors.clear}
216
- style={styles.icons}
217
- onClick={() => handleViewSummaryOrder?.()}
218
- />
200
+ <TouchableOpacity onPress={() => handleCopyClipboard?.()}>
201
+ <MaterialCommunityIcons
202
+ name='content-copy'
203
+ color={theme.colors.textGray}
204
+ size={20}
205
+ style={styles.icons}
206
+ />
207
+ </TouchableOpacity>
208
+ <TouchableOpacity onPress={() => handleViewSummaryOrder?.()}>
209
+ <SimpleLineIcons
210
+ name='printer'
211
+ color={theme.colors.textGray}
212
+ size={20}
213
+ style={styles.icons}
214
+ />
215
+ </TouchableOpacity>
219
216
  </>
220
217
  )}
221
218
  <OIconButton
@@ -223,7 +220,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
223
220
  iconStyle={{
224
221
  width: 20,
225
222
  height: 20,
226
- tintColor: theme.colors.backArrow,
223
+ tintColor: theme.colors.textGray,
227
224
  }}
228
225
  borderColor={theme.colors.clear}
229
226
  style={styles.icons}
@@ -235,7 +232,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
235
232
  iconStyle={{
236
233
  width: 20,
237
234
  height: 20,
238
- tintColor: theme.colors.backArrow,
235
+ tintColor: theme.colors.textGray,
239
236
  }}
240
237
  borderColor={theme.colors.clear}
241
238
  style={styles.icons}
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
3
3
  import { Chat } from '../Chat';
4
- import { StyleSheet, View, BackHandler } from 'react-native';
4
+ import { StyleSheet, View, BackHandler, TouchableOpacity } from 'react-native';
5
5
  import {
6
6
  useLanguage,
7
7
  OrderDetails as OrderDetailsController,
@@ -9,7 +9,7 @@ import {
9
9
  } from 'ordering-components/native';
10
10
  import { useUtils } from 'ordering-components/native';
11
11
 
12
- import { OIcon, OIconButton, OText } from '../shared';
12
+ import { OIcon, OText } from '../shared';
13
13
  import { OrderDetailsParams } from '../../types';
14
14
  import { USER_TYPE } from '../../config/constants';
15
15
  import { useTheme } from 'styled-components/native';
@@ -146,13 +146,6 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
146
146
  shadowRadius: 3.84,
147
147
  elevation: 3,
148
148
  },
149
- cancelBtn: {
150
- marginRight: 5,
151
- zIndex: 10000,
152
- height: 30,
153
- width: 20,
154
- justifyContent: 'flex-end',
155
- },
156
149
  modalText: {
157
150
  fontFamily: 'Poppins',
158
151
  fontStyle: 'normal',
@@ -161,6 +154,18 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
161
154
  textAlign: 'center',
162
155
  zIndex: 10,
163
156
  },
157
+ btnBackArrow: {
158
+ borderWidth: 0,
159
+ width: 32,
160
+ height: 32,
161
+ tintColor: theme.colors.textGray,
162
+ backgroundColor: theme.colors.clear,
163
+ borderColor: theme.colors.clear,
164
+ shadowColor: theme.colors.clear,
165
+ paddingLeft: 0,
166
+ paddingRight: 0,
167
+ marginTop: 10
168
+ },
164
169
  });
165
170
 
166
171
  return (
@@ -260,13 +265,9 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
260
265
  <>
261
266
  <View style={styles.titleSection}>
262
267
  <View style={styles.titleGroups}>
263
- <OIconButton
264
- icon={theme.images.general.arrow_left}
265
- iconStyle={{ width: 23, height: 23 }}
266
- borderColor={theme.colors.clear}
267
- style={styles.cancelBtn}
268
- onClick={handleArrowBack}
269
- />
268
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
269
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
270
+ </TouchableOpacity>
270
271
 
271
272
  <OText size={16} style={styles.modalText} adjustsFontSizeToFit>
272
273
  {`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id}`}
@@ -292,7 +293,7 @@ export const OrderMessageUI = (props: OrderDetailsParams) => {
292
293
  <OIcon
293
294
  url={optimizeImage(
294
295
  order?.customer?.photo ||
295
- theme?.images?.dummies?.customerPhoto,
296
+ theme?.images?.dummies?.customerPhoto,
296
297
  'h_300,c_limit',
297
298
  )}
298
299
  style={styles.titleIcons}
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform } from 'react-native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
3
3
  import { useLanguage, useUtils, useToast, OrderListGroups, useConfig } from 'ordering-components/native';
4
4
  import SelectDropdown from 'react-native-select-dropdown'
5
5
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
@@ -239,6 +239,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
239
239
  overflow: 'hidden',
240
240
  minHeight: 155
241
241
  },
242
+ btnBackArrow: {
243
+ borderWidth: 0,
244
+ width: 32,
245
+ height: 32,
246
+ tintColor: theme.colors.textGray,
247
+ backgroundColor: theme.colors.clear,
248
+ borderColor: theme.colors.clear,
249
+ shadowColor: theme.colors.clear,
250
+ paddingLeft: 0,
251
+ paddingRight: 0,
252
+ marginBottom: 30,
253
+ marginTop: 30
254
+ },
242
255
  rowStyle: {
243
256
  display: 'flex',
244
257
  borderBottomWidth: 0,
@@ -696,20 +709,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
696
709
  <ModalContainer
697
710
  nestedScrollEnabled={true}
698
711
  >
699
- <OIconButton
700
- icon={theme.images.general.arrow_left}
701
- borderColor={theme.colors.clear}
702
- iconColor={theme.colors.backArrow}
703
- iconStyle={{ width: 20, height: 13 }}
704
- style={{
705
- maxWidth: 40,
706
- height: 35,
707
- justifyContent: 'flex-end',
708
- marginBottom: 30,
709
- marginTop: 30
710
- }}
711
- onClick={() => handleClose()}
712
- />
712
+ <TouchableOpacity onPress={() => handleClose()} style={styles.btnBackArrow}>
713
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
714
+ </TouchableOpacity>
713
715
  {openSearchModal && (
714
716
  <SearchModalContent>
715
717
  <ModalTitle>{t('SEARCH_ORDERS', 'Search orders')}</ModalTitle>
@@ -3,6 +3,10 @@ import { View, Animated, TouchableOpacity } from 'react-native';
3
3
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
4
4
  import { useUtils, useLanguage } from 'ordering-components/native';
5
5
  import { useTheme } from 'styled-components/native';
6
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
7
+
8
+ const { useDeviceOrientation } = DeviceOrientationMethods
9
+
6
10
  import {
7
11
  Accordion,
8
12
  AccordionSection,
@@ -34,6 +38,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
34
38
  const [, t] = useLanguage();
35
39
  const theme = useTheme();
36
40
  const [{ parsePrice }] = useUtils();
41
+ const [orientationState] = useDeviceOrientation();
42
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
37
43
 
38
44
  const [isActive, setActiveState] = useState(false);
39
45
  const [isReadMore, setIsReadMore] = useState(false);
@@ -111,7 +117,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
111
117
  }, []);
112
118
 
113
119
  const onTextLayout = useCallback((e: any) => {
114
- setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
120
+ setLengthMore((e.nativeEvent.lines.length == 2 && e.nativeEvent.lines[1].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 2); //to check the text is more than 2 lines or not
115
121
  },[]);
116
122
 
117
123
  return (
@@ -86,6 +86,18 @@ const ReviewCustomerUI = (props: ReviewCustomerParams) => {
86
86
  marginBottom: 10,
87
87
  backgroundColor: theme.colors.lightGray
88
88
  },
89
+ btnBackArrow: {
90
+ borderWidth: 0,
91
+ width: 32,
92
+ height: 32,
93
+ tintColor: theme.colors.textGray,
94
+ backgroundColor: theme.colors.clear,
95
+ borderColor: theme.colors.clear,
96
+ shadowColor: theme.colors.clear,
97
+ paddingLeft: 0,
98
+ paddingRight: 0,
99
+ marginBottom: 20
100
+ },
89
101
  inputTextArea: {
90
102
  borderColor: theme.colors.lightGray,
91
103
  borderRadius: 8,
@@ -177,18 +189,9 @@ const ReviewCustomerUI = (props: ReviewCustomerParams) => {
177
189
  }}
178
190
  >
179
191
  <View>
180
- <OIconButton
181
- icon={theme.images.general.arrow_left}
182
- borderColor={theme.colors.clear}
183
- iconStyle={{ width: 20, height: 16 }}
184
- style={{
185
- maxWidth: 40,
186
- height: 20,
187
- justifyContent: 'flex-end',
188
- marginBottom: 20,
189
- }}
190
- onClick={() => closeModal()}
191
- />
192
+ <TouchableOpacity onPress={() => closeModal()} style={styles.btnBackArrow}>
193
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
194
+ </TouchableOpacity>
192
195
  <OText
193
196
  size={20}
194
197
  weight="600"
@@ -415,7 +415,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
415
415
  <BackgroundGray isIos={Platform.OS === 'ios'} />
416
416
  )}
417
417
  <IOScrollView
418
- stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 2]}
418
+ stickyHeaderIndices={[business?.professionals?.length > 0 ? 3 : 2]}
419
419
  style={{
420
420
  ...styles.mainContainer,
421
421
  marginBottom: currentCart?.products?.length > 0 && categoryState.products.length !== 0 ?
@@ -24,6 +24,7 @@ const DriverTipsUI = (props: any) => {
24
24
  driverTipsOptions,
25
25
  isMulti,
26
26
  cart,
27
+ carts,
27
28
  isDriverTipUseCustom,
28
29
  handlerChangeOption,
29
30
  isFixedPrice
@@ -64,6 +65,10 @@ const DriverTipsUI = (props: any) => {
64
65
  setvalue(val)
65
66
  }
66
67
 
68
+ const multiCartTipsAmmout = carts?.reduce((total: any, cart: any) => {
69
+ return total + parseFloat(cart?.driver_tip || 0)
70
+ }, 0)
71
+
67
72
  return (
68
73
  <DTContainer>
69
74
  <DTLabel>
@@ -138,7 +143,7 @@ const DriverTipsUI = (props: any) => {
138
143
  style={{ marginTop: 10, textAlign: 'center' }}
139
144
  >
140
145
  {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
141
- ` (${driverTip}%)`}: {isFixedPrice ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
146
+ ` (${driverTip}%)`}: {isFixedPrice ? parsePrice(multiCartTipsAmmout ?? driverTip) : parsePrice(multiCartTipsAmmout ?? cart?.driver_tip)}
142
147
  </OText>
143
148
  )}
144
149
  </DTContainer>
@@ -481,9 +481,9 @@ export const ProductOptionsUI = (props: any) => {
481
481
  : t('LOGIN_SIGNUP', 'Login / Sign Up')
482
482
  }
483
483
  imgRightSrc=""
484
- textStyle={{ color: theme.colors.primary, fontSize: 14 }}
484
+ textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
485
485
  style={{
486
- height: 44,
486
+ height: 42,
487
487
  borderColor: theme.colors.primary,
488
488
  backgroundColor: theme.colors.white,
489
489
  paddingLeft: 0,
@@ -498,7 +498,7 @@ export const ProductOptionsUI = (props: any) => {
498
498
  <PlaceholderLine width={60} height={20} />
499
499
  </Placeholder>
500
500
  ) : (
501
- <OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
501
+ <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
502
502
  )}
503
503
  </TouchableOpacity>
504
504
  )}