ordering-ui-react-native 0.22.20 → 0.22.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.22.20",
3
+ "version": "0.22.21",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -109,21 +109,16 @@ const SoundPlayerComponent = (props: any) => {
109
109
  }
110
110
 
111
111
  const NewOrderNotificationUI = (props: any) => {
112
- const { isBusinessApp, evtList } = props
112
+ const { isBusinessApp, evtList, orderStatus } = props
113
113
  const [, t] = useLanguage()
114
114
  const [events] = useEvent()
115
115
  const [{ user, token }] = useSession()
116
116
  const [ordering] = useApi()
117
- const [{ configs }] = useConfig()
118
117
  const [, { showToast }] = useToast()
119
118
  const { getCurrentLocation } = useLocation()
120
119
  const [currentEvent, setCurrentEvent] = useState<any>(null)
121
120
 
122
- const orderStatus = !!isBusinessApp
123
- ? configs?.notification_business_states?.value.split('|').map((value: any) => Number(value)) || []
124
- : configs?.notification_driver_states?.value.split('|').map((value: any) => Number(value)) || []
125
-
126
- const handleEventNotification = async (evtType: number, value: any) => {
121
+ const handleEventNotification = async (evtType: number, value: any, orderStatus?: any) => {
127
122
  if (value?.driver) {
128
123
  try {
129
124
  const location = await getCurrentLocation()
@@ -165,11 +160,11 @@ const NewOrderNotificationUI = (props: any) => {
165
160
  }
166
161
 
167
162
  useEffect(() => {
168
- events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
169
- events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
170
- events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
171
- events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
172
- events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
163
+ events.on('message_added_notification', (o: any) => handleEventNotification(1, o, orderStatus))
164
+ events.on('order_added_notification', (o: any) => handleEventNotification(2, o, orderStatus))
165
+ events.on('order_updated_notification', (o: any) => handleEventNotification(3, o, orderStatus))
166
+ events.on('request_register_notification', (o: any) => handleEventNotification(2, o, orderStatus))
167
+ events.on('request_update_notification', (o: any) => handleEventNotification(3, o, orderStatus))
173
168
 
174
169
  return () => {
175
170
  events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
@@ -178,7 +173,7 @@ const NewOrderNotificationUI = (props: any) => {
178
173
  events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
179
174
  events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
180
175
  }
181
- }, [])
176
+ }, [orderStatus])
182
177
 
183
178
  useEffect(() => {
184
179
  return () => setCurrentEvent(null)
@@ -186,13 +181,13 @@ const NewOrderNotificationUI = (props: any) => {
186
181
 
187
182
  return (
188
183
  <>
189
- {!!currentEvent ? (
184
+ {!!currentEvent && (
190
185
  <SoundPlayerComponent
191
186
  evtList={evtList}
192
187
  currentEvent={currentEvent}
193
188
  handleCloseEvents={() => setCurrentEvent(null)}
194
189
  />
195
- ) : null}
190
+ )}
196
191
  </>
197
192
  )
198
193
  };
@@ -309,7 +309,7 @@ export const BusinessControllerUI = React.memo((props: BusinessControllerParams)
309
309
  </ReviewAndFavorite>
310
310
  )}
311
311
  </View>
312
- <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={2}>
312
+ <OText size={textSize} style={{ lineHeight: 15, marginBottom: 3, fontFamily: undefined }} numberOfLines={1}>
313
313
  {business?.address}
314
314
  </OText>
315
315
  <Metadata>