ordering-ui-react-native 0.22.27-release → 0.22.28-release

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.27-release",
3
+ "version": "0.22.28-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
- import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity } from 'react-native';
3
- import { useLanguage, useUtils, useToast, OrderListGroups, useConfig } from 'ordering-components/native';
2
+ import { View, Pressable, StyleSheet, ScrollView, RefreshControl, Platform, TouchableOpacity, Animated, Easing } from 'react-native';
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';
6
6
  import FeatherIcon from 'react-native-vector-icons/Feather';
@@ -137,6 +137,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
137
137
  const HEIGHT_SCREEN = orientationState?.dimensions?.height
138
138
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
139
139
  const showTagsList = !props.isAlsea && !props.isDriverApp && currentTabSelected !== 'logisticOrders'
140
+ const AnimatedFeatherIcon = Animated.createAnimatedComponent(FeatherIcon);
141
+ const spinValue = new Animated.Value(0);
140
142
 
141
143
  const preorderTypeList = [
142
144
  { key: null, name: t('SLA', 'SLA\'s') },
@@ -457,6 +459,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
457
459
  }
458
460
  }, [isNetConnected]);
459
461
 
462
+
463
+ const handleInitAnimation = () => {
464
+ Animated.timing(
465
+ spinValue,
466
+ {
467
+ toValue: 1,
468
+ duration: 2000,
469
+ easing: Easing.linear,
470
+ useNativeDriver: true
471
+ }
472
+ ).start()
473
+ }
474
+
475
+ useEffect(() => {
476
+ if (currentOrdersGroup?.loading || logisticOrders?.loading) {
477
+ handleInitAnimation()
478
+ }
479
+ }, [currentOrdersGroup?.loading, logisticOrders?.loading])
480
+
460
481
  return (
461
482
  <>
462
483
  <View style={styles.header}>
@@ -466,12 +487,20 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
466
487
  <WebsocketStatus />
467
488
  </View>
468
489
  {isNetConnected && (
469
- <FeatherIcon
490
+ <AnimatedFeatherIcon
470
491
  name='refresh-cw'
471
492
  color={theme.colors.backgroundDark}
472
493
  size={24}
473
- onPress={() => { currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true }) }}
474
- style={{ marginRight: 20 }}
494
+ onPress={() => currentTabSelected === 'logisticOrders' ? loadLogisticOrders && loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })}
495
+ style={{
496
+ marginRight: 20,
497
+ transform: [{
498
+ rotate: spinValue.interpolate({
499
+ inputRange: [0, 0.3],
500
+ outputRange: ['0deg', '360deg'],
501
+ })
502
+ }]
503
+ }}
475
504
  />
476
505
  )}
477
506
  <FontistoIcon