ordering-ui-react-native 0.17.76 → 0.17.78
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 +29 -14
- package/themes/business/src/components/shared/OLink.tsx +9 -2
- package/themes/business/src/components/shared/OText.tsx +6 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
- package/themes/original/src/components/Notifications/styles.tsx +1 -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 && (
|
|
@@ -298,18 +305,26 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
298
305
|
)}
|
|
299
306
|
|
|
300
307
|
{!!order?.customer?.address && (
|
|
301
|
-
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
+
</>
|
|
313
328
|
)}
|
|
314
329
|
|
|
315
330
|
{!!order?.customer?.internal_number && (
|
|
@@ -13,10 +13,11 @@ interface Props {
|
|
|
13
13
|
type?: string;
|
|
14
14
|
hasButton?: boolean;
|
|
15
15
|
numberOfLines?: number;
|
|
16
|
+
onTextLayout?: (e : any) => void;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const OLink = (props: Props): React.ReactElement => {
|
|
19
|
-
const { url, shorcut, color, PressStyle, TextStyle, type, hasButton, numberOfLines } = props;
|
|
20
|
+
const { url, shorcut, color, PressStyle, TextStyle, type, hasButton, numberOfLines, onTextLayout } = props;
|
|
20
21
|
const [, t] = useLanguage();
|
|
21
22
|
|
|
22
23
|
const handleAlert = () =>
|
|
@@ -78,7 +79,9 @@ const OLink = (props: Props): React.ReactElement => {
|
|
|
78
79
|
style={TextStyle}
|
|
79
80
|
numberOfLines={numberOfLines ?? 1}
|
|
80
81
|
ellipsizeMode="tail"
|
|
81
|
-
color={color}
|
|
82
|
+
color={color}
|
|
83
|
+
onTextLayout={onTextLayout}
|
|
84
|
+
>
|
|
82
85
|
{shorcut}
|
|
83
86
|
</OText>
|
|
84
87
|
)}
|
|
@@ -86,4 +89,8 @@ const OLink = (props: Props): React.ReactElement => {
|
|
|
86
89
|
);
|
|
87
90
|
};
|
|
88
91
|
|
|
92
|
+
OLink.defaultProps = {
|
|
93
|
+
onTextLayout: (e: any) => {}
|
|
94
|
+
};
|
|
95
|
+
|
|
89
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;
|
|
@@ -557,7 +557,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
557
557
|
<PageBanner position='app_business_listing' />
|
|
558
558
|
|
|
559
559
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
560
|
-
<ListWrapper
|
|
560
|
+
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
561
561
|
{!businessId && (
|
|
562
562
|
<BusinessTypeFilter
|
|
563
563
|
images={props.images}
|
|
@@ -67,7 +67,6 @@ export const HeaderWrapper = styled.ImageBackground`
|
|
|
67
67
|
|
|
68
68
|
export const ListWrapper = styled.View`
|
|
69
69
|
background-color: ${(props: any) => props.theme.colors.backgroundLight};
|
|
70
|
-
padding-horizontal: ${(props: any) => props.ph ?? 40}px;
|
|
71
70
|
`;
|
|
72
71
|
|
|
73
72
|
export const FeaturedWrapper = styled.View`
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
|
-
export const ContainerButtons = styled.View`
|
|
4
|
-
margin-vertical: 50px
|
|
5
|
-
`
|
|
6
|
-
|
|
7
3
|
export const Container = styled.ScrollView`
|
|
8
4
|
position: relative;
|
|
9
5
|
flex: 1;
|
|
@@ -13,7 +9,7 @@ export const Container = styled.ScrollView`
|
|
|
13
9
|
export const NotificationsGroupSwitchWrapper = styled.View`
|
|
14
10
|
flex-grow: 1;
|
|
15
11
|
justify-content: space-between;
|
|
16
|
-
|
|
12
|
+
padding: 0 20px;
|
|
17
13
|
`
|
|
18
14
|
|
|
19
15
|
export const SwitchWrapper = styled.View`
|