ordering-ui-react-native 0.15.18 → 0.15.19
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 +1 -1
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/Messages/index.tsx +16 -20
- package/themes/original/src/components/OrderDetails/index.tsx +21 -76
- package/themes/original/src/components/UserProfile/index.tsx +8 -6
- package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
- package/themes/original/src/types/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -25,6 +25,7 @@ import { ReviewProducts } from './src/components/ReviewProducts';
|
|
|
25
25
|
import { ReviewDriver } from './src/components/ReviewDriver';
|
|
26
26
|
import { UserProfile } from './src/components/UserProfile';
|
|
27
27
|
import { MessageListing } from './src/components/MessageListing';
|
|
28
|
+
import { Messages } from './src/components/Messages';
|
|
28
29
|
import { Help } from './src/components/Help';
|
|
29
30
|
import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
|
|
30
31
|
import { HelpGuide } from './src/components/HelpGuide';
|
|
@@ -93,6 +94,7 @@ export {
|
|
|
93
94
|
BusinessMenuList,
|
|
94
95
|
UserProfile,
|
|
95
96
|
MessageListing,
|
|
97
|
+
Messages,
|
|
96
98
|
Help,
|
|
97
99
|
HelpAccountAndPayment,
|
|
98
100
|
HelpGuide,
|
|
@@ -6,7 +6,7 @@ import { BusinessProductsListParams } from '../../types';
|
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
7
7
|
import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
|
|
8
8
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
9
|
-
import { View } from 'react-native';
|
|
9
|
+
import { View, ScrollView } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
12
|
|
|
@@ -220,7 +220,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
220
220
|
title={openDescription?.name}
|
|
221
221
|
onClose={() => setOpenDescription(null)}
|
|
222
222
|
>
|
|
223
|
-
<
|
|
223
|
+
<ScrollView style={{ padding: 20 }}>
|
|
224
224
|
{!!openDescription?.image && (
|
|
225
225
|
<OIcon
|
|
226
226
|
url={optimizeImage(openDescription?.image, 'h_100,c_limit')}
|
|
@@ -230,7 +230,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
230
230
|
/>
|
|
231
231
|
)}
|
|
232
232
|
<OText>{openDescription?.description}</OText>
|
|
233
|
-
</
|
|
233
|
+
</ScrollView>
|
|
234
234
|
</OModal>
|
|
235
235
|
</ProductsContainer>
|
|
236
236
|
);
|
|
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
63
63
|
return (
|
|
64
64
|
<DTContainer>
|
|
65
65
|
<DTWrapperTips>
|
|
66
|
-
{driverTipsOptions.map((option: any, i: number) => (
|
|
66
|
+
{driverTipsOptions.map((option: any, i: number) => (
|
|
67
67
|
<TouchableOpacity
|
|
68
68
|
key={i}
|
|
69
69
|
onPress={() => handlerChangeOption(option)}
|
|
@@ -98,27 +98,17 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
98
98
|
|
|
99
99
|
const handleImagePicker = () => {
|
|
100
100
|
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
|
-
if (response
|
|
102
|
-
|
|
103
|
-
} else if (response
|
|
104
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
101
|
+
if (response?.didCancel) {
|
|
102
|
+
showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
|
|
103
|
+
} else if (response?.errorMessage) {
|
|
105
104
|
showToast(ToastType.Error, response.errorMessage);
|
|
106
105
|
} else {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} else {
|
|
112
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
113
|
-
}
|
|
106
|
+
if (response?.assets?.length > 0) {
|
|
107
|
+
const image = response?.assets[0]
|
|
108
|
+
const url = `data:${image.type};base64,${image.base64}`
|
|
109
|
+
setImage && setImage(url);
|
|
114
110
|
} else {
|
|
115
|
-
|
|
116
|
-
const image = response?.assets[0]
|
|
117
|
-
const url = `data:${image.type};base64,${image.base64}`
|
|
118
|
-
setImage && setImage(url);
|
|
119
|
-
} else {
|
|
120
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
121
|
-
}
|
|
111
|
+
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
});
|
|
@@ -237,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
237
227
|
{image && (
|
|
238
228
|
<TouchableOpacity
|
|
239
229
|
style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
|
|
240
|
-
onPress={
|
|
230
|
+
onPress={removeImage}
|
|
241
231
|
>
|
|
242
232
|
<MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
|
|
243
233
|
</TouchableOpacity>
|
|
@@ -545,9 +535,15 @@ const styles = StyleSheet.create({
|
|
|
545
535
|
})
|
|
546
536
|
|
|
547
537
|
export const Messages = (props: MessagesParams) => {
|
|
538
|
+
const [allMessages, setAllMessages] = useState(props.messages)
|
|
548
539
|
const MessagesProps = {
|
|
549
540
|
...props,
|
|
550
|
-
UIComponent: MessagesUI
|
|
541
|
+
UIComponent: MessagesUI,
|
|
542
|
+
messages: allMessages,
|
|
543
|
+
setMessages: (values: any) => {
|
|
544
|
+
props.setMessages && props.setMessages(values)
|
|
545
|
+
setAllMessages(values)
|
|
546
|
+
}
|
|
551
547
|
}
|
|
552
548
|
return <MessagesController {...MessagesProps} />
|
|
553
549
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, BackHandler,
|
|
3
|
-
import Spinner from 'react-native-loading-spinner-overlay';
|
|
2
|
+
import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
|
|
4
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
5
|
-
import { Messages } from '../Messages';
|
|
6
4
|
import {
|
|
7
5
|
useLanguage,
|
|
8
6
|
OrderDetails as OrderDetailsConTableoller,
|
|
9
7
|
useUtils,
|
|
10
8
|
useConfig,
|
|
11
|
-
useSession,
|
|
12
9
|
} from 'ordering-components/native';
|
|
13
10
|
import { useTheme } from 'styled-components/native';
|
|
14
11
|
import {
|
|
@@ -16,14 +13,10 @@ import {
|
|
|
16
13
|
Header,
|
|
17
14
|
OrderContent,
|
|
18
15
|
OrderBusiness,
|
|
19
|
-
Logo,
|
|
20
16
|
OrderData,
|
|
21
17
|
OrderInfo,
|
|
22
|
-
OrderStatus,
|
|
23
18
|
StaturBar,
|
|
24
|
-
StatusImage,
|
|
25
19
|
OrderCustomer,
|
|
26
|
-
CustomerPhoto,
|
|
27
20
|
InfoBlock,
|
|
28
21
|
HeaderInfo,
|
|
29
22
|
Customer,
|
|
@@ -31,7 +24,6 @@ import {
|
|
|
31
24
|
Table,
|
|
32
25
|
OrderBill,
|
|
33
26
|
Total,
|
|
34
|
-
NavBack,
|
|
35
27
|
Icons,
|
|
36
28
|
OrderDriver,
|
|
37
29
|
Map,
|
|
@@ -41,7 +33,6 @@ import { OButton, OIcon, OModal, OText } from '../shared';
|
|
|
41
33
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
42
34
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
43
35
|
import { OrderDetailsParams } from '../../types';
|
|
44
|
-
import { USER_TYPE } from '../../config/constants';
|
|
45
36
|
import { GoogleMap } from '../GoogleMap';
|
|
46
37
|
import { verifyDecimals } from '../../utils';
|
|
47
38
|
import { OSRow } from '../OrderSummary/styles';
|
|
@@ -55,7 +46,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
55
46
|
messages,
|
|
56
47
|
setMessages,
|
|
57
48
|
readMessages,
|
|
58
|
-
messagesReadList,
|
|
59
49
|
isFromCheckout,
|
|
60
50
|
driverLocation,
|
|
61
51
|
} = props;
|
|
@@ -92,19 +82,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
92
82
|
|
|
93
83
|
const [, t] = useLanguage();
|
|
94
84
|
const [{ parsePrice, parseNumber, parseDate }] = useUtils();
|
|
95
|
-
const [{ user }] = useSession();
|
|
96
85
|
const [{ configs }] = useConfig();
|
|
97
86
|
|
|
98
|
-
const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
|
|
99
|
-
const [openModalForDriver, setOpenModalForDriver] = useState(false);
|
|
100
87
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
101
|
-
const [unreadAlert, setUnreadAlert] = useState({
|
|
102
|
-
business: false,
|
|
103
|
-
driver: false,
|
|
104
|
-
});
|
|
105
88
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
106
89
|
|
|
107
|
-
const { order
|
|
90
|
+
const { order } = props.order;
|
|
108
91
|
|
|
109
92
|
const walletName: any = {
|
|
110
93
|
cash: {
|
|
@@ -314,38 +297,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
314
297
|
return objectStatus && objectStatus;
|
|
315
298
|
};
|
|
316
299
|
|
|
317
|
-
const
|
|
318
|
-
setOpenModalForBusiness(true);
|
|
319
|
-
readMessages && readMessages();
|
|
320
|
-
setUnreadAlert({ ...unreadAlert, business: false });
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
const handleOpenMessagesForDriver = () => {
|
|
324
|
-
setOpenModalForDriver(true);
|
|
300
|
+
const handleGoToMessages = (type: string) => {
|
|
325
301
|
readMessages && readMessages();
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
setUnreadAlert({ business, driver });
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
const handleCloseModal = () => {
|
|
346
|
-
setOpenModalForBusiness(false);
|
|
347
|
-
setOpenModalForDriver(false);
|
|
348
|
-
};
|
|
302
|
+
navigation.navigate(
|
|
303
|
+
'MessageDetails',
|
|
304
|
+
{
|
|
305
|
+
type,
|
|
306
|
+
order,
|
|
307
|
+
messages,
|
|
308
|
+
setMessages,
|
|
309
|
+
orderId: order?.id,
|
|
310
|
+
business: type === 'business',
|
|
311
|
+
driver: type === 'driver',
|
|
312
|
+
onClose: () => navigation?.canGoBack()
|
|
313
|
+
? navigation.goBack()
|
|
314
|
+
: navigation.navigate('BottomTab', { screen: 'MyOrders' }),
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
}
|
|
349
318
|
|
|
350
319
|
const handleArrowBack: any = () => {
|
|
351
320
|
if (!isFromCheckout) {
|
|
@@ -394,14 +363,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
394
363
|
};
|
|
395
364
|
}, []);
|
|
396
365
|
|
|
397
|
-
useEffect(() => {
|
|
398
|
-
if (messagesReadList?.length) {
|
|
399
|
-
openModalForBusiness
|
|
400
|
-
? setUnreadAlert({ ...unreadAlert, business: false })
|
|
401
|
-
: setUnreadAlert({ ...unreadAlert, driver: false });
|
|
402
|
-
}
|
|
403
|
-
}, [messagesReadList]);
|
|
404
|
-
|
|
405
366
|
const locations = [
|
|
406
367
|
{
|
|
407
368
|
...order?.driver?.location,
|
|
@@ -606,7 +567,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
606
567
|
)}
|
|
607
568
|
<TouchableOpacity
|
|
608
569
|
style={{ paddingStart: 5 }}
|
|
609
|
-
onPress={() =>
|
|
570
|
+
onPress={() => handleGoToMessages('business')}>
|
|
610
571
|
<OIcon
|
|
611
572
|
src={theme.images.general.chat}
|
|
612
573
|
width={16}
|
|
@@ -735,7 +696,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
735
696
|
</OText>
|
|
736
697
|
<Icons>
|
|
737
698
|
<TouchableOpacity
|
|
738
|
-
onPress={() =>
|
|
699
|
+
onPress={() => handleGoToMessages('driver')}>
|
|
739
700
|
<OIcon
|
|
740
701
|
src={theme.images.general.chat}
|
|
741
702
|
width={16}
|
|
@@ -1018,22 +979,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1018
979
|
</OrderContent>
|
|
1019
980
|
</>
|
|
1020
981
|
)}
|
|
1021
|
-
<OModal
|
|
1022
|
-
open={openModalForBusiness || openModalForDriver}
|
|
1023
|
-
entireModal
|
|
1024
|
-
customClose
|
|
1025
|
-
onClose={() => handleCloseModal()}>
|
|
1026
|
-
<Messages
|
|
1027
|
-
type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
|
|
1028
|
-
orderId={order?.id}
|
|
1029
|
-
messages={messages}
|
|
1030
|
-
order={order}
|
|
1031
|
-
business={openModalForBusiness}
|
|
1032
|
-
driver={openModalForDriver}
|
|
1033
|
-
setMessages={setMessages}
|
|
1034
|
-
onClose={handleCloseModal}
|
|
1035
|
-
/>
|
|
1036
|
-
</OModal>
|
|
1037
982
|
<OModal
|
|
1038
983
|
open={openTaxModal.open}
|
|
1039
984
|
onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
|
|
@@ -16,6 +16,7 @@ import { LogoutButton } from '../LogoutButton'
|
|
|
16
16
|
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
|
+
import FastImage from 'react-native-fast-image'
|
|
19
20
|
|
|
20
21
|
import {
|
|
21
22
|
OIcon,
|
|
@@ -142,12 +143,13 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
142
143
|
<CenterView style={styles.pagePadding}>
|
|
143
144
|
<View style={styles.photo}>
|
|
144
145
|
{user?.photo ? (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
<FastImage
|
|
147
|
+
style={{ height: 60, width: 60, borderRadius: 8 }}
|
|
148
|
+
source={{
|
|
149
|
+
uri: user?.photo,
|
|
150
|
+
priority: FastImage.priority.normal,
|
|
151
|
+
}}
|
|
152
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
151
153
|
/>
|
|
152
154
|
) : (
|
|
153
155
|
<Ionicons name='person-outline' size={50} style={{ marginRight: 10 }} />
|
|
@@ -21,6 +21,7 @@ import NavBar from '../NavBar';
|
|
|
21
21
|
import { Container } from '../../layouts/Container';
|
|
22
22
|
import { VerifyPhone } from '../VerifyPhone'
|
|
23
23
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
24
|
+
import FastImage from 'react-native-fast-image'
|
|
24
25
|
|
|
25
26
|
const ProfileUI = (props: ProfileParams) => {
|
|
26
27
|
const {
|
|
@@ -288,12 +289,13 @@ const ProfileUI = (props: ProfileParams) => {
|
|
|
288
289
|
<CenterView style={styles.pagePadding}>
|
|
289
290
|
<View style={styles.photo}>
|
|
290
291
|
{user?.photo ? (
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
<FastImage
|
|
293
|
+
style={{ height: 60, width: 80, borderRadius: 8 }}
|
|
294
|
+
source={{
|
|
295
|
+
uri: user?.photo,
|
|
296
|
+
priority: FastImage.priority.normal,
|
|
297
|
+
}}
|
|
298
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
297
299
|
/>
|
|
298
300
|
) : (
|
|
299
301
|
<Ionicons name='person-outline' size={50} />
|
|
@@ -383,7 +383,7 @@ export interface MessagesParams {
|
|
|
383
383
|
handleSend?: () => {},
|
|
384
384
|
setImage?: (image: string | null) => {},
|
|
385
385
|
setMessage?: (comment: string) => {},
|
|
386
|
-
setMessages?: () => {},
|
|
386
|
+
setMessages?: (image: any | null) => {},
|
|
387
387
|
readMessages?: () => {},
|
|
388
388
|
onClose?: () => void,
|
|
389
389
|
isMeesageListing?: boolean,
|