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,55 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TextStyle } from 'react-native';
|
|
3
|
+
import styled, { css } from 'styled-components/native';
|
|
4
|
+
|
|
5
|
+
const SText = styled.Text`
|
|
6
|
+
color: ${(props: any) => props.color || '#344050'};
|
|
7
|
+
font-family: 'Poppins-Regular';
|
|
8
|
+
font-size: ${(props: any) => (props.size ? `${props.size}px` : '14px')};
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
margin-bottom: ${(props: any) =>
|
|
11
|
+
props.hasBottom ? '10px' : props.mBottom ? `${props.mBottom}px` : 0};
|
|
12
|
+
margin-right: ${(props: any) =>
|
|
13
|
+
props.hasBottom ? '10px' : props.mRight ? `${props.mRight}px` : 0};
|
|
14
|
+
margin-left: ${(props: any) =>
|
|
15
|
+
props.hasBottom ? '10px' : props.mLeft ? `${props.mLeft}px` : 0};
|
|
16
|
+
${(props: any) =>
|
|
17
|
+
props.weight &&
|
|
18
|
+
css`
|
|
19
|
+
font-weight: ${props.weight};
|
|
20
|
+
`};
|
|
21
|
+
${(props: any) =>
|
|
22
|
+
props.isWrap &&
|
|
23
|
+
css`
|
|
24
|
+
flex: ${props.weight ? 1 : 0};
|
|
25
|
+
`};
|
|
26
|
+
text-decoration: ${(props : any) => props.textDecorationLine};
|
|
27
|
+
`;
|
|
28
|
+
interface Props {
|
|
29
|
+
color?: string;
|
|
30
|
+
size?: number;
|
|
31
|
+
weight?: any;
|
|
32
|
+
style?: TextStyle;
|
|
33
|
+
children?: JSX.Element | JSX.Element[] | string;
|
|
34
|
+
isWrap?: boolean;
|
|
35
|
+
hasBottom?: boolean;
|
|
36
|
+
mBottom?: any;
|
|
37
|
+
space?: any;
|
|
38
|
+
mRight?: number;
|
|
39
|
+
mLeft?: number;
|
|
40
|
+
numberOfLines?: number;
|
|
41
|
+
ellipsizeMode?: string;
|
|
42
|
+
adjustsFontSizeToFit?: boolean;
|
|
43
|
+
textDecorationLine?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const OText = (props: Props): React.ReactElement => {
|
|
47
|
+
return (
|
|
48
|
+
<SText {...props} style={props.style}>
|
|
49
|
+
{props.children}
|
|
50
|
+
{props.space && ' '}
|
|
51
|
+
</SText>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default OText;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components/native';
|
|
3
|
+
import { useTheme } from 'styled-components/native';
|
|
4
|
+
|
|
5
|
+
const Wrapper = styled.View`
|
|
6
|
+
border-radius: 10px;
|
|
7
|
+
border: 1px solid ${(props: any) => props.theme.colors.lightGray};
|
|
8
|
+
`;
|
|
9
|
+
const Inner = styled.TextInput`
|
|
10
|
+
height: 100px;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
lines?: number;
|
|
15
|
+
value?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
onChange?: any;
|
|
18
|
+
onFocus?: any;
|
|
19
|
+
textTareaRef?: any;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const OTextarea = (props: Props) => {
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
return (
|
|
26
|
+
<Wrapper>
|
|
27
|
+
<Inner
|
|
28
|
+
ref={props.textTareaRef}
|
|
29
|
+
onFocus={() => props.onFocus()}
|
|
30
|
+
onChangeText={(txt: any) => props.onChange(txt)}
|
|
31
|
+
textAlignVertical={'top'}
|
|
32
|
+
placeholder={props.placeholder}
|
|
33
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
34
|
+
numberOfLines={props.lines}
|
|
35
|
+
underlineColorAndroid={'transparent'}
|
|
36
|
+
value={props.value}
|
|
37
|
+
autoFocus={props.autoFocus}
|
|
38
|
+
multiline={true}
|
|
39
|
+
selectionColor={theme.colors.primary}
|
|
40
|
+
color={theme.colors.textGray}
|
|
41
|
+
/>
|
|
42
|
+
</Wrapper>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default OTextarea;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { ToastType, useToast, useLanguage } from 'ordering-components/native';
|
|
4
|
+
import { useTheme } from 'styled-components/native';
|
|
5
|
+
import { getTraduction } from '../../utils';
|
|
6
|
+
|
|
7
|
+
const fadeDuration = 300;
|
|
8
|
+
const bottomPosition = 20;
|
|
9
|
+
|
|
10
|
+
export const Toast = (props: any) => {
|
|
11
|
+
const [toastConfig, { hideToast }] = useToast();
|
|
12
|
+
const [, t] = useLanguage();
|
|
13
|
+
const opacity = React.useRef(new Animated.Value(0)).current;
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
|
|
16
|
+
const fadeIn = React.useCallback(() => {
|
|
17
|
+
Animated.timing(opacity, {
|
|
18
|
+
toValue: 1,
|
|
19
|
+
duration: fadeDuration,
|
|
20
|
+
useNativeDriver: true,
|
|
21
|
+
}).start();
|
|
22
|
+
}, [opacity]);
|
|
23
|
+
|
|
24
|
+
const fadeOut = React.useCallback(() => {
|
|
25
|
+
Animated.timing(opacity, {
|
|
26
|
+
toValue: 0,
|
|
27
|
+
duration: fadeDuration,
|
|
28
|
+
useNativeDriver: true,
|
|
29
|
+
}).start(() => {
|
|
30
|
+
hideToast();
|
|
31
|
+
});
|
|
32
|
+
}, [opacity, hideToast]);
|
|
33
|
+
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (!toastConfig) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fadeIn();
|
|
40
|
+
const timer = setTimeout(fadeOut, toastConfig.duration);
|
|
41
|
+
|
|
42
|
+
return () => clearTimeout(timer);
|
|
43
|
+
}, [toastConfig, fadeIn, fadeOut]);
|
|
44
|
+
|
|
45
|
+
if (!toastConfig) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { type, message } = toastConfig;
|
|
50
|
+
|
|
51
|
+
let backgroundColor;
|
|
52
|
+
switch (type) {
|
|
53
|
+
case ToastType.Info:
|
|
54
|
+
backgroundColor = theme.colors.toastInfo || '#6BA4FF';
|
|
55
|
+
break;
|
|
56
|
+
case ToastType.Error:
|
|
57
|
+
backgroundColor = theme.colors.toastError || '#D83520';
|
|
58
|
+
break;
|
|
59
|
+
case ToastType.Success:
|
|
60
|
+
backgroundColor = theme.colors.toastSuccess || '#90C68E';
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Animated.View
|
|
66
|
+
style={[styles.container, { bottom: bottomPosition, opacity }]}>
|
|
67
|
+
<View style={[styles.toast, { backgroundColor }]}>
|
|
68
|
+
<Text style={{ ...styles.message, ...props.messageStyle }}>
|
|
69
|
+
{getTraduction(message, t)}
|
|
70
|
+
</Text>
|
|
71
|
+
</View>
|
|
72
|
+
</Animated.View>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
container: {
|
|
78
|
+
alignSelf: 'center',
|
|
79
|
+
position: 'absolute',
|
|
80
|
+
maxWidth: 480,
|
|
81
|
+
zIndex: 9999999999,
|
|
82
|
+
},
|
|
83
|
+
toast: {
|
|
84
|
+
borderRadius: 16,
|
|
85
|
+
padding: 16,
|
|
86
|
+
},
|
|
87
|
+
message: {
|
|
88
|
+
fontSize: 14,
|
|
89
|
+
textAlign: 'center',
|
|
90
|
+
color: '#fff',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import OText from './OText';
|
|
2
|
+
import OButton from './OButton';
|
|
3
|
+
import OInput from './OInput';
|
|
4
|
+
import OIcon from './OIcon';
|
|
5
|
+
import OIconButton from './OIconButton';
|
|
6
|
+
import OTextarea from './OTextarea';
|
|
7
|
+
import OModal from './OModal';
|
|
8
|
+
import OAlert from './OAlert';
|
|
9
|
+
import OFab from './OFab';
|
|
10
|
+
import OLink from './OLink';
|
|
11
|
+
import ODropDown from './ODropDown';
|
|
12
|
+
import ODropDownCalendar from './ODropDownCalendar';
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
OText,
|
|
16
|
+
OButton,
|
|
17
|
+
OInput,
|
|
18
|
+
OIcon,
|
|
19
|
+
OIconButton,
|
|
20
|
+
OTextarea,
|
|
21
|
+
OAlert,
|
|
22
|
+
OModal,
|
|
23
|
+
OFab,
|
|
24
|
+
OLink,
|
|
25
|
+
ODropDown,
|
|
26
|
+
ODropDownCalendar
|
|
27
|
+
};
|
|
@@ -341,6 +341,7 @@ export interface OrderDetailsParams {
|
|
|
341
341
|
actions?: actions;
|
|
342
342
|
titleAccept?: textTranslate;
|
|
343
343
|
titleReject?: textTranslate;
|
|
344
|
+
titleNotReady?: textTranslate;
|
|
344
345
|
appTitle?: textTranslate;
|
|
345
346
|
drivers?: any;
|
|
346
347
|
loadingDriver?: boolean;
|
|
@@ -520,6 +521,7 @@ interface actions {
|
|
|
520
521
|
accept: string;
|
|
521
522
|
reject: string;
|
|
522
523
|
failed: string;
|
|
524
|
+
notReady: string;
|
|
523
525
|
}
|
|
524
526
|
|
|
525
527
|
interface textTranslate {
|
|
@@ -531,13 +533,14 @@ export interface AcceptOrRejectOrderParams {
|
|
|
531
533
|
customerCellphone?: string;
|
|
532
534
|
closeModal?: any;
|
|
533
535
|
loading?: boolean;
|
|
534
|
-
action
|
|
536
|
+
action: string;
|
|
535
537
|
orderId?: number;
|
|
536
538
|
handleUpdateOrder?: (status: number, isAccept: any) => {};
|
|
537
539
|
notShowCustomerPhone?: boolean | undefined;
|
|
538
540
|
actions?: actions;
|
|
539
541
|
titleAccept?: textTranslate;
|
|
540
542
|
titleReject?: textTranslate;
|
|
543
|
+
titleNotReady?: textTranslate;
|
|
541
544
|
appTitle?: textTranslate;
|
|
542
545
|
}
|
|
543
546
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Platform, View } from 'react-native';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Dimensions, Platform, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useOrder, useUtils } from 'ordering-components/native';
|
|
4
4
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
5
5
|
|
|
@@ -17,13 +17,16 @@ import { CartContent } from '../../components/CartContent';
|
|
|
17
17
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
18
18
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
19
19
|
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
20
|
-
import { useTheme } from 'styled-components/native';
|
|
20
|
+
import styled, { useTheme } from 'styled-components/native';
|
|
21
|
+
import { DrawerView } from '../DrawerView';
|
|
22
|
+
import { ProductForm } from '../ProductForm';
|
|
21
23
|
|
|
22
24
|
const CategoriesMenu = (props: any): React.ReactElement => {
|
|
23
25
|
|
|
24
26
|
const {
|
|
25
27
|
navigation,
|
|
26
28
|
route,
|
|
29
|
+
isDrawer
|
|
27
30
|
} = props;
|
|
28
31
|
|
|
29
32
|
const {
|
|
@@ -41,7 +44,16 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
41
44
|
const [{ parsePrice }] = useUtils();
|
|
42
45
|
const [orientationState] = useDeviceOrientation();
|
|
43
46
|
const [bottomSheetVisibility, { showCartBottomSheet, hideCartBottomSheet }] = useCartBottomSheet();
|
|
44
|
-
|
|
47
|
+
const [productSelected, setProductSelected] = useState({})
|
|
48
|
+
const [drawerState, setDrawerState] = useState({ isOpen: false, data: { order: null } });
|
|
49
|
+
|
|
50
|
+
const width_dimension = Dimensions.get('window').width;
|
|
51
|
+
const height_dimension = Dimensions.get('window').height;
|
|
52
|
+
|
|
53
|
+
const KeyboardView = styled.KeyboardAvoidingView`
|
|
54
|
+
flex: 1;
|
|
55
|
+
`;
|
|
56
|
+
|
|
45
57
|
const onChangeTabs = (idx: number) => {
|
|
46
58
|
resetInactivityTimeout();
|
|
47
59
|
setIndexCateg(idx);
|
|
@@ -49,6 +61,10 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
49
61
|
|
|
50
62
|
const goToBack = () => navigation.goBack()
|
|
51
63
|
|
|
64
|
+
const setDrawerValues = ({ isOpen, data }: any) => {
|
|
65
|
+
setDrawerState({ ...drawerState, isOpen, data });
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
const [{ carts }] = useOrder();
|
|
53
69
|
const cartsList = (carts && Object.values(carts).filter((cart: any) => cart.products.length > 0)) || [];
|
|
54
70
|
const VISIBLE_CART_BOTTOM_SHEET_HEIGHT = orientationState?.dimensions?.height * (orientationState.orientation === PORTRAIT ? 0.5 : 1);
|
|
@@ -82,91 +98,120 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
82
98
|
}
|
|
83
99
|
|
|
84
100
|
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<OText
|
|
108
|
-
color={theme.colors.mediumGray}
|
|
101
|
+
<>
|
|
102
|
+
<View style={{
|
|
103
|
+
flex: 1,
|
|
104
|
+
flexDirection: orientationState?.orientation === PORTRAIT ? 'column' : 'row'
|
|
105
|
+
}}>
|
|
106
|
+
<View
|
|
107
|
+
style={{
|
|
108
|
+
flex: 1,
|
|
109
|
+
paddingBottom: bottomSheetVisibility && !!cart && orientationState?.orientation === PORTRAIT
|
|
110
|
+
? VISIBLE_CART_BOTTOM_SHEET_HEIGHT
|
|
111
|
+
: 0,
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<Container nopadding nestedScrollEnabled>
|
|
115
|
+
<View style={{ paddingTop: 20 }}>
|
|
116
|
+
<NavBar
|
|
117
|
+
title={categories[curIndexCateg].name}
|
|
118
|
+
onActionLeft={goToBack}
|
|
119
|
+
rightComponent={cart && (
|
|
120
|
+
<TouchableOpacity
|
|
121
|
+
style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
|
|
122
|
+
onPress={onToggleCart}
|
|
109
123
|
>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
<OText
|
|
125
|
+
color={theme.colors.mediumGray}
|
|
126
|
+
>
|
|
127
|
+
{`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
|
|
128
|
+
</OText>
|
|
129
|
+
|
|
130
|
+
<MaterialIcon
|
|
131
|
+
name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
|
|
132
|
+
color={theme.colors.primary}
|
|
133
|
+
size={30}
|
|
134
|
+
/>
|
|
135
|
+
</TouchableOpacity>
|
|
136
|
+
)}
|
|
137
|
+
/>
|
|
138
|
+
<OSegment
|
|
139
|
+
items={categories.map((category) => ({
|
|
140
|
+
text: category.name
|
|
141
|
+
}))}
|
|
142
|
+
selectedIdx={curIndexCateg}
|
|
143
|
+
onSelectItem={onChangeTabs}
|
|
144
|
+
/>
|
|
145
|
+
</View>
|
|
146
|
+
|
|
147
|
+
<GridContainer style={{ marginTop: 20 }}>
|
|
148
|
+
{categories[curIndexCateg].products.map((product) => (
|
|
149
|
+
<OCard
|
|
150
|
+
key={product.id}
|
|
151
|
+
title={product?.name}
|
|
152
|
+
image={{ uri: product?.images }}
|
|
153
|
+
style={{
|
|
154
|
+
width: orientationState?.orientation === LANDSCAPE
|
|
155
|
+
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
|
|
156
|
+
: orientationState?.dimensions?.width * 0.20
|
|
157
|
+
}}
|
|
158
|
+
titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
|
|
159
|
+
onPress={() => {
|
|
160
|
+
resetInactivityTimeout()
|
|
161
|
+
if (isDrawer) {
|
|
162
|
+
setProductSelected(product)
|
|
163
|
+
setDrawerValues({ isOpen: true, data: null })
|
|
164
|
+
} else {
|
|
165
|
+
navigation.navigate('ProductDetails', {
|
|
166
|
+
businessId,
|
|
167
|
+
businessSlug,
|
|
168
|
+
product,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}}
|
|
172
|
+
{...(!!product?.description && { description: product?.description } )}
|
|
173
|
+
{...(!!product?.price && { price: parsePrice(product?.price) } )}
|
|
174
|
+
{...(product?.in_offer && { prevPrice: `$${product?.offer_price}` } )}
|
|
175
|
+
/>
|
|
176
|
+
))}
|
|
177
|
+
</GridContainer>
|
|
178
|
+
</Container>
|
|
179
|
+
</View>
|
|
180
|
+
|
|
181
|
+
<View
|
|
182
|
+
style={{
|
|
183
|
+
flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
|
|
184
|
+
display: bottomSheetVisibility ? 'flex' : 'none'
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
<CartContent
|
|
188
|
+
{...cartProps}
|
|
127
189
|
/>
|
|
128
190
|
</View>
|
|
129
|
-
|
|
130
|
-
<GridContainer style={{ marginTop: 20 }}>
|
|
131
|
-
{categories[curIndexCateg].products.map((product) => (
|
|
132
|
-
<OCard
|
|
133
|
-
key={product.id}
|
|
134
|
-
title={product?.name}
|
|
135
|
-
image={{ uri: product?.images }}
|
|
136
|
-
style={{
|
|
137
|
-
width: orientationState?.orientation === LANDSCAPE
|
|
138
|
-
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
|
|
139
|
-
: orientationState?.dimensions?.width * 0.20
|
|
140
|
-
}}
|
|
141
|
-
titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
|
|
142
|
-
onPress={() => {
|
|
143
|
-
resetInactivityTimeout()
|
|
144
|
-
navigation.navigate('ProductDetails', {
|
|
145
|
-
businessId,
|
|
146
|
-
businessSlug,
|
|
147
|
-
product,
|
|
148
|
-
});
|
|
149
|
-
}}
|
|
150
|
-
{...(!!product?.description && { description: product?.description } )}
|
|
151
|
-
{...(!!product?.price && { price: parsePrice(product?.price) } )}
|
|
152
|
-
{...(product?.in_offer && { prevPrice: `$${product?.offer_price}` } )}
|
|
153
|
-
/>
|
|
154
|
-
))}
|
|
155
|
-
</GridContainer>
|
|
156
|
-
</Container>
|
|
157
191
|
</View>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
192
|
+
<DrawerView
|
|
193
|
+
isOpen={drawerState.isOpen}
|
|
194
|
+
width={width_dimension - (width_dimension * 0.4)}
|
|
195
|
+
height={height_dimension}
|
|
196
|
+
onClickIcon={() => setDrawerValues({ isOpen: !drawerState.isOpen, data: null })}
|
|
197
|
+
>
|
|
198
|
+
<KeyboardView
|
|
199
|
+
enabled
|
|
200
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
164
201
|
>
|
|
165
|
-
<
|
|
166
|
-
|
|
202
|
+
<ProductForm
|
|
203
|
+
isDrawer
|
|
204
|
+
product={productSelected}
|
|
205
|
+
businessId={parseInt(businessId, 10)}
|
|
206
|
+
businessSlug={businessSlug}
|
|
207
|
+
onSave={() => {
|
|
208
|
+
setDrawerValues({ isOpen: !drawerState.isOpen, data: null })
|
|
209
|
+
}}
|
|
210
|
+
navigation={navigation}
|
|
167
211
|
/>
|
|
168
|
-
</
|
|
169
|
-
|
|
212
|
+
</KeyboardView>
|
|
213
|
+
</DrawerView>
|
|
214
|
+
</>
|
|
170
215
|
);
|
|
171
216
|
};
|
|
172
217
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Container,
|
|
7
|
+
Wrapper,
|
|
8
|
+
WrapperFloatBtn,
|
|
9
|
+
IconControl
|
|
10
|
+
} from './styles';
|
|
11
|
+
|
|
12
|
+
export const DrawerView = (props: any) => {
|
|
13
|
+
const {
|
|
14
|
+
children,
|
|
15
|
+
isOpen,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
onClickIcon,
|
|
19
|
+
iconStyles
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
isOpen && (
|
|
24
|
+
<>
|
|
25
|
+
<WrapperFloatBtn>
|
|
26
|
+
<IconControl
|
|
27
|
+
activeOpacity={1}
|
|
28
|
+
style={{ ...iconStyles, ...styles.shadow}}
|
|
29
|
+
onPress={() => onClickIcon()}
|
|
30
|
+
>
|
|
31
|
+
<MaterialCommunityIcon
|
|
32
|
+
name='arrow-expand-right'
|
|
33
|
+
size={24}
|
|
34
|
+
/>
|
|
35
|
+
</IconControl>
|
|
36
|
+
</WrapperFloatBtn>
|
|
37
|
+
<Container style={styles.shadow}>
|
|
38
|
+
<Wrapper width={width} height={height}>
|
|
39
|
+
{children}
|
|
40
|
+
</Wrapper>
|
|
41
|
+
</Container>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
shadow:{
|
|
49
|
+
shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
|
|
50
|
+
shadowOffset: {
|
|
51
|
+
width: 0,
|
|
52
|
+
height: 1.5,
|
|
53
|
+
},
|
|
54
|
+
shadowOpacity: 0.21,
|
|
55
|
+
shadowRadius: 5,
|
|
56
|
+
}
|
|
57
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View`
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
z-index: 10001;
|
|
8
|
+
elevation: 5;
|
|
9
|
+
background-color: #FFF;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export const Wrapper = styled.View`
|
|
13
|
+
width: ${(props: any) => props.width}px;
|
|
14
|
+
height: ${(props: any) => props.height}px;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const WrapperFloatBtn = styled.View`
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 10%;
|
|
20
|
+
right: ${(props: any) => props.outside ? 11 : 58}%;
|
|
21
|
+
z-index: 20002;
|
|
22
|
+
elevation: 11;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const IconControl = styled.TouchableOpacity`
|
|
26
|
+
background-color: ${(props: any) => props.theme.colors.white};
|
|
27
|
+
padding: 10px;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
elevation: 11;
|
|
30
|
+
`;
|