ordering-ui-react-native 0.12.14 → 0.12.18
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/src/components/AddressList/index.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrdersOption/index.tsx +19 -15
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
- package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
- package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
- package/themes/business/src/components 2/Chat/index.tsx +1152 -0
- package/themes/business/src/components 2/Chat/styles.tsx +12 -0
- package/themes/business/src/components 2/Contacts/index.tsx +299 -0
- package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
- package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
- package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
- package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
- package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
- package/themes/business/src/components 2/Home/index.tsx +111 -0
- package/themes/business/src/components 2/Home/styles.tsx +27 -0
- package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
- package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
- package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
- package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
- package/themes/business/src/components 2/MapView/index.tsx +317 -0
- package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
- package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
- package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
- package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
- package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
- package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
- package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
- package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
- package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
- package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
- package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
- package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
- package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
- package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
- package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
- package/themes/business/src/components 2/StoresList/index.tsx +208 -0
- package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
- package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
- package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
- package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
- package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
- package/themes/business/src/components 2/shared/OButton.tsx +149 -0
- package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
- package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components 2/shared/OFab.tsx +54 -0
- package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
- package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
- package/themes/business/src/components 2/shared/OInput.tsx +144 -0
- package/themes/business/src/components 2/shared/OLink.tsx +76 -0
- package/themes/business/src/components 2/shared/OModal.tsx +275 -0
- package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
- package/themes/business/src/components 2/shared/OText.tsx +55 -0
- package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
- package/themes/business/src/components 2/shared/OToast.tsx +92 -0
- package/themes/business/src/components 2/shared/index.tsx +27 -0
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import styled, { css, useTheme } from 'styled-components/native'
|
|
3
|
+
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
|
|
4
|
+
import { ScrollView as CustomScrollView, TouchableOpacity as CustomTouchableOpacity, View } from 'react-native'
|
|
5
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
6
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
7
|
+
import { Text } from 'react-native-paper';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
secondary?: boolean,
|
|
11
|
+
options?: any;
|
|
12
|
+
defaultValue?: any,
|
|
13
|
+
placeholder?: string,
|
|
14
|
+
onSelect?: any,
|
|
15
|
+
style?: any,
|
|
16
|
+
dropViewMaxHeight?: any,
|
|
17
|
+
isModal?: any,
|
|
18
|
+
bgcolor?: string,
|
|
19
|
+
textcolor?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Wrapper = styled.View`
|
|
23
|
+
position: relative;
|
|
24
|
+
`
|
|
25
|
+
const Selected = styled.TouchableOpacity`
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
position: relative;
|
|
30
|
+
padding: 15px;
|
|
31
|
+
border-radius: 10px;
|
|
32
|
+
border-width: 1px;
|
|
33
|
+
border-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.lightGray : props.theme.colors.primary)};
|
|
34
|
+
background-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.white : props.theme.colors.primary)};
|
|
35
|
+
`
|
|
36
|
+
const SelectedLabel = styled.Text`
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
color: ${(props: any) => props.textcolor || (props.secondary ? props.theme.colors.black : props.theme.colors.white)};
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
const DropView = styled.View`
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: 9999;
|
|
44
|
+
top: 65px;
|
|
45
|
+
border-width: 1px;
|
|
46
|
+
border-color: ${(props: any) => props.theme.colors.inputChat};
|
|
47
|
+
shadow-color: 'rgba(0.0, 0.0, 0.0, 0.5)';
|
|
48
|
+
shadow-opacity: 0.21;
|
|
49
|
+
elevation: 7;
|
|
50
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
51
|
+
border-radius: 7.6px;
|
|
52
|
+
padding-left: 10px;
|
|
53
|
+
padding-right: 10px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
`
|
|
56
|
+
const DropOption = styled.View`
|
|
57
|
+
padding: 15px;
|
|
58
|
+
font-size: 16px;
|
|
59
|
+
border-bottom-width: 1px;
|
|
60
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
`
|
|
64
|
+
|
|
65
|
+
const ODropDown = (props: Props) => {
|
|
66
|
+
const {
|
|
67
|
+
secondary,
|
|
68
|
+
options,
|
|
69
|
+
defaultValue,
|
|
70
|
+
placeholder,
|
|
71
|
+
onSelect,
|
|
72
|
+
dropViewMaxHeight,
|
|
73
|
+
isModal
|
|
74
|
+
} = props
|
|
75
|
+
|
|
76
|
+
const theme = useTheme();
|
|
77
|
+
|
|
78
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
79
|
+
const defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
80
|
+
const [selectedOption, setSelectedOption] = useState<any>(defaultOption)
|
|
81
|
+
const [value, setValue] = useState(defaultValue)
|
|
82
|
+
|
|
83
|
+
const onToggle = () => {
|
|
84
|
+
setIsOpen(!isOpen)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const onSelectOption = (option: any) => {
|
|
88
|
+
setSelectedOption(option)
|
|
89
|
+
setValue(option.value)
|
|
90
|
+
onSelect(option.name || option.value)
|
|
91
|
+
setIsOpen(false)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const _defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
96
|
+
setSelectedOption(_defaultOption)
|
|
97
|
+
setValue(defaultValue)
|
|
98
|
+
}, [defaultValue, options])
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Wrapper style={props.style}>
|
|
102
|
+
<Selected
|
|
103
|
+
secondary={secondary}
|
|
104
|
+
bgcolor={props.bgcolor}
|
|
105
|
+
onPress={() => onToggle()}
|
|
106
|
+
>
|
|
107
|
+
<SelectedLabel
|
|
108
|
+
secondary={secondary}
|
|
109
|
+
textcolor={props.textcolor}
|
|
110
|
+
>
|
|
111
|
+
{selectedOption?.content || selectedOption?.name || placeholder}
|
|
112
|
+
</SelectedLabel>
|
|
113
|
+
<FeatherIcon
|
|
114
|
+
name='chevron-down'
|
|
115
|
+
color={props.textcolor}
|
|
116
|
+
size={24}
|
|
117
|
+
/>
|
|
118
|
+
</Selected>
|
|
119
|
+
{isOpen && options && (
|
|
120
|
+
<DropView
|
|
121
|
+
secondary={secondary}
|
|
122
|
+
>
|
|
123
|
+
{!isModal ? (
|
|
124
|
+
<ScrollView style={{
|
|
125
|
+
maxHeight: dropViewMaxHeight || null
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{options.map((option: any, index: number) => (
|
|
129
|
+
<TouchableOpacity
|
|
130
|
+
key={index}
|
|
131
|
+
onPress={() => onSelectOption(option)}
|
|
132
|
+
>
|
|
133
|
+
<View style={{ marginRight: 10 }}>
|
|
134
|
+
{value === option.value ? (
|
|
135
|
+
<MaterialCommunityIcons
|
|
136
|
+
name='radiobox-marked'
|
|
137
|
+
size={24}
|
|
138
|
+
color={theme.colors.primary}
|
|
139
|
+
/>
|
|
140
|
+
) : (
|
|
141
|
+
<MaterialCommunityIcons
|
|
142
|
+
name='radiobox-blank'
|
|
143
|
+
size={24}
|
|
144
|
+
color={theme.colors.primary}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
</View>
|
|
148
|
+
<Text>{option.content || option.name}</Text>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
))}
|
|
151
|
+
</ScrollView>
|
|
152
|
+
) : (
|
|
153
|
+
<CustomScrollView style={{
|
|
154
|
+
maxHeight: dropViewMaxHeight || null,
|
|
155
|
+
paddingBottom: 15
|
|
156
|
+
}}
|
|
157
|
+
nestedScrollEnabled={true}
|
|
158
|
+
>
|
|
159
|
+
{options.map((option: any, index: number) => (
|
|
160
|
+
<CustomTouchableOpacity
|
|
161
|
+
key={index}
|
|
162
|
+
onPress={() => onSelectOption(option)}
|
|
163
|
+
>
|
|
164
|
+
<DropOption
|
|
165
|
+
numberOfLines={1}
|
|
166
|
+
selected={value === option.value}
|
|
167
|
+
>
|
|
168
|
+
<View style={{ marginRight: 10 }}>
|
|
169
|
+
{value === option.value ? (
|
|
170
|
+
<MaterialCommunityIcons
|
|
171
|
+
name='radiobox-marked'
|
|
172
|
+
size={24}
|
|
173
|
+
color={theme.colors.primary}
|
|
174
|
+
/>
|
|
175
|
+
) : (
|
|
176
|
+
<MaterialCommunityIcons
|
|
177
|
+
name='radiobox-blank'
|
|
178
|
+
size={24}
|
|
179
|
+
color={theme.colors.arrowColor}
|
|
180
|
+
/>
|
|
181
|
+
)}
|
|
182
|
+
</View>
|
|
183
|
+
<Text>{option.content || option.name}</Text>
|
|
184
|
+
</DropOption>
|
|
185
|
+
</CustomTouchableOpacity>
|
|
186
|
+
))}
|
|
187
|
+
</CustomScrollView>
|
|
188
|
+
)}
|
|
189
|
+
</DropView>
|
|
190
|
+
)}
|
|
191
|
+
</Wrapper>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export default ODropDown
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import styled, { css, useTheme } from 'styled-components/native'
|
|
3
|
+
import { useLanguage } from 'ordering-components/native';
|
|
4
|
+
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'
|
|
5
|
+
import { ScrollView as CustomScrollView, TouchableOpacity as CustomTouchableOpacity, View, useWindowDimensions } from 'react-native'
|
|
6
|
+
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
7
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
9
|
+
import { Text } from 'react-native-paper';
|
|
10
|
+
import CalendarPicker from 'react-native-calendar-picker';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
secondary?: boolean,
|
|
14
|
+
options?: any;
|
|
15
|
+
defaultValue?: any,
|
|
16
|
+
placeholder?: string,
|
|
17
|
+
onSelect?: any,
|
|
18
|
+
style?: any,
|
|
19
|
+
dropViewMaxHeight?: any,
|
|
20
|
+
isModal?: any,
|
|
21
|
+
bgcolor?: string,
|
|
22
|
+
textcolor?: string,
|
|
23
|
+
isCalendar?: boolean,
|
|
24
|
+
handleChangeDate?: any,
|
|
25
|
+
rangeDate?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Wrapper = styled.View`
|
|
29
|
+
position: relative;
|
|
30
|
+
`
|
|
31
|
+
const Selected = styled.TouchableOpacity`
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
position: relative;
|
|
36
|
+
padding: 15px;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
border-width: 1px;
|
|
39
|
+
border-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.lightGray : props.theme.colors.primary)};
|
|
40
|
+
background-color: ${(props: any) => props.bgcolor || (props.secondary ? props.theme.colors.white : props.theme.colors.primary)};
|
|
41
|
+
`
|
|
42
|
+
const SelectedLabel = styled.Text`
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
color: ${(props: any) => props.textcolor || (props.secondary ? props.theme.colors.black : props.theme.colors.white)};
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
const DropView = styled.View`
|
|
48
|
+
position: absolute;
|
|
49
|
+
z-index: 9999;
|
|
50
|
+
top: 65px;
|
|
51
|
+
border-width: 1px;
|
|
52
|
+
border-color: ${(props: any) => props.theme.colors.inputChat};
|
|
53
|
+
shadow-color: 'rgba(0.0, 0.0, 0.0, 0.5)';
|
|
54
|
+
shadow-opacity: 0.21;
|
|
55
|
+
elevation: 7;
|
|
56
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
57
|
+
border-radius: 7.6px;
|
|
58
|
+
padding-left: 10px;
|
|
59
|
+
padding-right: 10px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
`
|
|
62
|
+
const DropOption = styled.View`
|
|
63
|
+
padding: 15px;
|
|
64
|
+
font-size: 16px;
|
|
65
|
+
border-bottom-width: 1px;
|
|
66
|
+
border-bottom-color: ${(props: any) => props.theme.colors.lightGray};
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
align-items: center;
|
|
69
|
+
`
|
|
70
|
+
|
|
71
|
+
const DateInput = styled.TextInput`
|
|
72
|
+
flex-grow: 1;
|
|
73
|
+
flex: 1;
|
|
74
|
+
min-height: 36px;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
font-family: 'Poppins-Regular';
|
|
77
|
+
border-width: 1px;
|
|
78
|
+
border-color: ${(props: any) => props.theme.colors.tabBar};
|
|
79
|
+
padding: 7px 14px;
|
|
80
|
+
color: ${(props: any) => props.theme.colors.backArrow};
|
|
81
|
+
${({ active }: { active: boolean }) => active && css`
|
|
82
|
+
border-color: ${(props: any) => props.theme.colors.primary};
|
|
83
|
+
`}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
const ODropDownCalendar = (props: Props) => {
|
|
87
|
+
const {
|
|
88
|
+
secondary,
|
|
89
|
+
options,
|
|
90
|
+
defaultValue,
|
|
91
|
+
placeholder,
|
|
92
|
+
onSelect,
|
|
93
|
+
dropViewMaxHeight,
|
|
94
|
+
isModal,
|
|
95
|
+
isCalendar,
|
|
96
|
+
handleChangeDate,
|
|
97
|
+
rangeDate
|
|
98
|
+
} = props
|
|
99
|
+
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
const { width } = useWindowDimensions();
|
|
102
|
+
const [, t] = useLanguage();
|
|
103
|
+
|
|
104
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
105
|
+
const defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
106
|
+
const [selectedOption, setSelectedOption] = useState<any>(defaultOption)
|
|
107
|
+
const [value, setValue] = useState(defaultValue)
|
|
108
|
+
|
|
109
|
+
const onToggle = () => {
|
|
110
|
+
setIsOpen(!isOpen)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const onSelectOption = (option: any) => {
|
|
114
|
+
setSelectedOption(option)
|
|
115
|
+
setValue(option.value)
|
|
116
|
+
onSelect(option.name || option.value)
|
|
117
|
+
setIsOpen(false)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const onDateChange = (date: any, type: any) => {
|
|
121
|
+
if (!date) return
|
|
122
|
+
if (type === 'END_DATE') {
|
|
123
|
+
handleChangeDate(rangeDate.from, date.format('MM/DD/YY'))
|
|
124
|
+
} else {
|
|
125
|
+
handleChangeDate(date.format('MM/DD/YY'), '')
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const customDayHeaderStylesCallback = () => {
|
|
130
|
+
return {
|
|
131
|
+
textStyle: {
|
|
132
|
+
color: theme.colors.unselectText,
|
|
133
|
+
fontSize: 12,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const calendarText = (from: any, to: any, placeholder: any) => {
|
|
139
|
+
const end = ` ~ ${to}`
|
|
140
|
+
return (from || to) ? (from + (to ? end : '')) : placeholder
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
const _defaultOption = options?.find((option: any) => option.value === defaultValue)
|
|
145
|
+
setSelectedOption(_defaultOption)
|
|
146
|
+
setValue(defaultValue)
|
|
147
|
+
}, [defaultValue, options])
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Wrapper style={props.style}>
|
|
151
|
+
<Selected
|
|
152
|
+
secondary={secondary}
|
|
153
|
+
bgcolor={props.bgcolor}
|
|
154
|
+
onPress={() => onToggle()}
|
|
155
|
+
>
|
|
156
|
+
<SelectedLabel
|
|
157
|
+
secondary={secondary}
|
|
158
|
+
textcolor={props.textcolor}
|
|
159
|
+
>
|
|
160
|
+
{
|
|
161
|
+
defaultValue === 'calendar'
|
|
162
|
+
? `${calendarText(rangeDate.from, rangeDate.to, placeholder)}`
|
|
163
|
+
: `${selectedOption?.content || selectedOption?.name || placeholder}`
|
|
164
|
+
}
|
|
165
|
+
</SelectedLabel>
|
|
166
|
+
<FeatherIcon
|
|
167
|
+
name='calendar'
|
|
168
|
+
color={theme.colors.backArrow}
|
|
169
|
+
size={24}
|
|
170
|
+
/>
|
|
171
|
+
</Selected>
|
|
172
|
+
{isOpen && options && (
|
|
173
|
+
<DropView
|
|
174
|
+
secondary={secondary}
|
|
175
|
+
>
|
|
176
|
+
{!isModal ? (
|
|
177
|
+
<ScrollView style={{
|
|
178
|
+
maxHeight: dropViewMaxHeight || null
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
{options.map((option: any, index: number) => (
|
|
182
|
+
<TouchableOpacity
|
|
183
|
+
key={index}
|
|
184
|
+
onPress={() => onSelectOption(option)}
|
|
185
|
+
>
|
|
186
|
+
<View style={{ marginRight: 10 }}>
|
|
187
|
+
{value === option.value ? (
|
|
188
|
+
<MaterialCommunityIcons
|
|
189
|
+
name='radiobox-marked'
|
|
190
|
+
size={24}
|
|
191
|
+
color={theme.colors.primary}
|
|
192
|
+
/>
|
|
193
|
+
) : (
|
|
194
|
+
<MaterialCommunityIcons
|
|
195
|
+
name='radiobox-blank'
|
|
196
|
+
size={24}
|
|
197
|
+
color={theme.colors.primary}
|
|
198
|
+
/>
|
|
199
|
+
)}
|
|
200
|
+
</View>
|
|
201
|
+
<Text>{option.content || option.name}</Text>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
))}
|
|
204
|
+
</ScrollView>
|
|
205
|
+
) : (
|
|
206
|
+
<CustomScrollView style={{
|
|
207
|
+
maxHeight: dropViewMaxHeight || null
|
|
208
|
+
}}
|
|
209
|
+
nestedScrollEnabled={true}
|
|
210
|
+
>
|
|
211
|
+
{options.map((option: any, index: number) => (
|
|
212
|
+
<CustomTouchableOpacity
|
|
213
|
+
key={index}
|
|
214
|
+
onPress={() => onSelectOption(option)}
|
|
215
|
+
>
|
|
216
|
+
<DropOption
|
|
217
|
+
numberOfLines={1}
|
|
218
|
+
selected={value === option.value}
|
|
219
|
+
>
|
|
220
|
+
<View style={{ marginRight: 10 }}>
|
|
221
|
+
{value === option.value ? (
|
|
222
|
+
<MaterialCommunityIcons
|
|
223
|
+
name='radiobox-marked'
|
|
224
|
+
size={24}
|
|
225
|
+
color={theme.colors.primary}
|
|
226
|
+
/>
|
|
227
|
+
) : (
|
|
228
|
+
<MaterialCommunityIcons
|
|
229
|
+
name='radiobox-blank'
|
|
230
|
+
size={24}
|
|
231
|
+
color={theme.colors.arrowColor}
|
|
232
|
+
/>
|
|
233
|
+
)}
|
|
234
|
+
</View>
|
|
235
|
+
<Text>{option.content || option.name}</Text>
|
|
236
|
+
</DropOption>
|
|
237
|
+
</CustomTouchableOpacity>
|
|
238
|
+
))}
|
|
239
|
+
{isCalendar && (
|
|
240
|
+
<>
|
|
241
|
+
<View style={{
|
|
242
|
+
flexDirection: 'row',
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
marginTop: 10
|
|
245
|
+
}}>
|
|
246
|
+
<View style={{marginRight: 10, flex: 1, marginBottom: 15}}>
|
|
247
|
+
<Text style={{marginBottom: 5}}>{t('FROM', 'From')}</Text>
|
|
248
|
+
<DateInput
|
|
249
|
+
value={rangeDate.from}
|
|
250
|
+
placeholder={t('FROM', 'From')}
|
|
251
|
+
autoCorrect={false}
|
|
252
|
+
style={{
|
|
253
|
+
borderRadius: 7.6
|
|
254
|
+
}}
|
|
255
|
+
active={defaultValue === 'calendar'}
|
|
256
|
+
onFocus={() => onSelect('calendar')}
|
|
257
|
+
/>
|
|
258
|
+
<AntDesign
|
|
259
|
+
name='close'
|
|
260
|
+
color={theme.colors.disabled}
|
|
261
|
+
size={20}
|
|
262
|
+
style={{position: 'absolute', bottom: 13, right: 10}}
|
|
263
|
+
onPress={() => handleChangeDate('', rangeDate.to)}
|
|
264
|
+
/>
|
|
265
|
+
</View>
|
|
266
|
+
<View style={{marginLeft: 10, flex: 1, marginBottom: 15}}>
|
|
267
|
+
<Text style={{marginBottom: 5}}>{t('TO', 'To')}</Text>
|
|
268
|
+
<DateInput
|
|
269
|
+
value={rangeDate.to}
|
|
270
|
+
placeholder={t('TO', 'To')}
|
|
271
|
+
autoCorrect={false}
|
|
272
|
+
style={{
|
|
273
|
+
borderRadius: 7.6
|
|
274
|
+
}}
|
|
275
|
+
active={defaultValue === 'calendar'}
|
|
276
|
+
onFocus={() => onSelect('calendar')}
|
|
277
|
+
/>
|
|
278
|
+
<AntDesign
|
|
279
|
+
name='close'
|
|
280
|
+
color={theme.colors.disabled}
|
|
281
|
+
size={20}
|
|
282
|
+
style={{position: 'absolute', bottom: 13, right: 10}}
|
|
283
|
+
onPress={() => handleChangeDate(rangeDate.from, '')}
|
|
284
|
+
/>
|
|
285
|
+
</View>
|
|
286
|
+
</View>
|
|
287
|
+
{
|
|
288
|
+
defaultValue === 'calendar' && (
|
|
289
|
+
<CalendarPicker
|
|
290
|
+
previousComponent={
|
|
291
|
+
<FeatherIcon
|
|
292
|
+
name='chevron-left'
|
|
293
|
+
color={theme.colors.disabled}
|
|
294
|
+
size={24}
|
|
295
|
+
style={{ marginHorizontal: 4 }}
|
|
296
|
+
/>
|
|
297
|
+
}
|
|
298
|
+
nextComponent={
|
|
299
|
+
<FeatherIcon
|
|
300
|
+
name='chevron-right'
|
|
301
|
+
color={theme.colors.disabled}
|
|
302
|
+
size={24}
|
|
303
|
+
style={{ marginHorizontal: 4 }}
|
|
304
|
+
/>
|
|
305
|
+
}
|
|
306
|
+
width={width - 80}
|
|
307
|
+
startFromMonday={true}
|
|
308
|
+
allowRangeSelection={true}
|
|
309
|
+
selectedDayTextColor={theme.colors.textGray}
|
|
310
|
+
selectedDayColor={theme.colors.forgotText}
|
|
311
|
+
todayBackgroundColor={theme.colors.border}
|
|
312
|
+
dayLabelsWrapper={{ borderColor: theme.colors.clear }}
|
|
313
|
+
onDateChange={onDateChange}
|
|
314
|
+
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
315
|
+
/>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
</>
|
|
319
|
+
)}
|
|
320
|
+
</CustomScrollView>
|
|
321
|
+
)}
|
|
322
|
+
</DropView>
|
|
323
|
+
)}
|
|
324
|
+
</Wrapper>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export default ODropDownCalendar
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyleProp,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import Icon from 'react-native-vector-icons/Ionicons';
|
|
10
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
11
|
+
interface Props {
|
|
12
|
+
iconName: string;
|
|
13
|
+
onPress: () => void;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
materialIcon?: boolean
|
|
16
|
+
}
|
|
17
|
+
const OFab = ({ iconName, materialIcon, onPress, style = {} }: Props) => {
|
|
18
|
+
return (
|
|
19
|
+
<View style={{ ...(style as any) }}>
|
|
20
|
+
<TouchableOpacity
|
|
21
|
+
activeOpacity={0.8}
|
|
22
|
+
onPress={onPress}
|
|
23
|
+
style={styles.blackButton}>
|
|
24
|
+
{materialIcon ? (
|
|
25
|
+
<MaterialIcon name={iconName} color="white" size={20} />
|
|
26
|
+
) : (
|
|
27
|
+
<Icon name={iconName} color="white" size={20} />
|
|
28
|
+
)}
|
|
29
|
+
</TouchableOpacity>
|
|
30
|
+
</View>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
blackButton: {
|
|
36
|
+
zIndex: 9999,
|
|
37
|
+
height: 30,
|
|
38
|
+
width: 30,
|
|
39
|
+
backgroundColor: 'black',
|
|
40
|
+
borderRadius: 100,
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
shadowColor: '#000',
|
|
44
|
+
shadowOffset: {
|
|
45
|
+
width: 0,
|
|
46
|
+
height: 3,
|
|
47
|
+
},
|
|
48
|
+
shadowOpacity: 0.27,
|
|
49
|
+
shadowRadius: 4.65,
|
|
50
|
+
elevation: 6,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default OFab;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ImageStyle } from 'react-native';
|
|
3
|
+
import styled from 'styled-components/native';
|
|
4
|
+
import { useTheme } from 'styled-components/native';
|
|
5
|
+
|
|
6
|
+
const Wrapper = styled.View``;
|
|
7
|
+
|
|
8
|
+
const SImage = styled.Image`
|
|
9
|
+
tint-color: ${(props: any) => props.theme.colors.primary};
|
|
10
|
+
`;
|
|
11
|
+
interface Props {
|
|
12
|
+
src?: any;
|
|
13
|
+
url?: string;
|
|
14
|
+
dummy?: any;
|
|
15
|
+
color?: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
style?: ImageStyle;
|
|
19
|
+
isWrap?: boolean;
|
|
20
|
+
cover?: boolean;
|
|
21
|
+
children?: any;
|
|
22
|
+
borderRadius?: number;
|
|
23
|
+
borderBottomWidth?: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const OImage = (props: Props): React.ReactElement => {
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
return (
|
|
29
|
+
<Wrapper
|
|
30
|
+
style={{
|
|
31
|
+
borderRadius: props.style?.borderRadius,
|
|
32
|
+
overflow: 'hidden',
|
|
33
|
+
marginHorizontal: props.style?.marginHorizontal,
|
|
34
|
+
borderBottomWidth: props.borderBottomWidth
|
|
35
|
+
}}>
|
|
36
|
+
<SImage
|
|
37
|
+
source={
|
|
38
|
+
props.src
|
|
39
|
+
? props.src
|
|
40
|
+
: props.url
|
|
41
|
+
? { uri: props.url }
|
|
42
|
+
: props.dummy
|
|
43
|
+
? props.dummy
|
|
44
|
+
: theme.images.logos.logo
|
|
45
|
+
}
|
|
46
|
+
style={{
|
|
47
|
+
tintColor: props.color,
|
|
48
|
+
flex: props.isWrap ? 1 : 0,
|
|
49
|
+
width: props.width,
|
|
50
|
+
height: props.height,
|
|
51
|
+
marginHorizontal: 0,
|
|
52
|
+
borderRadius: props.borderRadius,
|
|
53
|
+
...props.style,
|
|
54
|
+
}}
|
|
55
|
+
resizeMode={props.cover ? 'cover' : 'contain'}>
|
|
56
|
+
{props.children}
|
|
57
|
+
</SImage>
|
|
58
|
+
</Wrapper>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
OImage.defaultProps = {
|
|
63
|
+
width: 26,
|
|
64
|
+
height: 26,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default OImage;
|