ordering-ui-react-native 0.23.64 → 0.23.66

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.64",
3
+ "version": "0.23.66",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity, Animated, Easing } from 'react-native';
3
3
  import { useLanguage, useUtils, OrderListGroups, useConfig } from 'ordering-components/native';
4
4
  import SelectDropdown from 'react-native-select-dropdown'
5
5
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
@@ -139,6 +139,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
139
139
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
140
140
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
141
141
  const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
142
+ const AnimatedFeatherIcon = Animated.createAnimatedComponent(FeatherIcon);
143
+ const spinValue = new Animated.Value(0);
142
144
 
143
145
  const preorderTypeList = [
144
146
  { key: null, name: t('SLA', 'SLA\'s') },
@@ -468,6 +470,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
468
470
  }
469
471
  }, [isNetConnected, JSON.stringify(offlineActionsState.orders)]);
470
472
 
473
+
474
+ const handleInitAnimation = () => {
475
+ Animated.timing(
476
+ spinValue,
477
+ {
478
+ toValue: 1,
479
+ duration: 2000,
480
+ easing: Easing.linear,
481
+ useNativeDriver: true
482
+ }
483
+ ).start()
484
+ }
485
+
486
+ useEffect(() => {
487
+ if (currentOrdersGroup?.loading || logisticOrders?.loading){
488
+ handleInitAnimation()
489
+ }
490
+ }, [currentOrdersGroup?.loading, logisticOrders?.loading])
491
+
471
492
  return (
472
493
  <>
473
494
  <View style={styles.header}>
@@ -477,12 +498,20 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
477
498
  <WebsocketStatus />
478
499
  </View>
479
500
  {isNetConnected && (
480
- <FeatherIcon
501
+ <AnimatedFeatherIcon
481
502
  name='refresh-cw'
482
503
  color={theme.colors.backgroundDark}
483
504
  size={24}
484
- onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
485
- style={{ marginRight: 20 }}
505
+ onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })}
506
+ style={{
507
+ marginRight: 20,
508
+ transform: [{
509
+ rotate: spinValue.interpolate({
510
+ inputRange: [0, 0.3],
511
+ outputRange: ['0deg', '360deg'],
512
+ })
513
+ }]
514
+ }}
486
515
  />
487
516
  )}
488
517
  <FontistoIcon
@@ -85,7 +85,7 @@ export const UserFormDetailsUI = (props: any) => {
85
85
  const [, { showToast }] = useToast();
86
86
  const { handleSubmit, control, errors, setValue } = useForm();
87
87
 
88
- const [{ user }, { login }] = useSession();
88
+ const [{ user }, { login, logout }] = useSession();
89
89
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
90
90
  const [isValid, setIsValid] = useState(false)
91
91
  const [isChanged, setIsChanged] = useState(false)
@@ -247,9 +247,12 @@ export const UserFormDetailsUI = (props: any) => {
247
247
  open: true,
248
248
  content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
249
249
  title: t('ACCOUNT_ALERT', 'Account alert'),
250
- handleOnAccept: () => {
250
+ handleOnAccept: async () => {
251
251
  setConfirm({ ...confirm, open: false })
252
- handleRemoveAccount && handleRemoveAccount(user?.id)
252
+ const response = await handleRemoveAccount?.(user?.id)
253
+ if (response === 'OK'){
254
+ logout()
255
+ }
253
256
  }
254
257
  })
255
258
  }
@@ -355,7 +358,7 @@ export const UserFormDetailsUI = (props: any) => {
355
358
  isDisabled={false}
356
359
  value={
357
360
  formState?.changes[field.code] ??
358
- (user && user?.guest_id && field.code === 'email' ? user?.guest_email : user[field.code]) ??
361
+ (user && user?.guest_id && field.code === 'email' ? user?.guest_email : user?.[field.code]) ??
359
362
  ''
360
363
  }
361
364
  onChange={(val: any) => {
@@ -399,7 +402,7 @@ export const UserFormDetailsUI = (props: any) => {
399
402
  )}
400
403
  name={field.code}
401
404
  rules={getInputRules(field)}
402
- defaultValue={user && (field.code === 'email' && user?.guest_id ? user?.guest_email : user[field.code])}
405
+ defaultValue={user && (field.code === 'email' && user?.guest_id ? user?.guest_email : user?.[field.code])}
403
406
  />
404
407
  </React.Fragment>
405
408
  ))