-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patched animation loop to fix issue with detox testing
- Loading branch information
1 parent
8fd762f
commit 52fb659
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
VAMobile/patches/@department-of-veterans-affairs+mobile-component-library+0.27.1.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
diff --git a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/LoadingIndicator/LoadingIndicator.tsx b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/LoadingIndicator/LoadingIndicator.tsx | ||
index dabf3c6..a0c31be 100644 | ||
--- a/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/LoadingIndicator/LoadingIndicator.tsx | ||
+++ b/node_modules/@department-of-veterans-affairs/mobile-component-library/src/components/LoadingIndicator/LoadingIndicator.tsx | ||
@@ -6,7 +6,7 @@ import { | ||
View, | ||
ViewStyle, | ||
} from 'react-native' | ||
-import React, { useEffect } from 'react' | ||
+import React, { useEffect, useRef } from 'react' | ||
|
||
import { Icon, IconProps } from '../Icon/Icon' | ||
import { Spacer } from '../Spacer/Spacer' | ||
@@ -36,19 +36,17 @@ export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({ | ||
children, | ||
}) => { | ||
const theme = useTheme() | ||
- const rotation = new Animated.Value(0) | ||
+ const rotation = useRef(new Animated.Value(0)).current | ||
|
||
useEffect(() => { | ||
- const animate = () => { | ||
- rotation.setValue(0) // Reset the rotation value to 0 | ||
- Animated.timing(rotation, { | ||
- toValue: 1, | ||
- duration: 1500, | ||
- easing: Easing.linear, | ||
- useNativeDriver: true, | ||
- }).start(() => animate()) // Loop the animation | ||
- } | ||
- animate() | ||
+ const animation = Animated.loop(Animated.timing(rotation, { | ||
+ toValue: 1, | ||
+ duration: 1500, | ||
+ easing: Easing.linear, | ||
+ useNativeDriver: true, | ||
+ })) | ||
+ animation.start() // Loop the animation | ||
+ return () => animation.stop() // Cleanup animation when component unmounts | ||
}, [rotation]) | ||
|
||
const rotate = rotation.interpolate({ |