ordering-ui-react-native 0.16.56-release → 0.16.57-release
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/business/src/components/OrderDetails/OrderContentComponent.tsx +30 -13
- package/themes/business/src/components/shared/OLink.tsx +11 -3
- package/themes/business/src/components/shared/OText.tsx +6 -1
- package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useState, useCallback } from 'react'
|
|
2
2
|
|
|
3
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Platform, StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { OButton, OText, OLink, OModal } from '../shared'
|
|
6
6
|
import {
|
|
@@ -44,6 +44,9 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
44
44
|
const [{ configs }] = useConfig();
|
|
45
45
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
46
46
|
|
|
47
|
+
const [isReadMore, setIsReadMore] = useState(false)
|
|
48
|
+
const [lengthMore, setLengthMore] = useState(false)
|
|
49
|
+
|
|
47
50
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
48
51
|
|
|
49
52
|
const walletName: any = {
|
|
@@ -95,6 +98,10 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
95
98
|
return /^\d+$/.test(str);
|
|
96
99
|
}
|
|
97
100
|
|
|
101
|
+
const onTextLayout = useCallback((e: any) => {
|
|
102
|
+
setLengthMore(e.nativeEvent.lines.length >= 3); //to check the text is more than 2 lines or not
|
|
103
|
+
},[]);
|
|
104
|
+
|
|
98
105
|
return (
|
|
99
106
|
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
100
107
|
{isOrderGroup && (
|
|
@@ -180,6 +187,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
180
187
|
ios: `maps:0,0?q=${order?.business?.address}`,
|
|
181
188
|
android: `geo:0,0?q=${order?.business?.address}`,
|
|
182
189
|
})}
|
|
190
|
+
numberOfLines={2}
|
|
183
191
|
shorcut={order?.business?.address}
|
|
184
192
|
TextStyle={styles.textLink}
|
|
185
193
|
/>
|
|
@@ -297,17 +305,26 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
297
305
|
)}
|
|
298
306
|
|
|
299
307
|
{!!order?.customer?.address && (
|
|
300
|
-
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
308
|
+
<>
|
|
309
|
+
<View style={styles.linkWithIcons}>
|
|
310
|
+
<OLink
|
|
311
|
+
PressStyle={{ ...styles.linkWithIcons, marginBottom: 0 }}
|
|
312
|
+
url={Platform.select({
|
|
313
|
+
ios: `maps:0,0?q=${order?.customer?.address}`,
|
|
314
|
+
android: `geo:0,0?q=${order?.customer?.address}`,
|
|
315
|
+
})}
|
|
316
|
+
onTextLayout={onTextLayout}
|
|
317
|
+
numberOfLines={isReadMore ? 20 : 2}
|
|
318
|
+
shorcut={order?.customer?.address}
|
|
319
|
+
TextStyle={styles.textLink}
|
|
320
|
+
/>
|
|
321
|
+
</View>
|
|
322
|
+
{lengthMore && (
|
|
323
|
+
<TouchableOpacity onPress={() => setIsReadMore(!isReadMore)}>
|
|
324
|
+
<OText size={12} color={theme.colors.statusOrderBlue}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
|
|
325
|
+
</TouchableOpacity>
|
|
326
|
+
)}
|
|
327
|
+
</>
|
|
311
328
|
)}
|
|
312
329
|
|
|
313
330
|
{!!order?.customer?.internal_number && (
|
|
@@ -12,10 +12,12 @@ interface Props {
|
|
|
12
12
|
TextStyle?: TextStyle;
|
|
13
13
|
type?: string;
|
|
14
14
|
hasButton?: boolean;
|
|
15
|
+
numberOfLines?: number;
|
|
16
|
+
onTextLayout?: (e : any) => void;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const OLink = (props: Props): React.ReactElement => {
|
|
18
|
-
const { url, shorcut, color, PressStyle, TextStyle, type, hasButton } = props;
|
|
20
|
+
const { url, shorcut, color, PressStyle, TextStyle, type, hasButton, numberOfLines, onTextLayout } = props;
|
|
19
21
|
const [, t] = useLanguage();
|
|
20
22
|
|
|
21
23
|
const handleAlert = () =>
|
|
@@ -75,9 +77,11 @@ const OLink = (props: Props): React.ReactElement => {
|
|
|
75
77
|
) : (
|
|
76
78
|
<OText
|
|
77
79
|
style={TextStyle}
|
|
78
|
-
numberOfLines={1}
|
|
80
|
+
numberOfLines={numberOfLines ?? 1}
|
|
79
81
|
ellipsizeMode="tail"
|
|
80
|
-
color={color}
|
|
82
|
+
color={color}
|
|
83
|
+
onTextLayout={onTextLayout}
|
|
84
|
+
>
|
|
81
85
|
{shorcut}
|
|
82
86
|
</OText>
|
|
83
87
|
)}
|
|
@@ -85,4 +89,8 @@ const OLink = (props: Props): React.ReactElement => {
|
|
|
85
89
|
);
|
|
86
90
|
};
|
|
87
91
|
|
|
92
|
+
OLink.defaultProps = {
|
|
93
|
+
onTextLayout: (e: any) => {}
|
|
94
|
+
};
|
|
95
|
+
|
|
88
96
|
export default OLink;
|
|
@@ -42,15 +42,20 @@ interface Props {
|
|
|
42
42
|
adjustsFontSizeToFit?: boolean;
|
|
43
43
|
textDecorationLine?: string;
|
|
44
44
|
lineHeight?: number;
|
|
45
|
+
onTextLayout?: (e : any) => void;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const OText = (props: Props): React.ReactElement => {
|
|
48
49
|
return (
|
|
49
|
-
<SText {...props} style={[props.style, { lineHeight: props.lineHeight }]}>
|
|
50
|
+
<SText {...props} style={[props.style, { lineHeight: props.lineHeight }]} onTextLayout={props.onTextLayout}>
|
|
50
51
|
{props.children}
|
|
51
52
|
{props.space && ' '}
|
|
52
53
|
</SText>
|
|
53
54
|
);
|
|
54
55
|
};
|
|
55
56
|
|
|
57
|
+
OText.defaultProps = {
|
|
58
|
+
onTextLayout: (e: any) => {}
|
|
59
|
+
};
|
|
60
|
+
|
|
56
61
|
export default OText;
|
|
@@ -84,9 +84,13 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
84
84
|
marginRight: 2,
|
|
85
85
|
},
|
|
86
86
|
reorderLoading: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
height: 23,
|
|
88
|
+
paddingLeft: 20,
|
|
89
|
+
paddingRight: 20,
|
|
90
|
+
borderRadius: 23,
|
|
91
|
+
shadowOpacity: 0,
|
|
92
|
+
backgroundColor: theme.colors.primary,
|
|
93
|
+
borderWidth: 0,
|
|
90
94
|
},
|
|
91
95
|
reorderbutton: {
|
|
92
96
|
height: 23,
|
|
@@ -183,8 +187,6 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
183
187
|
|
|
184
188
|
const handleOriginalReorder = () => {
|
|
185
189
|
setConfirm({ ...confirm, open: false, title: null })
|
|
186
|
-
setReorderSelected(order?.id);
|
|
187
|
-
handleReorder && handleReorder(order?.id);
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
return (
|