From 618a19d0968eeb1a74ec71d0dfd6384524317e29 Mon Sep 17 00:00:00 2001 From: Dave Formanek <184258725+oddballdave@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:40:00 -0700 Subject: [PATCH 1/4] Removed repetitive animations in favor of a loop and provided cleanup function to stop the animation --- .../LoadingIndicator/LoadingIndicator.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx b/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx index 1ab6b1fa..1e26f7a1 100644 --- a/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx +++ b/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx @@ -1,10 +1,11 @@ import { Animated, Easing, 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' import { Text } from '../Text/Text' import { useTheme } from '../../utils' +import { isAndroid, isIOS } from '../../utils/OSfunctions' export type LoadingIndicatorProps = { /** AccessibilityLabel for the text */ @@ -30,19 +31,19 @@ export const LoadingIndicator: React.FC = ({ 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 + const animation = Animated.loop( Animated.timing(rotation, { toValue: 1, duration: 1500, easing: Easing.linear, - useNativeDriver: true, - }).start(() => animate()) // Loop the animation - } - animate() + useNativeDriver: isAndroid() || isIOS(), + }), + ) + animation.start() // Loop the animation + return () => animation.stop() // Cleanup animation when component unmounts }, [rotation]) const rotate = rotation.interpolate({ From 03f59a48b9fc77fd189546a3f9480552e7d403fe Mon Sep 17 00:00:00 2001 From: Dave Formanek <184258725+oddballdave@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:47:23 -0700 Subject: [PATCH 2/4] Fix lint issue --- .../src/components/LoadingIndicator/LoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx b/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx index 1e26f7a1..7a2fe4cc 100644 --- a/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx +++ b/packages/components/src/components/LoadingIndicator/LoadingIndicator.tsx @@ -4,8 +4,8 @@ import React, { useEffect, useRef } from 'react' import { Icon, IconProps } from '../Icon/Icon' import { Spacer } from '../Spacer/Spacer' import { Text } from '../Text/Text' -import { useTheme } from '../../utils' import { isAndroid, isIOS } from '../../utils/OSfunctions' +import { useTheme } from '../../utils' export type LoadingIndicatorProps = { /** AccessibilityLabel for the text */ From 2c0e1c687e6ef85e7e4584f26f625882a9a12896 Mon Sep 17 00:00:00 2001 From: VA Automation Bot Date: Thu, 9 Jan 2025 19:55:27 +0000 Subject: [PATCH 3/4] Version bump: components-v0.30.1-alpha.1 --- packages/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/package.json b/packages/components/package.json index fa1473ac..85e57ed2 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@department-of-veterans-affairs/mobile-component-library", - "version": "0.30.0", + "version": "0.30.1-alpha.1", "description": "VA Design System Mobile Component Library", "main": "src/index.tsx", "scripts": { From b01fb301b2abe96be740303d881dbcf52ba07166 Mon Sep 17 00:00:00 2001 From: Dave Formanek <184258725+oddballdave@users.noreply.github.com> Date: Mon, 17 Feb 2025 08:25:54 -0700 Subject: [PATCH 4/4] Update package.json --- packages/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/package.json b/packages/components/package.json index 85e57ed2..fa1473ac 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@department-of-veterans-affairs/mobile-component-library", - "version": "0.30.1-alpha.1", + "version": "0.30.0", "description": "VA Design System Mobile Component Library", "main": "src/index.tsx", "scripts": {