ordering-ui-react-native 0.12.26 → 0.12.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.12.26",
3
+ "version": "0.12.27",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -25,9 +25,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
25
25
  closeModal,
26
26
  orderId,
27
27
  notShowCustomerPhone,
28
- titleAccept,
29
- titleReject,
30
- titleNotReady,
28
+ orderTitle,
31
29
  appTitle,
32
30
  } = props;
33
31
 
@@ -45,7 +43,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
45
43
  const phoneNumber = customerCellphone;
46
44
  let codeNumberPhone, numberPhone, numberToShow;
47
45
  const { top, bottom } = useSafeAreaInsets()
48
-
46
+ const titleOrder = t(orderTitle[action].key, orderTitle[action].text)
47
+ const buttonText = t(orderTitle[action].btnKey, orderTitle[action].btnText)
48
+ const showTextArea = ['reject', 'deliveryFailed', 'pickupFailed', 'notReady'].includes(action)
49
49
  const handleFocus = () => {
50
50
  viewRef?.current?.measure((x: any, y: any) => {
51
51
  scrollViewRef?.current?.scrollTo({ x: 0, y });
@@ -112,7 +112,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
112
112
  openTimerIOnput();
113
113
  }
114
114
 
115
- if (actions && (action === 'reject' || action === 'failed' || action === 'notReady')) {
115
+ if (actions && showTextArea) {
116
116
  openTextTareaOInput();
117
117
  }
118
118
  }, []);
@@ -179,7 +179,11 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
179
179
  comment: comments,
180
180
  status: 6,
181
181
  },
182
- failedByDriver: {
182
+ pickupFailedByDriver: {
183
+ comment: comments,
184
+ status: 10
185
+ },
186
+ deliveryFailedByDriver: {
183
187
  comment: comments,
184
188
  status: 12
185
189
  },
@@ -195,8 +199,11 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
195
199
  if (actions && action === 'reject') {
196
200
  bodyToSend = orderStatus[actions.reject];
197
201
  }
198
- if (actions && action === 'failed') {
199
- bodyToSend = orderStatus[actions.failed]
202
+ if (actions && action === 'pickupFailed') {
203
+ bodyToSend = orderStatus[actions.pickupFailed]
204
+ }
205
+ if (actions && action === 'deliveryFailed') {
206
+ bodyToSend = orderStatus[actions.deliveryFailed]
200
207
  }
201
208
  if (actions && action === 'notReady') {
202
209
  bodyToSend = orderStatus[actions.notReady]
@@ -233,11 +240,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
233
240
  fontStyle: 'normal',
234
241
  }}
235
242
  weight="600">
236
- {action === 'accept'
237
- ? `${t(titleAccept?.key, titleAccept?.text)}:`
238
- : action === 'notReady'
239
- ? t(titleNotReady?.key, titleNotReady?.text)
240
- : t(titleReject?.key, titleReject?.text)}
243
+ {titleOrder}
241
244
  </OText>
242
245
  </View>
243
246
  <Content showsVerticalScrollIndicator={false} ref={scrollViewRef}>
@@ -362,11 +365,11 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
362
365
  onEndEditing={handleFixTime}
363
366
  />
364
367
 
365
- {(['failed', 'reject', 'notReady']?.includes(action)) && (
368
+ {showTextArea && (
366
369
  <Comments ref={viewRef}>
367
370
  <OTextarea
368
371
  textTareaRef={textTareaRef}
369
- autoFocus={actions && (action === 'reject' || action === 'failed' || action === 'notReady')}
372
+ autoFocus
370
373
  onFocus={handleFocus}
371
374
  placeholder={t(
372
375
  'PLEASE_TYPE_YOUR_COMMENTS_IN_HERE',
@@ -385,13 +388,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
385
388
  firstButtonClick={() => {
386
389
  handleAcceptOrReject();
387
390
  }}
388
- btnText={
389
- action === 'accept'
390
- ? t('ACCEPT', 'Accept')
391
- : action === 'notReady'
392
- ? t('ORDER_NOT_READY', 'Order not ready')
393
- : t('REJECT', 'Reject')
394
- }
391
+ btnText={buttonText}
395
392
  color={action === 'accept' ? theme.colors.green : theme.colors.red}
396
393
  widthButton={'100%'}
397
394
  />
@@ -574,6 +574,7 @@ const LoginFormUI = (props: LoginParams) => {
574
574
  forwardRef={inputRef}
575
575
  onChange={(val: any) => onChange(val)}
576
576
  returnKeyType="done"
577
+ onSubmitEditing={() => handleLogin()}
577
578
  blurOnSubmit
578
579
  />
579
580
  )}
@@ -48,9 +48,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
48
48
  updateDriverPosition,
49
49
  driverUpdateLocation,
50
50
  setDriverUpdateLocation,
51
- titleAccept,
52
- titleReject,
53
- titleNotReady,
51
+ orderTitle,
54
52
  appTitle,
55
53
  } = props;
56
54
 
@@ -343,9 +341,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
343
341
  orderId={order?.id}
344
342
  notShowCustomerPhone
345
343
  actions={actions}
346
- titleAccept={titleAccept}
347
- titleReject={titleReject}
348
- titleNotReady={titleNotReady}
344
+ orderTitle={orderTitle}
349
345
  appTitle={appTitle}
350
346
  />
351
347
  </OModal>
@@ -391,7 +387,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
391
387
  handleChangeOrderStatus && handleChangeOrderStatus(9)
392
388
  }
393
389
  firstButtonClick={() =>
394
- handleViewActionOrder && handleViewActionOrder('failed')
390
+ handleViewActionOrder && handleViewActionOrder('pickupFailed')
395
391
  }
396
392
  secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
397
393
  secondButton={true}
@@ -410,7 +406,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
410
406
  handleChangeOrderStatus && handleChangeOrderStatus(11)
411
407
  }
412
408
  firstButtonClick={() =>
413
- handleViewActionOrder && handleViewActionOrder('failed')
409
+ handleViewActionOrder && handleViewActionOrder('deliveryFailed')
414
410
  }
415
411
  secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
416
412
  secondButton={true}
@@ -42,10 +42,11 @@ export const OrdersOptionDate = (props: any) => {
42
42
  bgcolor={theme.colors.inputDisabled}
43
43
  textcolor={theme.colors.unselectText}
44
44
  placeholder={t('SELECT_DATE', 'Select Date')}
45
- dropViewMaxHeight={500}
45
+ dropViewMaxHeight={220}
46
46
  isCalendar
47
47
  rangeDate={search.date}
48
48
  handleChangeDate={handleChangeDate}
49
+ isCalendarAlwaysVisible
49
50
  />
50
51
  </Container>
51
52
  );
@@ -22,7 +22,8 @@ interface Props {
22
22
  textcolor?: string,
23
23
  isCalendar?: boolean,
24
24
  handleChangeDate?: any,
25
- rangeDate?: any
25
+ rangeDate?: any,
26
+ isCalendarAlwaysVisible?: boolean
26
27
  }
27
28
 
28
29
  const Wrapper = styled.View`
@@ -94,7 +95,8 @@ const ODropDownCalendar = (props: Props) => {
94
95
  isModal,
95
96
  isCalendar,
96
97
  handleChangeDate,
97
- rangeDate
98
+ rangeDate,
99
+ isCalendarAlwaysVisible
98
100
  } = props
99
101
 
100
102
  const theme = useTheme();
@@ -127,13 +129,13 @@ const ODropDownCalendar = (props: Props) => {
127
129
  }
128
130
 
129
131
  const customDayHeaderStylesCallback = () => {
130
- return {
131
- textStyle: {
132
- color: theme.colors.unselectText,
133
- fontSize: 12,
134
- },
135
- };
136
- };
132
+ return {
133
+ textStyle: {
134
+ color: theme.colors.unselectText,
135
+ fontSize: 12,
136
+ },
137
+ };
138
+ };
137
139
 
138
140
  const calendarText = (from: any, to: any, placeholder: any) => {
139
141
  const end = ` ~ ${to}`
@@ -204,9 +206,9 @@ const ODropDownCalendar = (props: Props) => {
204
206
  </ScrollView>
205
207
  ) : (
206
208
  <CustomScrollView style={{
207
- maxHeight: dropViewMaxHeight || null
209
+ maxHeight: dropViewMaxHeight || null,
208
210
  }}
209
- nestedScrollEnabled={true}
211
+ nestedScrollEnabled={true}
210
212
  >
211
213
  {options.map((option: any, index: number) => (
212
214
  <CustomTouchableOpacity
@@ -243,8 +245,8 @@ const ODropDownCalendar = (props: Props) => {
243
245
  alignItems: 'center',
244
246
  marginTop: 10
245
247
  }}>
246
- <View style={{marginRight: 10, flex: 1, marginBottom: 15}}>
247
- <Text style={{marginBottom: 5}}>{t('FROM', 'From')}</Text>
248
+ <View style={{ marginRight: 10, flex: 1, marginBottom: 15 }}>
249
+ <Text style={{ marginBottom: 5 }}>{t('FROM', 'From')}</Text>
248
250
  <DateInput
249
251
  value={rangeDate.from}
250
252
  placeholder={t('FROM', 'From')}
@@ -259,12 +261,12 @@ const ODropDownCalendar = (props: Props) => {
259
261
  name='close'
260
262
  color={theme.colors.disabled}
261
263
  size={20}
262
- style={{position: 'absolute', bottom: 13, right: 10}}
264
+ style={{ position: 'absolute', bottom: 13, right: 10 }}
263
265
  onPress={() => handleChangeDate('', rangeDate.to)}
264
266
  />
265
267
  </View>
266
- <View style={{marginLeft: 10, flex: 1, marginBottom: 15}}>
267
- <Text style={{marginBottom: 5}}>{t('TO', 'To')}</Text>
268
+ <View style={{ marginLeft: 10, flex: 1, marginBottom: 15 }}>
269
+ <Text style={{ marginBottom: 5 }}>{t('TO', 'To')}</Text>
268
270
  <DateInput
269
271
  value={rangeDate.to}
270
272
  placeholder={t('TO', 'To')}
@@ -279,13 +281,13 @@ const ODropDownCalendar = (props: Props) => {
279
281
  name='close'
280
282
  color={theme.colors.disabled}
281
283
  size={20}
282
- style={{position: 'absolute', bottom: 13, right: 10}}
284
+ style={{ position: 'absolute', bottom: 13, right: 10 }}
283
285
  onPress={() => handleChangeDate(rangeDate.from, '')}
284
286
  />
285
287
  </View>
286
288
  </View>
287
289
  {
288
- defaultValue === 'calendar' && (
290
+ (defaultValue === 'calendar' || isCalendarAlwaysVisible) && (
289
291
  <CalendarPicker
290
292
  previousComponent={
291
293
  <FeatherIcon
@@ -365,6 +365,7 @@ export interface OrderDetailsParams {
365
365
  updateDriverPosition?: any;
366
366
  driverUpdateLocation?: any;
367
367
  setDriverUpdateLocation?: any;
368
+ orderTitle?: any
368
369
  }
369
370
  export interface ProductItemAccordionParams {
370
371
  isCartPending?: boolean;
@@ -520,7 +521,8 @@ export interface TagsParams {
520
521
  interface actions {
521
522
  accept: string;
522
523
  reject: string;
523
- failed: string;
524
+ pickupFailed: string;
525
+ deliveryFailed: string;
524
526
  notReady: string;
525
527
  }
526
528
 
@@ -542,6 +544,7 @@ export interface AcceptOrRejectOrderParams {
542
544
  titleReject?: textTranslate;
543
545
  titleNotReady?: textTranslate;
544
546
  appTitle?: textTranslate;
547
+ orderTitle?: any
545
548
  }
546
549
 
547
550
  export interface MapViewParams {