ordering-ui-react-native 0.22.80 → 0.22.81

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.22.80",
3
+ "version": "0.22.81",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -168,11 +168,21 @@ const NewOrderNotificationUI = (props: any) => {
168
168
  }
169
169
 
170
170
  useEffect(() => {
171
- events.on('message_added_notification', (o: any) => handleEventNotification(1, o, orderStatus))
172
- events.on('order_added_notification', (o: any) => handleEventNotification(2, o, orderStatus))
173
- events.on('order_updated_notification', (o: any) => handleEventNotification(3, o, orderStatus))
174
- events.on('request_register_notification', (o: any) => handleEventNotification(2, o, orderStatus))
175
- events.on('request_update_notification', (o: any) => handleEventNotification(3, o, orderStatus))
171
+ 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))
173
+ }
174
+ 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))
176
+ }
177
+ 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))
179
+ }
180
+ 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))
182
+ }
183
+ 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))
185
+ }
176
186
 
177
187
  return () => {
178
188
  events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
@@ -181,7 +191,7 @@ const NewOrderNotificationUI = (props: any) => {
181
191
  events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
182
192
  events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
183
193
  }
184
- }, [orderStatus])
194
+ }, [orderStatus, events])
185
195
 
186
196
  useEffect(() => {
187
197
  return () => setCurrentEvent(null)