ordering-ui-react-native 0.10.3 → 0.11.3
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 +2 -1
- package/themes/business/index.tsx +12 -12
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +49 -43
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +4 -10
- package/themes/business/src/components/Chat/index.tsx +97 -60
- package/themes/business/src/components/DriverMap/index.tsx +196 -183
- package/themes/business/src/components/FloatingButton/index.tsx +61 -43
- package/themes/business/src/components/FloatingButton/styles.tsx +2 -5
- package/themes/business/src/components/GoogleMap/index.tsx +10 -8
- package/themes/business/src/components/Home/index.tsx +2 -5
- package/themes/business/src/components/Home/styles.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -3
- package/themes/business/src/components/MessagesOption/index.tsx +13 -18
- package/themes/business/src/components/MessagesOption/styles.tsx +3 -0
- package/themes/business/src/components/OrderDetails/Business.tsx +642 -0
- package/themes/business/src/components/OrderDetails/Delivery.tsx +436 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +378 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components/OrderDetails/styles.tsx +16 -74
- package/themes/business/src/components/OrderMessage/index.tsx +5 -2
- package/themes/business/src/components/OrdersOption/index.tsx +344 -302
- package/themes/business/src/components/OrdersOption/styles.tsx +4 -2
- package/themes/business/src/components/PreviousMessages/index.tsx +15 -8
- package/themes/business/src/components/PreviousOrders/index.tsx +86 -141
- package/themes/business/src/components/PreviousOrders/styles.tsx +4 -3
- package/themes/business/src/components/UserProfileForm/index.tsx +73 -6
- package/themes/business/src/components/UserProfileForm/styles.tsx +0 -2
- package/themes/business/src/components/shared/OModal.tsx +9 -7
- package/themes/business/src/components/shared/OTextarea.tsx +2 -1
- package/themes/business/src/layouts/SafeAreaContainer.tsx +2 -2
- package/themes/business/src/types/index.tsx +24 -13
- package/themes/business/src/utils/index.tsx +160 -0
- package/themes/business/src/components/OrderDetails/index.tsx +0 -1262
- package/themes/business/src/components/OrderDetailsDelivery/index.tsx +0 -1056
- package/themes/business/src/components/OrderDetailsDelivery/styles.tsx +0 -142
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"react-native-safe-area-context": "^3.1.8",
|
|
93
93
|
"react-native-screens": "^2.11.0",
|
|
94
94
|
"react-native-snap-carousel": "^3.9.1",
|
|
95
|
+
"react-native-swipe-gestures": "^1.0.5",
|
|
95
96
|
"react-native-vector-icons": "^7.1.0",
|
|
96
97
|
"react-native-webview": "^11.6.4",
|
|
97
98
|
"rn-placeholder": "^3.0.3",
|
|
@@ -12,8 +12,8 @@ import { LogoutButton } from './src/components/LogoutButton';
|
|
|
12
12
|
import { MessagesOption } from './src/components/MessagesOption';
|
|
13
13
|
import { NotFoundSource } from './src/components/NotFoundSource';
|
|
14
14
|
import { OrderMessage } from './src/components/OrderMessage';
|
|
15
|
-
import {
|
|
16
|
-
import { OrderDetailsDelivery } from './src/components/
|
|
15
|
+
import { OrderDetailsBusiness } from './src/components/OrderDetails/Business';
|
|
16
|
+
import { OrderDetailsDelivery } from './src/components/OrderDetails/Delivery';
|
|
17
17
|
import { OrdersOption } from './src/components/OrdersOption';
|
|
18
18
|
import { OrderSummary } from './src/components/OrderSummary';
|
|
19
19
|
import { PhoneInputNumber } from './src/components/PhoneInputNumber';
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
OTextarea,
|
|
39
39
|
OAlert,
|
|
40
40
|
OModal,
|
|
41
|
-
OLink
|
|
41
|
+
OLink,
|
|
42
42
|
} from './src/components/shared';
|
|
43
43
|
|
|
44
44
|
//layouts
|
|
@@ -51,26 +51,26 @@ export {
|
|
|
51
51
|
AcceptOrRejectOrder,
|
|
52
52
|
BusinessController,
|
|
53
53
|
Chat,
|
|
54
|
+
DriverMap,
|
|
54
55
|
FloatingButton,
|
|
55
56
|
ForgotPasswordForm,
|
|
56
57
|
GoogleMap,
|
|
57
|
-
DriverMap,
|
|
58
58
|
Home,
|
|
59
59
|
LanguageSelector,
|
|
60
60
|
LoginForm,
|
|
61
61
|
LogoutButton,
|
|
62
62
|
MessagesOption,
|
|
63
|
+
NotFoundSource,
|
|
64
|
+
OrderDetailsBusiness,
|
|
63
65
|
OrderDetailsDelivery,
|
|
64
66
|
OrderMessage,
|
|
65
|
-
NotFoundSource,
|
|
66
|
-
OrderDetails,
|
|
67
67
|
OrdersOption,
|
|
68
68
|
OrderSummary,
|
|
69
69
|
PhoneInputNumber,
|
|
70
|
-
SafeAreaContainerLayout,
|
|
71
70
|
PreviousMessages,
|
|
72
71
|
PreviousOrders,
|
|
73
72
|
ProductItemAccordion,
|
|
73
|
+
SafeAreaContainerLayout,
|
|
74
74
|
SearchBar,
|
|
75
75
|
SignupForm,
|
|
76
76
|
StoresList,
|
|
@@ -78,15 +78,15 @@ export {
|
|
|
78
78
|
UserProfileForm,
|
|
79
79
|
VerifyPhone,
|
|
80
80
|
//OComponents
|
|
81
|
-
|
|
81
|
+
OAlert,
|
|
82
82
|
OButton,
|
|
83
|
-
OInput,
|
|
84
83
|
OIcon,
|
|
85
84
|
OIconButton,
|
|
86
|
-
|
|
87
|
-
OAlert,
|
|
88
|
-
OModal,
|
|
85
|
+
OInput,
|
|
89
86
|
OLink,
|
|
87
|
+
OModal,
|
|
88
|
+
OText,
|
|
89
|
+
OTextarea,
|
|
90
90
|
//layouts
|
|
91
91
|
Container,
|
|
92
92
|
SafeAreaContainer,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Platform,
|
|
6
6
|
View,
|
|
7
7
|
KeyboardAvoidingView,
|
|
8
|
+
TextInput
|
|
8
9
|
} from 'react-native';
|
|
9
10
|
import { useTheme } from 'styled-components/native';
|
|
10
11
|
import { useLanguage } from 'ordering-components/native';
|
|
@@ -33,7 +34,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
33
34
|
const theme = useTheme();
|
|
34
35
|
const scrollViewRef = useRef<any>(null);
|
|
35
36
|
const viewRef = useRef<any>(null);
|
|
36
|
-
const timerRef = useRef
|
|
37
|
+
const timerRef = useRef() as React.MutableRefObject<TextInput>;
|
|
37
38
|
const textTareaRef = useRef<any>();
|
|
38
39
|
const [hour, setHour] = useState('00');
|
|
39
40
|
const [min, setMin] = useState('00');
|
|
@@ -42,7 +43,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
42
43
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
43
44
|
const phoneNumber = customerCellphone;
|
|
44
45
|
let codeNumberPhone, numberPhone, numberToShow;
|
|
45
|
-
const { top } = useSafeAreaInsets()
|
|
46
|
+
const { top, bottom} = useSafeAreaInsets()
|
|
46
47
|
|
|
47
48
|
const handleFocus = () => {
|
|
48
49
|
viewRef?.current?.measure((x: any, y: any) => {
|
|
@@ -105,6 +106,16 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
105
106
|
setTime(`${hours}${mins}`);
|
|
106
107
|
};
|
|
107
108
|
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (actions && action === 'accept') {
|
|
111
|
+
openTimerIOnput();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (actions && action === 'reject') {
|
|
115
|
+
openTextTareaOInput();
|
|
116
|
+
}
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
108
119
|
const handleFixTime = () => {
|
|
109
120
|
if (min >= '60') {
|
|
110
121
|
setMin('59');
|
|
@@ -118,11 +129,11 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
118
129
|
|
|
119
130
|
const openTimerIOnput = () => {
|
|
120
131
|
const isFocus = timerRef.current.isFocused();
|
|
121
|
-
if (isFocus
|
|
132
|
+
if (isFocus) {
|
|
122
133
|
timerRef.current.blur();
|
|
123
134
|
}
|
|
124
135
|
|
|
125
|
-
if (!isFocus
|
|
136
|
+
if (!isFocus) {
|
|
126
137
|
if (time.length > 1) timerRef.current.clear();
|
|
127
138
|
timerRef.current.focus();
|
|
128
139
|
handleFocusTimer();
|
|
@@ -137,20 +148,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
137
148
|
|
|
138
149
|
if (!isFocus && textTareaRef?.current) {
|
|
139
150
|
textTareaRef.current.focus();
|
|
140
|
-
handleFocusTimer();
|
|
141
151
|
}
|
|
142
152
|
};
|
|
143
153
|
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (actions && action === 'accept') {
|
|
146
|
-
openTimerIOnput();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (actions && action === 'reject') {
|
|
150
|
-
openTextTareaOInput();
|
|
151
|
-
}
|
|
152
|
-
}, []);
|
|
153
|
-
|
|
154
154
|
const handleAcceptOrReject = () => {
|
|
155
155
|
handleFixTime();
|
|
156
156
|
|
|
@@ -193,31 +193,38 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
return (
|
|
196
|
-
<>
|
|
197
196
|
<KeyboardAvoidingView
|
|
197
|
+
enabled
|
|
198
198
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
199
|
-
style={{ flex: 1, marginTop: top }}>
|
|
200
|
-
|
|
199
|
+
style={{ flex: 1, paddingHorizontal: 30, paddingTop: 30, marginTop: top, marginBottom: bottom,justifyContent: 'space-between' }}>
|
|
200
|
+
<View>
|
|
201
|
+
<OIconButton
|
|
202
|
+
icon={theme.images.general.arrow_left}
|
|
203
|
+
borderColor={theme.colors.clear}
|
|
204
|
+
iconStyle={{ width: 20, height: 20 }}
|
|
205
|
+
style={{
|
|
206
|
+
maxWidth: 40,
|
|
207
|
+
height: 35,
|
|
208
|
+
justifyContent: 'flex-end',
|
|
209
|
+
marginBottom: 30,
|
|
210
|
+
}}
|
|
211
|
+
onClick={() => handleArrowBack()}
|
|
212
|
+
/>
|
|
213
|
+
<OText
|
|
214
|
+
size={20}
|
|
215
|
+
color={theme.colors.textGray}
|
|
216
|
+
style={{
|
|
217
|
+
fontFamily: 'Poppins',
|
|
218
|
+
fontStyle: 'normal',
|
|
219
|
+
}}
|
|
220
|
+
weight="600">
|
|
221
|
+
{action === 'accept'
|
|
222
|
+
? `${t(titleAccept?.key, titleAccept?.text)}:`
|
|
223
|
+
: t(titleReject?.key, titleReject?.text)}
|
|
224
|
+
</OText>
|
|
225
|
+
</View>
|
|
226
|
+
<Content showsVerticalScrollIndicator={false} ref={scrollViewRef}>
|
|
201
227
|
<Header>
|
|
202
|
-
<OIconButton
|
|
203
|
-
icon={theme.images.general.arrow_left}
|
|
204
|
-
borderColor={theme.colors.clear}
|
|
205
|
-
iconStyle={{ width: 20, height: 20 }}
|
|
206
|
-
style={{
|
|
207
|
-
maxWidth: 40,
|
|
208
|
-
height: 35,
|
|
209
|
-
justifyContent: 'flex-end',
|
|
210
|
-
marginBottom: 30,
|
|
211
|
-
}}
|
|
212
|
-
onClick={() => handleArrowBack()}
|
|
213
|
-
/>
|
|
214
|
-
|
|
215
|
-
<OText size={20} color={theme.colors.textGray} weight="600">
|
|
216
|
-
{action === 'accept'
|
|
217
|
-
? `${t(titleAccept?.key, titleAccept?.text)}:`
|
|
218
|
-
: t(titleReject?.key, titleReject?.text)}
|
|
219
|
-
</OText>
|
|
220
|
-
|
|
221
228
|
{action === 'reject' && (
|
|
222
229
|
<>
|
|
223
230
|
{!notShowCustomerPhone && (
|
|
@@ -323,7 +330,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
323
330
|
</Timer>
|
|
324
331
|
</View>
|
|
325
332
|
)}
|
|
326
|
-
|
|
333
|
+
|
|
327
334
|
<TimeField
|
|
328
335
|
ref={timerRef}
|
|
329
336
|
keyboardType="numeric"
|
|
@@ -332,6 +339,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
332
339
|
onChangeText={handleTime}
|
|
333
340
|
onPressOut={() => handleFixTime()}
|
|
334
341
|
editable={true}
|
|
342
|
+
autoFocus={actions && action === 'accept'}
|
|
335
343
|
selectionColor={theme.colors.primary}
|
|
336
344
|
placeholderTextColor={theme.colors.textGray}
|
|
337
345
|
color={theme.colors.textGray}
|
|
@@ -342,6 +350,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
342
350
|
<Comments ref={viewRef}>
|
|
343
351
|
<OTextarea
|
|
344
352
|
textTareaRef={textTareaRef}
|
|
353
|
+
autoFocus={actions && action === 'reject'}
|
|
345
354
|
onFocus={handleFocus}
|
|
346
355
|
placeholder={t(
|
|
347
356
|
'PLEASE_TYPE_YOUR_COMMENTS_IN_HERE',
|
|
@@ -355,10 +364,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
355
364
|
)}
|
|
356
365
|
</Content>
|
|
357
366
|
|
|
358
|
-
<Action
|
|
359
|
-
style={{
|
|
360
|
-
marginBottom: isKeyboardShow ? (Platform.OS === 'ios' ? 0 : 10) : 0,
|
|
361
|
-
}}>
|
|
367
|
+
<Action>
|
|
362
368
|
<FloatingButton
|
|
363
369
|
firstButtonClick={() => {
|
|
364
370
|
handleAcceptOrReject();
|
|
@@ -369,9 +375,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
369
375
|
: t('REJECT', 'Reject')
|
|
370
376
|
}
|
|
371
377
|
color={action === 'accept' ? theme.colors.green : theme.colors.red}
|
|
378
|
+
widthButton={'100%'}
|
|
372
379
|
/>
|
|
373
380
|
</Action>
|
|
374
381
|
</KeyboardAvoidingView>
|
|
375
|
-
</>
|
|
376
382
|
);
|
|
377
383
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const Content = styled.ScrollView`
|
|
4
|
-
margin-bottom: 60px;
|
|
5
4
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
6
|
-
|
|
5
|
+
margin-bottom: 30px;
|
|
7
6
|
`;
|
|
8
7
|
|
|
9
8
|
export const Timer = styled.TouchableOpacity`
|
|
@@ -28,15 +27,10 @@ export const TimeField = styled.TextInput`
|
|
|
28
27
|
opacity: 0;
|
|
29
28
|
`;
|
|
30
29
|
|
|
31
|
-
export const Header = styled.View
|
|
32
|
-
padding-horizontal: 20px;
|
|
33
|
-
`;
|
|
30
|
+
export const Header = styled.View``;
|
|
34
31
|
|
|
35
|
-
export const Action = styled.View
|
|
36
|
-
margin-horizontal: 30px;
|
|
37
|
-
`;
|
|
32
|
+
export const Action = styled.View``;
|
|
38
33
|
|
|
39
34
|
export const Comments = styled.View`
|
|
40
|
-
|
|
41
|
-
margin-bottom: 40px;
|
|
35
|
+
margin-top: 20px;
|
|
42
36
|
`;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Keyboard,
|
|
9
9
|
Dimensions,
|
|
10
10
|
Pressable,
|
|
11
|
+
SafeAreaView,
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import {
|
|
13
14
|
GiftedChat,
|
|
@@ -59,7 +60,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
59
60
|
} = props;
|
|
60
61
|
|
|
61
62
|
const [{ user }] = useSession();
|
|
62
|
-
const [{ parseDate, optimizeImage, getTimeAgo }] = useUtils();
|
|
63
|
+
const [{ parseDate, parseTime, optimizeImage, getTimeAgo }] = useUtils();
|
|
63
64
|
const [, t] = useLanguage();
|
|
64
65
|
const [, { showToast }] = useToast();
|
|
65
66
|
const theme = useTheme();
|
|
@@ -75,6 +76,21 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
75
76
|
parseFloat(String(Dimensions.get('window').height)).toFixed(0),
|
|
76
77
|
);
|
|
77
78
|
|
|
79
|
+
const [orientation, setOrientation] = useState<string>(
|
|
80
|
+
Dimensions.get('window').width < Dimensions.get('window').height
|
|
81
|
+
? 'Portrait'
|
|
82
|
+
: 'Landscape',
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// Events
|
|
86
|
+
Dimensions.addEventListener('change', ({ window: { width, height } }) => {
|
|
87
|
+
if (width < height) {
|
|
88
|
+
setOrientation('Portrait');
|
|
89
|
+
} else {
|
|
90
|
+
setOrientation('Landscape');
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
78
94
|
const styles = StyleSheet.create({
|
|
79
95
|
containerActions: {
|
|
80
96
|
width: 44,
|
|
@@ -102,8 +118,8 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
102
118
|
},
|
|
103
119
|
toolbarStyle: {
|
|
104
120
|
flexDirection: 'column-reverse',
|
|
105
|
-
paddingHorizontal: 20,
|
|
106
121
|
paddingVertical: 15,
|
|
122
|
+
paddingHorizontal: 30,
|
|
107
123
|
backgroundColor: theme.colors.white,
|
|
108
124
|
borderTopWidth: 1,
|
|
109
125
|
borderTopColor: theme.colors.tabBar,
|
|
@@ -159,7 +175,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
159
175
|
justifyContent: 'center',
|
|
160
176
|
alignItems: 'center',
|
|
161
177
|
backgroundColor: theme.colors.inputChat,
|
|
162
|
-
|
|
178
|
+
paddingVertical: 10,
|
|
163
179
|
borderRadius: 7.6,
|
|
164
180
|
},
|
|
165
181
|
firstMessageText: {
|
|
@@ -341,8 +357,8 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
341
357
|
<View
|
|
342
358
|
style={{
|
|
343
359
|
...styles.firstMessage,
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
marginHorizontal: 0,
|
|
361
|
+
paddingHorizontal: 32,
|
|
346
362
|
width: 320,
|
|
347
363
|
}}>
|
|
348
364
|
<OText
|
|
@@ -375,6 +391,9 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
375
391
|
}`
|
|
376
392
|
: `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`}
|
|
377
393
|
</OText>
|
|
394
|
+
<OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
|
|
395
|
+
{parseTime(message?.created_at, { outputFormat: 'hh:mma' })}
|
|
396
|
+
</OText>
|
|
378
397
|
</View>
|
|
379
398
|
);
|
|
380
399
|
};
|
|
@@ -426,7 +445,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
426
445
|
<View style={styles.firstMessage}>
|
|
427
446
|
<OText style={styles.firstMessageText}>
|
|
428
447
|
{t('ORDER_PLACED_FOR', 'Order placed for')}{' '}
|
|
429
|
-
<OText style={{ ...styles.firstMessageText, fontWeight: '
|
|
448
|
+
<OText style={{ ...styles.firstMessageText, fontWeight: 'bold' }}>
|
|
430
449
|
{parseDate(order?.created_at)}
|
|
431
450
|
</OText>
|
|
432
451
|
</OText>
|
|
@@ -571,14 +590,18 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
571
590
|
showsVerticalScrollIndicator={false}
|
|
572
591
|
showsHorizontalScrollIndicator={false}
|
|
573
592
|
horizontal
|
|
574
|
-
contentContainerStyle={{
|
|
593
|
+
contentContainerStyle={{
|
|
594
|
+
justifyContent:
|
|
595
|
+
orientation === 'Landscape' ? 'center' : 'space-between',
|
|
596
|
+
width: '100%',
|
|
597
|
+
}}>
|
|
575
598
|
{user?.level !== 2 && (
|
|
576
599
|
<Pressable
|
|
577
600
|
style={{
|
|
578
601
|
flexDirection: 'row',
|
|
579
602
|
alignItems: 'center',
|
|
580
|
-
marginRight: 25,
|
|
581
603
|
opacity: canRead?.business ? 1 : 0.25,
|
|
604
|
+
marginRight: 25,
|
|
582
605
|
}}
|
|
583
606
|
onPress={() =>
|
|
584
607
|
handleFilter({ business: !canRead?.business }, 'business')
|
|
@@ -604,7 +627,10 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
604
627
|
{order?.business?.name}
|
|
605
628
|
</OText>
|
|
606
629
|
|
|
607
|
-
<OText
|
|
630
|
+
<OText
|
|
631
|
+
adjustsFontSizeToFit
|
|
632
|
+
color={theme.colors.unselectText}
|
|
633
|
+
size={14}>
|
|
608
634
|
{t('BUSINESS', 'Business')}
|
|
609
635
|
</OText>
|
|
610
636
|
</TitleHeader>
|
|
@@ -615,8 +641,8 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
615
641
|
style={{
|
|
616
642
|
flexDirection: 'row',
|
|
617
643
|
alignItems: 'center',
|
|
618
|
-
marginRight: 25,
|
|
619
644
|
opacity: canRead?.customer ? 1 : 0.25,
|
|
645
|
+
marginRight: 25,
|
|
620
646
|
}}
|
|
621
647
|
onPress={() =>
|
|
622
648
|
handleFilter({ customer: !canRead?.customer }, 'customer')
|
|
@@ -642,7 +668,10 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
642
668
|
{order?.customer?.name}
|
|
643
669
|
</OText>
|
|
644
670
|
|
|
645
|
-
<OText
|
|
671
|
+
<OText
|
|
672
|
+
adjustsFontSizeToFit
|
|
673
|
+
color={theme.colors.unselectText}
|
|
674
|
+
size={14}>
|
|
646
675
|
{t('CUSTOMER', 'Customer')}
|
|
647
676
|
</OText>
|
|
648
677
|
</TitleHeader>
|
|
@@ -653,8 +682,8 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
653
682
|
style={{
|
|
654
683
|
flexDirection: 'row',
|
|
655
684
|
alignItems: 'center',
|
|
656
|
-
marginRight: 25,
|
|
657
685
|
opacity: canRead?.driver ? 1 : 0.25,
|
|
686
|
+
marginRight: 25,
|
|
658
687
|
}}
|
|
659
688
|
onPress={() =>
|
|
660
689
|
handleFilter({ driver: !canRead?.driver }, 'driver')
|
|
@@ -680,7 +709,10 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
680
709
|
{order?.driver?.name}
|
|
681
710
|
</OText>
|
|
682
711
|
|
|
683
|
-
<OText
|
|
712
|
+
<OText
|
|
713
|
+
adjustsFontSizeToFit
|
|
714
|
+
color={theme.colors.unselectText}
|
|
715
|
+
size={14}>
|
|
684
716
|
{t('DRIVER', 'Driver')}
|
|
685
717
|
</OText>
|
|
686
718
|
</TitleHeader>
|
|
@@ -725,14 +757,9 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
725
757
|
{...props}
|
|
726
758
|
textInputStyle={{
|
|
727
759
|
borderRadius: 7.6,
|
|
728
|
-
paddingHorizontal: 10,
|
|
729
760
|
borderColor: theme.colors.transparent,
|
|
730
761
|
borderWidth: 0,
|
|
731
762
|
color: '#010300',
|
|
732
|
-
marginLeft: 1,
|
|
733
|
-
marginRight: 0,
|
|
734
|
-
marginBottom: 0,
|
|
735
|
-
paddingVertical: 0,
|
|
736
763
|
}}
|
|
737
764
|
textInputProps={{
|
|
738
765
|
value: message,
|
|
@@ -891,54 +918,63 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
891
918
|
);
|
|
892
919
|
};
|
|
893
920
|
|
|
894
|
-
const renderAvatar = (props: any) =>
|
|
895
|
-
|
|
896
|
-
<OText size={9} color={theme.colors.textGray}>
|
|
897
|
-
{`${t('SENT_TO', 'Sent to')}:`}
|
|
898
|
-
</OText>
|
|
921
|
+
const renderAvatar = (props: any) => {
|
|
922
|
+
const isMine = user?.id === props?.currentMessage?.user?._id;
|
|
899
923
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
style={styles.avatarIcon}
|
|
910
|
-
/>
|
|
911
|
-
</View>
|
|
912
|
-
)}
|
|
924
|
+
return (
|
|
925
|
+
<View
|
|
926
|
+
style={{
|
|
927
|
+
marginBottom: 10,
|
|
928
|
+
alignItems: isMine ? 'flex-end' : 'flex-start',
|
|
929
|
+
}}>
|
|
930
|
+
<OText size={9} color={theme.colors.textGray}>
|
|
931
|
+
{`${t('SENT_TO', 'Sent to')}:`}
|
|
932
|
+
</OText>
|
|
913
933
|
|
|
914
|
-
{
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
934
|
+
<View style={{ flexDirection: 'row' }}>
|
|
935
|
+
{props?.currentMessage?.user?.can_see?.includes('2') &&
|
|
936
|
+
user?.level !== 2 && (
|
|
937
|
+
<View style={styles.avatar}>
|
|
938
|
+
<OIcon
|
|
939
|
+
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
940
|
+
src={
|
|
941
|
+
!order?.business?.logo &&
|
|
942
|
+
theme?.images?.dummies?.businessLogo
|
|
943
|
+
}
|
|
944
|
+
style={styles.avatarIcon}
|
|
945
|
+
/>
|
|
946
|
+
</View>
|
|
947
|
+
)}
|
|
925
948
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
<View style={{ ...styles.avatar, marginRight: 0 }}>
|
|
949
|
+
{props?.currentMessage?.user?.can_see?.includes('3') && (
|
|
950
|
+
<View style={styles.avatar}>
|
|
929
951
|
<OIcon
|
|
930
|
-
url={
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
952
|
+
url={optimizeImage(
|
|
953
|
+
order?.customer?.photo ||
|
|
954
|
+
theme?.images?.dummies?.customerPhoto,
|
|
955
|
+
'h_300,c_limit',
|
|
956
|
+
)}
|
|
934
957
|
style={styles.avatarIcon}
|
|
935
958
|
/>
|
|
936
959
|
</View>
|
|
937
960
|
)}
|
|
938
|
-
</View>
|
|
939
|
-
</View>
|
|
940
|
-
);
|
|
941
961
|
|
|
962
|
+
{props?.currentMessage?.user?.can_see?.includes('4') &&
|
|
963
|
+
user?.level !== 4 && (
|
|
964
|
+
<View style={{ ...styles.avatar, marginRight: 0 }}>
|
|
965
|
+
<OIcon
|
|
966
|
+
url={
|
|
967
|
+
optimizeImage(order?.driver?.photo, 'h_300,c_limit') ||
|
|
968
|
+
theme?.images?.dummies?.driverPhoto
|
|
969
|
+
}
|
|
970
|
+
style={styles.avatarIcon}
|
|
971
|
+
/>
|
|
972
|
+
</View>
|
|
973
|
+
)}
|
|
974
|
+
</View>
|
|
975
|
+
</View>
|
|
976
|
+
);
|
|
977
|
+
};
|
|
942
978
|
const renderTime = (props: any) => (
|
|
943
979
|
<>
|
|
944
980
|
<OText style={styles.timeText}>
|
|
@@ -966,7 +1002,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
966
1002
|
};
|
|
967
1003
|
|
|
968
1004
|
return (
|
|
969
|
-
|
|
1005
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
970
1006
|
<Wrapper>
|
|
971
1007
|
<GiftedChat
|
|
972
1008
|
messages={formattedMessages}
|
|
@@ -982,7 +1018,8 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
982
1018
|
contentContainerStyle: {
|
|
983
1019
|
flexGrow: 1,
|
|
984
1020
|
justifyContent: 'flex-end',
|
|
985
|
-
paddingHorizontal:
|
|
1021
|
+
paddingHorizontal: 22,
|
|
1022
|
+
paddingBottom: 30,
|
|
986
1023
|
},
|
|
987
1024
|
}}
|
|
988
1025
|
renderCustomView={renderNameMessage}
|
|
@@ -1007,7 +1044,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
1007
1044
|
keyboardShouldPersistTaps="handled"
|
|
1008
1045
|
/>
|
|
1009
1046
|
</Wrapper>
|
|
1010
|
-
|
|
1047
|
+
</SafeAreaView>
|
|
1011
1048
|
);
|
|
1012
1049
|
};
|
|
1013
1050
|
|