ordering-ui-react-native 0.18.11 → 0.18.13

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.11",
3
+ "version": "0.18.13",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -7,13 +7,14 @@ import {
7
7
  View,
8
8
  KeyboardAvoidingView,
9
9
  TextInput,
10
- StyleSheet
10
+ StyleSheet,
11
+ TouchableOpacity
11
12
  } from 'react-native';
12
13
  import { useTheme } from 'styled-components/native';
13
14
  import SelectDropdown from 'react-native-select-dropdown'
14
15
  import { useLanguage } from 'ordering-components/native';
15
16
  import { Content, Timer, TimeField, Header, Comments, CommentsButtonGroup, TopActions } from './styles';
16
- import { OText, OButton, OTextarea, OIconButton } from '../shared';
17
+ import { OText, OButton, OTextarea, OIcon } from '../shared';
17
18
  import { AcceptOrRejectOrderParams } from '../../types';
18
19
 
19
20
  import { orderCommentList } from '../../../../../src/utils'
@@ -95,7 +96,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
95
96
  upper: {
96
97
  flex: 1,
97
98
  zIndex: 1001,
98
- paddingTop: isPage ? 30 : 50,
99
+ paddingTop: isPage ? 30 : 40,
99
100
  marginBottom: 10,
100
101
  backgroundColor: theme.colors.backgroundPage
101
102
  },
@@ -109,7 +110,18 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
109
110
  bottom: {
110
111
  textAlignVertical: "center",
111
112
  textAlign: "center",
112
- }
113
+ },
114
+ btnBackArrow: {
115
+ borderWidth: 0,
116
+ width: 32,
117
+ height: 32,
118
+ tintColor: theme.colors.textGray,
119
+ backgroundColor: theme.colors.clear,
120
+ borderColor: theme.colors.clear,
121
+ shadowColor: theme.colors.clear,
122
+ paddingLeft: 0,
123
+ paddingRight: 0
124
+ },
113
125
  })
114
126
 
115
127
  const handleFocus = () => {
@@ -299,18 +311,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
299
311
  <View style={styles.parent}>
300
312
  <View style={styles.upper}>
301
313
  <TopActions>
302
- <OIconButton
303
- icon={theme.images.general.arrow_left}
304
- borderColor={theme.colors.clear}
305
- iconStyle={{ width: 20, height: 20 }}
306
- style={{
307
- maxWidth: 40,
308
- height: 35,
309
- justifyContent: 'flex-end',
310
- marginBottom: 10,
311
- }}
312
- onClick={() => handleArrowBack()}
313
- />
314
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
315
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
316
+ </TouchableOpacity>
314
317
  <OText
315
318
  size={20}
316
319
  color={theme.colors.textGray}
@@ -518,7 +521,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
518
521
  imgRightSrc={null}
519
522
  style={{ borderRadius: 7, height: 45 }}
520
523
  parentStyle={{ width: '100%' }}
521
- textStyle={{color: '#FFF', fontSize: 18 }}
524
+ textStyle={{ color: '#FFF', fontSize: 18 }}
522
525
  isDisabled={!rejectReason && showTextArea}
523
526
  onClick={() => handleAcceptOrReject()}
524
527
  />
@@ -285,8 +285,8 @@ export const BusinessBasicInformation = (
285
285
  : { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
286
286
  }
287
287
  {...(!loading && {
288
- source: (header || businessState?.business?.header) ? {
289
- uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header
288
+ source: (header || businessState?.business?.header || typeof theme?.images?.dummies?.businessHeader === 'string') ? {
289
+ uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header || theme?.images?.dummies?.businessHeader
290
290
  } : theme?.images?.dummies?.businessHeader
291
291
  })}
292
292
  imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
@@ -317,11 +317,11 @@ export const BusinessBasicInformation = (
317
317
  {!hideLogo && (
318
318
  <BusinessLogo isChewLayout={isChewLayout}>
319
319
  {!isBusinessInfoShow && (
320
- logo || businessState?.business?.logo ?
320
+ logo || businessState?.business?.logo || typeof theme.images.dummies.businessLogo === 'string' ?
321
321
  <FastImage
322
322
  style={styles.logoStyle}
323
323
  source={{
324
- uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit'),
324
+ uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit') || theme.images.dummies.businessLogo,
325
325
  priority: FastImage.priority.high,
326
326
  cache: FastImage.cacheControl.web
327
327
  }}
@@ -204,10 +204,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
204
204
  {!hideBusinessHeader && (
205
205
  <FastImage
206
206
  style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
207
- source={(businessHeader || business?.header) ? {
208
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
207
+ source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
208
+ uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
209
209
  priority: FastImage.priority.normal,
210
- } : theme.images.dummies.businessHeader}
210
+ } : theme.images.dummies.businessHeader}
211
211
  resizeMode={FastImage.resizeMode.cover}
212
212
  />
213
213
  )}
@@ -247,8 +247,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
247
247
  <BusinessLogo style={styles.businessLogo}>
248
248
  <FastImage
249
249
  style={{ width: 56, height: 56 }}
250
- source={(businessLogo || business?.logo) ? {
251
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
250
+ source={(businessLogo || business?.logo || typeof theme.images.dummies.businessLogo === 'string') ? {
251
+ uri: optimizeImage(businessLogo || business?.logo || theme.images.dummies.businessLogo, 'h_150,c_limit'),
252
252
  priority: FastImage.priority.normal,
253
253
  } : theme.images.dummies.businessLogo}
254
254
  resizeMode={FastImage.resizeMode.cover}
@@ -123,7 +123,9 @@ const OrderMessageUI = (props: any) => {
123
123
  setMessages,
124
124
  readMessages,
125
125
  messagesReadList,
126
- setOpenMessges
126
+ setOpenMessges,
127
+ setSeletedOrder,
128
+ setSelectedOrderId
127
129
  } = props;
128
130
  const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
129
131
  const [openModalForDriver, setOpenModalForDriver] = useState(false);
@@ -140,6 +142,8 @@ const OrderMessageUI = (props: any) => {
140
142
 
141
143
  const handleClose = () => {
142
144
  setOpenMessges(false)
145
+ setSeletedOrder(null)
146
+ setSelectedOrderId(null)
143
147
  }
144
148
 
145
149
  const handleOpenMessages = (data: any) => {
@@ -269,7 +273,7 @@ export const MessageListing = (props: MessageListingParams) => {
269
273
  setOpenMessges={setOpenMessges}
270
274
  franchiseId={props.franchiseId}
271
275
  />
272
- {openMessages && seletedOrder && (
276
+ {openMessages && !!seletedOrder?.id && (
273
277
  <OModal
274
278
  open={openMessages}
275
279
  entireModal
@@ -278,7 +282,10 @@ export const MessageListing = (props: MessageListingParams) => {
278
282
  >
279
283
  <MessagesView
280
284
  order={seletedOrder}
285
+ orderId={seletedOrder?.id}
281
286
  setOpenMessges={setOpenMessges}
287
+ setSeletedOrder={setSeletedOrder}
288
+ setSelectedOrderId={setSelectedOrderId}
282
289
  />
283
290
  </OModal>
284
291
  )}
@@ -412,6 +412,11 @@ const MessagesUI = (props: MessagesParams) => {
412
412
  );
413
413
  }
414
414
 
415
+ useEffect(() => {
416
+ if (!order?.id || messages?.loading) return
417
+ readMessages && readMessages()
418
+ }, [order?.id, messages?.loading])
419
+
415
420
  return (
416
421
  <View style={{ height: getViewHeight(), width: '100%', paddingTop: 12, backgroundColor: 'white' }}>
417
422
  <Wrapper>
@@ -450,7 +455,7 @@ const MessagesUI = (props: MessagesParams) => {
450
455
  active={business}
451
456
  >
452
457
  <OIcon
453
- url={order?.business?.logo}
458
+ url={order?.business?.logo || theme.images.dummies.businessLogo}
454
459
  width={32}
455
460
  height={32}
456
461
  style={{ borderRadius: 32 }}
@@ -280,7 +280,9 @@ const MultiCheckoutUI = (props: any) => {
280
280
  hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
281
281
  onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
282
282
  />
283
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
283
+ {openCarts.length > 1 && (
284
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
285
+ )}
284
286
  </React.Fragment>
285
287
  ))}
286
288
  {!cartGroup?.loading && openCarts.length === 0 && (
@@ -295,7 +297,7 @@ const MultiCheckoutUI = (props: any) => {
295
297
  {t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')}
296
298
  </OText>
297
299
  )}
298
- {openCarts.length > 0 && (
300
+ {openCarts.length > 1 && (
299
301
  <ChCartsTotal>
300
302
  {totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
301
303
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
@@ -192,7 +192,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
192
192
  order: {
193
193
  id: order?.id,
194
194
  business_id: order?.business_id,
195
- logo: order.business?.logo,
195
+ logo: order.business?.logo || theme.images.dummies.businessLogo,
196
196
  driver: order?.driver,
197
197
  products: order?.products,
198
198
  review: order?.review,
@@ -283,8 +283,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
283
283
  {!hideProductLogo && (
284
284
  <FastImage
285
285
  style={styles.productStyle}
286
- source={product?.images ? {
287
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
286
+ source={product?.images || typeof theme?.images?.dummies?.product === 'string' ? {
287
+ uri: optimizeImage(product?.images || theme?.images?.dummies?.products, 'h_250,c_limit'),
288
288
  priority: FastImage.priority.normal,
289
289
  } : theme?.images?.dummies?.product}
290
290
  resizeMode={FastImage.resizeMode.cover}
@@ -52,7 +52,7 @@ const OModal = (props: Props): React.ReactElement => {
52
52
 
53
53
  const theme = useTheme();
54
54
 
55
- const RenderSafeAreaView = () => (
55
+ const renderSafeAreaView = () => (
56
56
  <SafeAreaView style={styles.container}>
57
57
  {!entireModal ? (
58
58
  <View style={styles.centeredView}>
@@ -101,10 +101,10 @@ const OModal = (props: Props): React.ReactElement => {
101
101
  enabled
102
102
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
103
103
  >
104
- <RenderSafeAreaView/>
104
+ {renderSafeAreaView()}
105
105
  </KeyboardView>
106
106
  ) : (
107
- <RenderSafeAreaView/>
107
+ renderSafeAreaView()
108
108
  )}
109
109
  </Modal>
110
110
  );