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.
Files changed (105) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressList/index.tsx +3 -1
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
  4. package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
  6. package/themes/business/src/components/OrdersOption/index.tsx +19 -15
  7. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
  8. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
  9. package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
  10. package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
  11. package/themes/business/src/components 2/Chat/index.tsx +1152 -0
  12. package/themes/business/src/components 2/Chat/styles.tsx +12 -0
  13. package/themes/business/src/components 2/Contacts/index.tsx +299 -0
  14. package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
  15. package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
  16. package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
  17. package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
  18. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
  19. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
  20. package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
  21. package/themes/business/src/components 2/Home/index.tsx +111 -0
  22. package/themes/business/src/components 2/Home/styles.tsx +27 -0
  23. package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
  24. package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
  25. package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
  26. package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
  27. package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
  28. package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
  29. package/themes/business/src/components 2/MapView/index.tsx +317 -0
  30. package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
  31. package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
  32. package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
  33. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
  34. package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
  35. package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
  36. package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
  37. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
  38. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
  39. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
  40. package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
  41. package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
  42. package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
  43. package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
  44. package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
  45. package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
  46. package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
  47. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
  48. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
  49. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
  50. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
  51. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
  52. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
  53. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
  54. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
  55. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
  56. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
  57. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
  58. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
  59. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
  60. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
  61. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
  62. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
  63. package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
  64. package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
  65. package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
  66. package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
  67. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
  68. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
  69. package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
  70. package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
  71. package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
  72. package/themes/business/src/components 2/StoresList/index.tsx +208 -0
  73. package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
  74. package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
  75. package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
  76. package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
  77. package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
  78. package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
  79. package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
  80. package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
  81. package/themes/business/src/components 2/shared/OButton.tsx +149 -0
  82. package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
  83. package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
  84. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
  85. package/themes/business/src/components 2/shared/OFab.tsx +54 -0
  86. package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
  87. package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
  88. package/themes/business/src/components 2/shared/OInput.tsx +144 -0
  89. package/themes/business/src/components 2/shared/OLink.tsx +76 -0
  90. package/themes/business/src/components 2/shared/OModal.tsx +275 -0
  91. package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
  92. package/themes/business/src/components 2/shared/OText.tsx +55 -0
  93. package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
  94. package/themes/business/src/components 2/shared/OToast.tsx +92 -0
  95. package/themes/business/src/components 2/shared/index.tsx +27 -0
  96. package/themes/business/src/types/index.tsx +4 -1
  97. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
  98. package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
  99. package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
  100. package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
  101. package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
  103. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  104. package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
  105. package/themes/original/src/components/OrderProgress/index.tsx +32 -18
@@ -0,0 +1,127 @@
1
+ import * as React from 'react';
2
+ import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
+ import styled from 'styled-components/native';
4
+ import { useTheme } from 'styled-components/native';
5
+
6
+ const Wrapper = styled.TouchableOpacity`
7
+ height: 40px;
8
+ border-radius: 20px;
9
+ flex-direction: row;
10
+ border: 1px solid white;
11
+ padding-horizontal: 20px;
12
+ align-items: center;
13
+ justify-content: center;
14
+ `;
15
+ const DisabledWrapper = styled.View`
16
+ height: 40px;
17
+ border-radius: 20px;
18
+ flex-direction: row;
19
+ border: 1px solid white;
20
+ padding-horizontal: 20px;
21
+ align-items: center;
22
+ justify-content: center;
23
+ `;
24
+ const Icon = styled.Image`
25
+ width: 22px;
26
+ height: 22px;
27
+ `;
28
+ const Title = styled.Text`
29
+ font-size: 16px;
30
+ margin-horizontal: 7px;
31
+ `;
32
+
33
+ interface Props {
34
+ icon?: any;
35
+ title?: string;
36
+ onClick?: any;
37
+ height?: number;
38
+ isOutline?: boolean;
39
+ disabled?: boolean;
40
+ color?: string;
41
+ bgColor?: string;
42
+ borderColor?: string;
43
+ textColor?: string;
44
+ iconColor?: string;
45
+ style?: ViewStyle;
46
+ iconStyle?: ImageStyle;
47
+ textStyle?: TextStyle;
48
+ disabledColor?: string;
49
+ iconCover?: boolean;
50
+ urlIcon?: any;
51
+ cover?: any;
52
+ }
53
+
54
+ const OIconButton = (props: Props) => {
55
+ const theme = useTheme();
56
+ return (
57
+ <>
58
+ {!props.disabled ? (
59
+ <Wrapper
60
+ onPress={props.onClick}
61
+ style={{
62
+ borderColor: props.borderColor || props.color,
63
+ backgroundColor: props.isOutline
64
+ ? 'white'
65
+ : props.bgColor || props.color,
66
+ height: props.height || 40,
67
+ borderRadius: props.height ? props.height * 0.5 : 20,
68
+ ...props.style,
69
+ }}>
70
+ {props.icon ? (
71
+ <Icon
72
+ source={props.icon}
73
+ style={{
74
+ tintColor: props.iconColor,
75
+ ...props.iconStyle,
76
+ }}
77
+ />
78
+ ) : null}
79
+ {props.title ? (
80
+ <Title
81
+ style={{
82
+ color: props.textColor || props.color,
83
+ ...props.textStyle,
84
+ }}>
85
+ {props.title}
86
+ </Title>
87
+ ) : null}
88
+ </Wrapper>
89
+ ) : (
90
+ <DisabledWrapper
91
+ style={{
92
+ borderColor: theme.colors.backgroundDark,
93
+ backgroundColor: props.disabledColor
94
+ ? props.disabledColor
95
+ : theme.colors.backgroundDark,
96
+ height: props.height || 40,
97
+ borderRadius: props.height ? props.height * 0.5 : 20,
98
+ ...props.style,
99
+ }}>
100
+ {props.icon ? (
101
+ <Icon
102
+ source={props.urlIcon ? { uri: props.icon } : props.icon}
103
+ resizeMode={props.cover ? 'cover' : 'contain'}
104
+ style={{
105
+ tintColor: props.iconColor,
106
+ ...props.iconStyle,
107
+ }}
108
+ />
109
+ ) : null}
110
+ {props.title ? (
111
+ <Title
112
+ style={{
113
+ color: props.textColor || props.color,
114
+ ...props.textStyle,
115
+ }}>
116
+ {props.title}
117
+ </Title>
118
+ ) : null}
119
+ </DisabledWrapper>
120
+ )}
121
+ </>
122
+ );
123
+ };
124
+
125
+ OIconButton.defaultProps = {};
126
+
127
+ export default OIconButton;
@@ -0,0 +1,144 @@
1
+ import * as React from 'react';
2
+ import {
3
+ ImageSourcePropType,
4
+ ImageStyle,
5
+ ViewStyle,
6
+ TextInputProps,
7
+ } from 'react-native';
8
+ import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
9
+ import styled from 'styled-components/native';
10
+ import OIcon from './OIcon';
11
+
12
+ const Wrapper = styled.View`
13
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
14
+ border-radius: ${(props: any) => (props.border ? props.border : '25px')};
15
+ border-width: 1px;
16
+ padding-horizontal: ${(props: any) =>
17
+ props.paddingHorizontal ? props.paddingHorizontal : '16px'};
18
+ height: 50px;
19
+ flex-direction: row;
20
+ align-items: center;
21
+ flex: 1;
22
+ justify-content: center;
23
+ `;
24
+
25
+ const Input = styled.TextInput`
26
+ flex-grow: 1;
27
+ flex: 1;
28
+ min-height: 30px;
29
+ font-size: 15px;
30
+ font-family: 'Poppins-Regular';
31
+ `;
32
+
33
+ interface Props extends TextInputProps {
34
+ bgColor?: string;
35
+ borderColor?: string;
36
+ isRequired?: boolean;
37
+ requiredMsg?: string;
38
+ isDisabled?: boolean;
39
+ isSecured?: boolean;
40
+ style?: ViewStyle;
41
+ placeholder?: string;
42
+ placeholderTextColor?: string;
43
+ icon?: ImageSourcePropType | string;
44
+ iconRight?: ImageSourcePropType;
45
+ iconColor?: string;
46
+ iconRightColor?: string;
47
+ iconStyle?: ImageStyle;
48
+ iconRightStyle?: ImageStyle;
49
+ iconCustomRight?: any;
50
+ value?: string;
51
+ onChange?: any;
52
+ name?: string;
53
+ type?: string;
54
+ multiline?: boolean;
55
+ vertorIcon?: string;
56
+ vectorIconColor?: string;
57
+ forwardRef?: any;
58
+ selectionColor?: string;
59
+ maxLength?: number;
60
+ autoCapitalize?: any;
61
+ autoCompleteType?: any;
62
+ autoCorrect?: any;
63
+ returnKeyType?: any;
64
+ onSubmitEditing?: any;
65
+ blurOnSubmit?: any;
66
+ color?: any;
67
+ }
68
+
69
+ const OInput = (props: Props): React.ReactElement => {
70
+ return (
71
+ <Wrapper
72
+ style={{
73
+ backgroundColor: props.bgColor,
74
+ borderColor: props.borderColor,
75
+ ...props.style,
76
+ }}>
77
+ {props.icon ? (
78
+ <OIcon
79
+ src={props.icon}
80
+ color={props.iconColor}
81
+ width={20}
82
+ height={20}
83
+ style={{ marginRight: 10 }}
84
+ />
85
+ ) : null}
86
+ {props.vertorIcon && (
87
+ <MaterialIcon
88
+ name={props?.vertorIcon}
89
+ size={20}
90
+ color={props?.vectorIconColor}
91
+ style={{ marginHorizontal: 10 }}
92
+ />
93
+ )}
94
+ <Input
95
+ name={props.name}
96
+ secureTextEntry={props.isSecured}
97
+ onChangeText={(txt: any) =>
98
+ props.name
99
+ ? props.onChange({ target: { name: props.name, value: txt } })
100
+ : props.onChange(txt)
101
+ }
102
+ defaultValue={props.value}
103
+ placeholder={props.placeholder ? props.placeholder : ''}
104
+ placeholderTextColor={
105
+ props.placeholderTextColor && props.placeholderTextColor
106
+ }
107
+ keyboardType={props.type || 'default'}
108
+ multiline={props.multiline}
109
+ scrollEnabled={props.multiline}
110
+ editable={!props.isDisabled}
111
+ autoCapitalize={props.autoCapitalize}
112
+ autoCompleteType={props.autoCompleteType}
113
+ autoCorrect={props.autoCorrect}
114
+ returnKeyType={props.returnKeyType}
115
+ onSubmitEditing={props.onSubmitEditing}
116
+ blurOnSubmit={props.blurOnSubmit}
117
+ ref={props.forwardRef}
118
+ selectionColor={props.selectionColor}
119
+ color={props.color}
120
+ maxLength={props.maxLength || 1000}
121
+ />
122
+
123
+ {props.iconRight && (
124
+ <OIcon
125
+ src={props.iconRight}
126
+ color={props.iconRightColor}
127
+ width={20}
128
+ height={20}
129
+ style={{ ...props.iconRightStyle }}
130
+ />
131
+ )}
132
+
133
+ {props.iconCustomRight}
134
+ </Wrapper>
135
+ );
136
+ };
137
+
138
+ OInput.defaultProps = {
139
+ iconColor: '#959595',
140
+ bgColor: 'white',
141
+ borderColor: 'white',
142
+ };
143
+
144
+ export default OInput;
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { Alert, Linking, Pressable, TextStyle } from 'react-native';
3
+ import { useLanguage } from 'ordering-components/native';
4
+ import OText from './OText';
5
+ import OButton from './OButton';
6
+
7
+ interface Props {
8
+ url: string | undefined;
9
+ shorcut: string;
10
+ color?: string;
11
+ PressStyle?: TextStyle;
12
+ TextStyle?: TextStyle;
13
+ type?: string;
14
+ hasButton?: boolean;
15
+ }
16
+
17
+ const OLink = (props: Props): React.ReactElement => {
18
+ const { url, shorcut, color, PressStyle, TextStyle, type, hasButton } = props;
19
+ const [, t] = useLanguage();
20
+
21
+ const handleAlert = () =>
22
+ Alert.alert(
23
+ t('ERROR_OPENING_THE_LINK', 'Error opening the link'),
24
+ t('LINK_UNSUPPORTED', 'Link could not be opened or is not supported'),
25
+ [
26
+ {
27
+ text: t('OK', 'Ok'),
28
+ },
29
+ ],
30
+ );
31
+
32
+ const handleOpenUrl = async (breakFunction = false) => {
33
+ if(breakFunction) {
34
+ return
35
+ }
36
+ if (!url) {
37
+ handleAlert();
38
+ return;
39
+ }
40
+
41
+ try {
42
+ const supported = await Linking.canOpenURL(url);
43
+
44
+ if (supported) {
45
+ await Linking.openURL(url);
46
+ } else {
47
+ handleAlert();
48
+ }
49
+ } catch (err) {
50
+ handleAlert();
51
+ }
52
+ };
53
+
54
+ return (
55
+ <Pressable style={PressStyle} onPress={() => handleOpenUrl(hasButton)}>
56
+ {hasButton ? (
57
+ <OButton
58
+ onClick={() => handleOpenUrl()}
59
+ text={shorcut} imgRightSrc=''
60
+ textStyle={{color: 'white'}}
61
+ style={{width: '100%', alignSelf: 'center', borderRadius: 10}}
62
+ />
63
+ ) : (
64
+ <OText
65
+ style={TextStyle}
66
+ numberOfLines={1}
67
+ ellipsizeMode="tail"
68
+ color={color}>
69
+ {shorcut}
70
+ </OText>
71
+ )}
72
+ </Pressable>
73
+ );
74
+ };
75
+
76
+ export default OLink;
@@ -0,0 +1,275 @@
1
+ import * as React from 'react';
2
+ import { Modal, StyleSheet, SafeAreaView, View } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/Feather';
4
+ import OIcon from './OIcon';
5
+ import OText from './OText';
6
+ import OIconButton from './OIconButton';
7
+ import { useTheme } from 'styled-components/native';
8
+ import { useUtils } from 'ordering-components/native';
9
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
+
11
+ interface Props {
12
+ open?: boolean;
13
+ title?: string;
14
+ children?: any;
15
+ onAccept?: any;
16
+ onCancel?: any;
17
+ onClose?: any;
18
+ style?: any;
19
+ acceptText?: string;
20
+ cancelText?: string;
21
+ isTransparent?: boolean;
22
+ hideCloseDefault?: boolean;
23
+ entireModal?: boolean;
24
+ customClose?: boolean;
25
+ titleSectionStyle?: any;
26
+ isNotDecoration?: boolean;
27
+ styleCloseButton?: any;
28
+ order?: any;
29
+ }
30
+
31
+ const OModal = (props: Props): React.ReactElement => {
32
+ const {
33
+ open,
34
+ title,
35
+ children,
36
+ onAccept,
37
+ onCancel,
38
+ onClose,
39
+ acceptText,
40
+ cancelText,
41
+ isTransparent,
42
+ hideCloseDefault,
43
+ entireModal,
44
+ customClose,
45
+ titleSectionStyle,
46
+ isNotDecoration,
47
+ style,
48
+ styleCloseButton,
49
+ order,
50
+ } = props;
51
+
52
+ const theme = useTheme();
53
+ const [{ optimizeImage }] = useUtils();
54
+ const { top } = useSafeAreaInsets();
55
+
56
+ const styles = StyleSheet.create({
57
+ container: {
58
+ flex: 1,
59
+ },
60
+ centeredView: {
61
+ justifyContent: 'center',
62
+ alignItems: 'center',
63
+ position: 'relative',
64
+ width: '100%',
65
+ },
66
+ titleSection: {
67
+ marginTop: top,
68
+ flexDirection: 'row',
69
+ justifyContent: 'space-between',
70
+ alignItems: 'center',
71
+ paddingHorizontal: 30,
72
+ paddingTop: 30,
73
+ paddingBottom: 25,
74
+ borderBottomWidth: 2,
75
+ borderBottomColor: '#e6e6e6',
76
+ },
77
+ titleGroups: {
78
+ alignItems: 'center',
79
+ flexDirection: 'row',
80
+ minHeight: 33,
81
+ },
82
+ titleIcons: {
83
+ height: 33,
84
+ width: 33,
85
+ borderRadius: 7.6,
86
+ resizeMode: 'stretch',
87
+ },
88
+ shadow: {
89
+ height: 34,
90
+ width: 34,
91
+ alignItems: 'center',
92
+ justifyContent: 'flex-start',
93
+ marginLeft: 15,
94
+ backgroundColor: theme.colors.clear,
95
+ paddingHorizontal: 3,
96
+ borderRadius: 7.6,
97
+ shadowColor: '#000',
98
+ shadowOffset: {
99
+ width: 0,
100
+ height: 2,
101
+ },
102
+ shadowOpacity: 0.25,
103
+ shadowRadius: 3.84,
104
+ elevation: 3,
105
+ },
106
+ cancelBtn: {
107
+ marginRight: 5,
108
+ zIndex: 10000,
109
+ maxWidth: 40,
110
+ height: 25,
111
+ justifyContent: 'flex-end',
112
+ alignItems: 'flex-start',
113
+ },
114
+ modalText: {
115
+ fontFamily: 'Poppins',
116
+ fontStyle: 'normal',
117
+ fontWeight: '600',
118
+ color: theme.colors.textGray,
119
+ zIndex: 10,
120
+ },
121
+ wrapperIcon: {
122
+ overflow: 'hidden',
123
+ borderRadius: 50,
124
+ backgroundColor: '#CCCCCC80',
125
+ width: 35,
126
+ margin: 15,
127
+ },
128
+ modalView: {
129
+ margin: 20,
130
+ backgroundColor: 'white',
131
+ borderRadius: 20,
132
+ padding: 35,
133
+ alignItems: 'center',
134
+ shadowColor: '#000',
135
+ shadowOffset: {
136
+ width: 0,
137
+ height: 2,
138
+ },
139
+ shadowOpacity: 0.25,
140
+ shadowRadius: 4,
141
+ elevation: 5,
142
+ },
143
+ button: {
144
+ borderRadius: 20,
145
+ padding: 10,
146
+ elevation: 2,
147
+ },
148
+ buttonOpen: {
149
+ backgroundColor: '#F194FF',
150
+ },
151
+ buttonClose: {
152
+ backgroundColor: '#2196F3',
153
+ },
154
+ textStyle: {
155
+ color: 'white',
156
+ fontWeight: '600',
157
+ textAlign: 'center',
158
+ },
159
+ });
160
+
161
+ return (
162
+ <SafeAreaView style={styles.container}>
163
+ <Modal
164
+ animationType="slide"
165
+ transparent={isTransparent}
166
+ visible={open}
167
+ onRequestClose={() => {
168
+ onClose();
169
+ }}
170
+ style={{
171
+ height: '100%',
172
+ flex: 1,
173
+ position: 'absolute',
174
+ ...style,
175
+ zIndex: 9999,
176
+ }}>
177
+ {!entireModal ? (
178
+ <View style={styles.centeredView}>
179
+ <View
180
+ style={
181
+ titleSectionStyle ? titleSectionStyle : styles.titleSection
182
+ }>
183
+ <View style={styles.wrapperIcon}>
184
+ <Icon
185
+ name="x"
186
+ size={35}
187
+ style={
188
+ isNotDecoration && (styleCloseButton || styles.cancelBtn)
189
+ }
190
+ onPress={onClose}
191
+ />
192
+ </View>
193
+
194
+ <OText size={20} style={styles.modalText} adjustsFontSizeToFit>
195
+ {title}
196
+ </OText>
197
+ </View>
198
+
199
+ {children}
200
+ </View>
201
+ ) : (
202
+ <>
203
+ {!customClose && (
204
+ <View style={styles.titleSection}>
205
+ <View style={styles.titleGroups}>
206
+ <OIconButton
207
+ icon={theme.images.general.arrow_left}
208
+ iconStyle={{ width: 20, height: 20 }}
209
+ borderColor={theme.colors.clear}
210
+ style={styleCloseButton || styles.cancelBtn}
211
+ onClick={onClose}
212
+ />
213
+
214
+ <OText
215
+ size={16}
216
+ style={styles.modalText}
217
+ adjustsFontSizeToFit>
218
+ {title}
219
+ </OText>
220
+ </View>
221
+
222
+ <View style={styles.titleGroups}>
223
+ <View style={styles.shadow}>
224
+ {order?.business?.logo ? (
225
+ <OIcon
226
+ url={optimizeImage(
227
+ order?.business?.logo,
228
+ 'h_300,c_limit',
229
+ )}
230
+ style={styles.titleIcons}
231
+ />
232
+ ) : (
233
+ <OIcon
234
+ src={theme.images.dummies.businessLogo}
235
+ style={styles.titleIcons}
236
+ />
237
+ )}
238
+ </View>
239
+
240
+ <View style={styles.shadow}>
241
+ <OIcon
242
+ url={optimizeImage(
243
+ order?.customer?.photo ||
244
+ theme?.images?.dummies?.customerPhoto,
245
+ 'h_300,c_limit',
246
+ )}
247
+ style={styles.titleIcons}
248
+ />
249
+ </View>
250
+
251
+ {order?.driver && (
252
+ <View style={styles.shadow}>
253
+ <OIcon
254
+ url={
255
+ optimizeImage(
256
+ order?.driver?.photo,
257
+ 'h_300,c_limit',
258
+ ) || theme?.images?.dummies?.driverPhoto
259
+ }
260
+ style={styles.titleIcons}
261
+ />
262
+ </View>
263
+ )}
264
+ </View>
265
+ </View>
266
+ )}
267
+ {children}
268
+ </>
269
+ )}
270
+ </Modal>
271
+ </SafeAreaView>
272
+ );
273
+ };
274
+
275
+ export default OModal;
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { TouchableOpacity } from 'react-native-gesture-handler';
3
+ import styled from 'styled-components/native';
4
+ import { normalize } from '../../providers/Responsive';
5
+ import { useTheme } from 'styled-components/native';
6
+
7
+ const Wrapper = styled.View`
8
+ background-color: white;
9
+ flex-direction: row;
10
+ justify-content: space-between;
11
+ `;
12
+ const SegItem = styled.View`
13
+ background-color: grey;
14
+ padding: 8px 8px;
15
+ flex-direction: row;
16
+ align-items: center;
17
+ border-radius: 18px;
18
+ `;
19
+ const ItemIcon = styled.Image`
20
+ resize-mode: contain;
21
+ margin-right: 5px;
22
+ width: 14px;
23
+ height: 14px;
24
+ `;
25
+ const ItemLabel = styled.Text`
26
+ font-family: 'Poppins-Regular';
27
+ `;
28
+
29
+ // Props for component
30
+
31
+ interface ItemProps {
32
+ text?: string;
33
+ image?: any;
34
+ }
35
+ interface Props {
36
+ items: Array<ItemProps>;
37
+ background?: string;
38
+ labelStyle?: string;
39
+ selectedIdx?: number;
40
+ onSelectItem?: any;
41
+ }
42
+
43
+ const OSegment = (props: Props) => {
44
+ var [curIndex, onSelected] = React.useState(props.selectedIdx);
45
+ const onSelectItem = (idx: number) => {
46
+ onSelected(idx);
47
+ props.onSelectItem(idx);
48
+ };
49
+ const theme = useTheme();
50
+ return (
51
+ <Wrapper>
52
+ {props.items.map((item, index) => (
53
+ <TouchableOpacity
54
+ key={`SegmentItem_${index}`}
55
+ onPress={() => onSelectItem(index)}>
56
+ <SegItem
57
+ style={{
58
+ backgroundColor:
59
+ index == curIndex ? theme.colors.primary : 'white',
60
+ }}>
61
+ <ItemIcon
62
+ source={item.image}
63
+ style={{
64
+ tintColor: index == curIndex ? 'white' : '#ADADAD',
65
+ }}></ItemIcon>
66
+ <ItemLabel
67
+ style={{
68
+ fontSize: normalize(8.8),
69
+ color: index == curIndex ? 'white' : '#ADADAD',
70
+ }}>
71
+ {props.labelStyle == 'uppercase'
72
+ ? item.text?.toUpperCase()
73
+ : item.text}
74
+ </ItemLabel>
75
+ </SegItem>
76
+ </TouchableOpacity>
77
+ ))}
78
+ </Wrapper>
79
+ );
80
+ };
81
+
82
+ OSegment.defaultProps = {
83
+ labelStyle: 'uppercase',
84
+ };
85
+
86
+ export default OSegment;