ordering-ui-react-native 0.12.35 → 0.12.36
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/single-business/src/components/LanguageSelector/index.tsx +87 -70
- package/themes/single-business/src/components/OrderDetails/index.tsx +14 -14
- package/themes/single-business/src/components/ProductForm/index.tsx +682 -656
- package/themes/single-business/src/components/ProductForm/styles.tsx +1 -1
- package/themes/single-business/src/components/UserProfile/index.tsx +2 -2
- package/themes/single-business/src/components/shared/OInput.tsx +1 -0
- package/themes/single-business/src/components/shared/OLink.tsx +80 -0
- package/themes/single-business/src/components/shared/index.tsx +2 -0
- package/themes/single-business/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import { Platform, StyleSheet, View } from 'react-native'
|
|
5
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
5
6
|
|
|
6
7
|
import RNPickerSelect from 'react-native-picker-select'
|
|
7
8
|
import { Container } from './styles'
|
|
@@ -10,83 +11,99 @@ import { OIcon } from '../shared'
|
|
|
10
11
|
|
|
11
12
|
const LanguageSelectorUI = (props: LanguageSelectorParams) => {
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
const [orderState] = useOrder()
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
const theme = useTheme();
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
const _pickerStyle = StyleSheet.create({
|
|
19
|
+
inputAndroid: {
|
|
20
|
+
color: theme.colors.white,
|
|
21
|
+
borderWidth: 1,
|
|
22
|
+
borderColor: theme.colors.clear,
|
|
23
|
+
paddingHorizontal: 10,
|
|
24
|
+
paddingEnd: 24,
|
|
25
|
+
height: 40,
|
|
26
|
+
backgroundColor: theme.colors.clear,
|
|
27
|
+
},
|
|
28
|
+
inputIOS: {
|
|
29
|
+
color: theme.colors.white,
|
|
30
|
+
paddingEnd: 24,
|
|
31
|
+
height: 40,
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderColor: theme.colors.clear,
|
|
34
|
+
backgroundColor: theme.colors.clear
|
|
35
|
+
},
|
|
36
|
+
icon: {
|
|
37
|
+
width: 10,
|
|
38
|
+
marginTop: 9,
|
|
39
|
+
marginEnd: 10
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
color: theme.colors.secundaryContrast
|
|
43
|
+
}
|
|
44
|
+
})
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
const {
|
|
47
|
+
languagesState,
|
|
48
|
+
currentLanguage,
|
|
49
|
+
handleChangeLanguage,
|
|
50
|
+
iconColor,
|
|
51
|
+
pickerStyle
|
|
52
|
+
} = props
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
const _languages = languagesState?.languages?.map((language: any) => {
|
|
55
|
+
return {
|
|
56
|
+
value: language?.code,
|
|
57
|
+
label: language?.name,
|
|
58
|
+
inputLabel: language?.name
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
_languages && _languages.sort((a: any, b: any) =>
|
|
62
|
+
(a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
|
|
63
|
+
)
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
return (
|
|
66
|
+
languagesState?.loading && props.allowLoading ? (
|
|
67
|
+
<Container>
|
|
68
|
+
<Placeholder style={{ width: 100, paddingTop: 10 }} Animation={Fade}>
|
|
69
|
+
<PlaceholderLine height={20} style={{ paddingBottom: 0, marginBottom: 0 }} />
|
|
70
|
+
</Placeholder>
|
|
71
|
+
</Container>
|
|
72
|
+
) : (
|
|
73
|
+
<Container>
|
|
74
|
+
{languagesState?.languages ? (
|
|
75
|
+
<>
|
|
76
|
+
{iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
|
|
77
|
+
<RNPickerSelect
|
|
78
|
+
onValueChange={handleChangeLanguage}
|
|
79
|
+
items={_languages || []}
|
|
80
|
+
value={currentLanguage}
|
|
81
|
+
style={pickerStyle ? pickerStyle : _pickerStyle}
|
|
82
|
+
useNativeAndroidPickerStyle={false}
|
|
83
|
+
placeholder={{}}
|
|
84
|
+
Icon={() => (
|
|
85
|
+
<View
|
|
86
|
+
style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}
|
|
87
|
+
>
|
|
88
|
+
<OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} />
|
|
89
|
+
</View>
|
|
90
|
+
)}
|
|
91
|
+
disabled={orderState.loading}
|
|
92
|
+
/>
|
|
93
|
+
</>
|
|
94
|
+
) : (
|
|
95
|
+
<View style={{ height: 40 }} />
|
|
96
|
+
)}
|
|
97
|
+
</Container>
|
|
98
|
+
)
|
|
99
|
+
)
|
|
83
100
|
}
|
|
84
101
|
|
|
85
102
|
export const LanguageSelector = (props: LanguageSelectorParams) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
const LanguageProps = {
|
|
104
|
+
...props,
|
|
105
|
+
UIComponent: LanguageSelectorUI
|
|
106
|
+
}
|
|
90
107
|
|
|
91
|
-
|
|
108
|
+
return <LanguageSelectorController {...LanguageProps} />
|
|
92
109
|
}
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
OrderDriver,
|
|
37
37
|
Map,
|
|
38
38
|
} from './styles';
|
|
39
|
-
import { OButton, OIcon, OModal, OText } from '../shared';
|
|
39
|
+
import { OButton, OIcon, OModal, OText, OLink } from '../shared';
|
|
40
40
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
41
41
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
42
42
|
import { OrderDetailsParams } from '../../types';
|
|
@@ -487,19 +487,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
487
487
|
{order?.business?.name}
|
|
488
488
|
</OText>
|
|
489
489
|
<Icons>
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
490
|
+
{(!!order?.business?.cellphone || !!order?.business?.phone) && (
|
|
491
|
+
<View style={{ paddingEnd: 5 }}>
|
|
492
|
+
<OLink
|
|
493
|
+
url={`tel:${order?.business?.cellphone ?? order?.business?.phone}`}
|
|
494
|
+
>
|
|
495
|
+
<OIcon
|
|
496
|
+
src={theme.images.general.phone}
|
|
497
|
+
width={16}
|
|
498
|
+
color={theme.colors.disabled}
|
|
499
|
+
/>
|
|
500
|
+
</OLink>
|
|
501
|
+
</View>
|
|
502
|
+
)}
|
|
503
503
|
<TouchableOpacity
|
|
504
504
|
style={{ paddingStart: 5 }}
|
|
505
505
|
onPress={() => handleOpenMessagesForBusiness()}>
|