@umituz/react-native-design-system 4.25.49 → 4.25.50
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": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.50",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -30,6 +30,9 @@ export const LoadingProvider: React.FC<LoadingProviderProps> = ({
|
|
|
30
30
|
const [showFetchLoading, dispatch] = useReducer(loadingReducer, false);
|
|
31
31
|
const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
32
32
|
const showTimeRef = useRef<number>(0);
|
|
33
|
+
// Use a ref to read showFetchLoading inside the effect without adding it to deps
|
|
34
|
+
const showFetchLoadingRef = useRef(showFetchLoading);
|
|
35
|
+
showFetchLoadingRef.current = showFetchLoading;
|
|
33
36
|
|
|
34
37
|
useEffect(() => {
|
|
35
38
|
if (!detectFetching) return;
|
|
@@ -41,7 +44,7 @@ export const LoadingProvider: React.FC<LoadingProviderProps> = ({
|
|
|
41
44
|
}
|
|
42
45
|
showTimeRef.current = Date.now();
|
|
43
46
|
dispatch({ type: 'SHOW' });
|
|
44
|
-
} else if (
|
|
47
|
+
} else if (showFetchLoadingRef.current) {
|
|
45
48
|
const elapsed = Date.now() - showTimeRef.current;
|
|
46
49
|
const remaining = Math.max(0, minDisplayTime - elapsed);
|
|
47
50
|
|
|
@@ -56,7 +59,7 @@ export const LoadingProvider: React.FC<LoadingProviderProps> = ({
|
|
|
56
59
|
clearTimeout(hideTimeoutRef.current);
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
|
-
}, [isFetching, detectFetching, minDisplayTime
|
|
62
|
+
}, [isFetching, detectFetching, minDisplayTime]); // showFetchLoading read via ref to avoid circular dep
|
|
60
63
|
|
|
61
64
|
return (
|
|
62
65
|
<>
|