ordering-ui-react-native 0.23.19 → 0.23.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.23.19",
3
+ "version": "0.23.21",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -168,28 +168,38 @@ const NewOrderNotificationUI = (props: any) => {
168
168
  }
169
169
 
170
170
  useEffect(() => {
171
+ const handleEventTypeOne = (o: any) => {
172
+ handleEventNotification(1, o, orderStatus)
173
+ }
174
+ const handleEventTypeTwo = (o: any) => {
175
+ handleEventNotification(2, o, orderStatus)
176
+ }
177
+ const handleEventTypeThree = (o: any) => {
178
+ handleEventNotification(3, o, orderStatus)
179
+ }
180
+
171
181
  if (!events?._events?.message_added_notification || events?._events?.message_added_notification?.length < 2) {
172
- events.on('message_added_notification', (o: any) => handleEventNotification(1, o, orderStatus))
182
+ events.on('message_added_notification', handleEventTypeOne)
173
183
  }
174
184
  if (!events?._events?.order_added_notification || events?._events?.order_added_notification?.length < 2) {
175
- events.on('order_added_notification', (o: any) => handleEventNotification(2, o, orderStatus))
185
+ events.on('order_added_notification', handleEventTypeTwo)
176
186
  }
177
187
  if (!events?._events?.order_updated_notification || events?._events?.order_updated_notification?.length < 2) {
178
- events.on('order_updated_notification', (o: any) => handleEventNotification(3, o, orderStatus))
188
+ events.on('order_updated_notification', handleEventTypeThree)
179
189
  }
180
190
  if (!events?._events?.request_register_notification || events?._events?.request_register_notification?.length < 2) {
181
- events.on('request_register_notification', (o: any) => handleEventNotification(2, o, orderStatus))
191
+ events.on('request_register_notification', handleEventTypeTwo)
182
192
  }
183
193
  if (!events?._events?.request_update_notification || events?._events?.request_update_notification?.length < 2) {
184
- events.on('request_update_notification', (o: any) => handleEventNotification(3, o, orderStatus))
194
+ events.on('request_update_notification', handleEventTypeThree)
185
195
  }
186
196
 
187
197
  return () => {
188
- events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
189
- events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
190
- events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
191
- events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
192
- events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
198
+ events.off('message_added_notification', handleEventTypeOne)
199
+ events.off('order_added_notification', handleEventTypeTwo)
200
+ events.off('order_updated_notification', handleEventTypeThree)
201
+ events.off('request_register_notification', handleEventTypeTwo)
202
+ events.off('request_update_notification', handleEventTypeThree)
193
203
  }
194
204
  }, [orderStatus, events])
195
205
 
@@ -61,8 +61,8 @@ export const OrderItem = React.memo((props: any) => {
61
61
  const styles = StyleSheet.create({
62
62
  cardButton: {
63
63
  flex: 1,
64
- paddingVertical: (isIpad || isTablet) ? 20 : 5,
65
- marginBottom: IS_PORTRAIT ? 25 : 0,
64
+ paddingVertical: (isIpad || isTablet) ? 20 : 15,
65
+ marginBottom: IS_PORTRAIT ? 15 : 0,
66
66
  marginLeft: 3,
67
67
  backgroundColor: order?.time_status === 'delayed'
68
68
  ? theme.colors.danger100
@@ -1047,6 +1047,7 @@ const CheckoutUI = (props: any) => {
1047
1047
  <OModal
1048
1048
  open={isOpen}
1049
1049
  onClose={() => setIsOpen(false)}
1050
+ showToastInsideModal
1050
1051
  >
1051
1052
  <View style={styles.detailWrapper}>
1052
1053
  <UserDetails
@@ -123,7 +123,7 @@ export const UserFormDetailsUI = (props: any) => {
123
123
  };
124
124
  if (field.code && field.code === 'email') {
125
125
  rules.pattern = {
126
- value: /[&,()%";:ç?<>{}\\[\]\s]/g,
126
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
127
127
  message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace(
128
128
  '_attribute_',
129
129
  t('EMAIL', 'Email'),
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { Modal, StyleSheet, Text, SafeAreaView, View, TouchableOpacity, Platform } from "react-native";
3
3
  import styled from 'styled-components/native';
4
4
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
-
5
+ import { Toast } from '../../../../../src/components/shared/OToast'
6
6
  interface Props {
7
7
  open?: boolean;
8
8
  title?: string;
@@ -22,6 +22,7 @@ interface Props {
22
22
  styleCloseButton?: any,
23
23
  isAvoidKeyBoardView?: boolean;
24
24
  styleContainerCloseButton?: any;
25
+ showToastInsideModal?: boolean;
25
26
  }
26
27
  const KeyboardView = styled.KeyboardAvoidingView`
27
28
  flex-grow: 1;
@@ -47,7 +48,8 @@ const OModal = (props: Props): React.ReactElement => {
47
48
  style,
48
49
  styleCloseButton,
49
50
  styleContainerCloseButton,
50
- isAvoidKeyBoardView
51
+ isAvoidKeyBoardView,
52
+ showToastInsideModal
51
53
  } = props
52
54
 
53
55
  const renderSafeAreaView = () => (
@@ -94,6 +96,9 @@ const OModal = (props: Props): React.ReactElement => {
94
96
  onRequestClose={() => onClose && onClose()}
95
97
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
96
98
  >
99
+ {showToastInsideModal && (
100
+ <Toast />
101
+ )}
97
102
  {isAvoidKeyBoardView ? (
98
103
  <KeyboardView
99
104
  enabled