@@ -3,11 +3,11 @@ import type {AnimationObject, LottieViewProps} from 'lottie-react-native';
33import LottieView from 'lottie-react-native' ;
44import React , { useContext , useEffect , useRef , useState } from 'react' ;
55import { InteractionManager , View } from 'react-native' ;
6- import { useReducedMotion } from 'react-native-reanimated' ;
76import type DotLottieAnimation from '@components/LottieAnimations/types' ;
87import useAppState from '@hooks/useAppState' ;
98import useNetwork from '@hooks/useNetwork' ;
109import useThemeStyles from '@hooks/useThemeStyles' ;
10+ import Accessibility from '@libs/Accessibility' ;
1111import { getBrowser , isMobile } from '@libs/Browser' ;
1212import isSideModalNavigator from '@libs/Navigation/helpers/isSideModalNavigator' ;
1313import CONST from '@src/CONST' ;
@@ -24,7 +24,7 @@ function Lottie({source, webStyle, shouldLoadAfterInteractions, ...props}: Props
2424 const { splashScreenState} = useSplashScreenState ( ) ;
2525 const styles = useThemeStyles ( ) ;
2626 const [ isError , setIsError ] = React . useState ( false ) ;
27- const isReducedMotionEnabled = useReducedMotion ( ) ;
27+ const isReduceMotionEnabled = Accessibility . useReducedMotion ( ) ;
2828
2929 useNetwork ( { onReconnect : ( ) => setIsError ( false ) } ) ;
3030
@@ -64,12 +64,12 @@ function Lottie({source, webStyle, shouldLoadAfterInteractions, ...props}: Props
6464 }
6565 const unsubscribeNavigationFocus = navigator . addListener ( 'focus' , ( ) => {
6666 setHasNavigatedAway ( false ) ;
67- if ( ! isReducedMotionEnabled ) {
67+ if ( ! isReduceMotionEnabled ) {
6868 animationRef . current ?. play ( ) ;
6969 }
7070 } ) ;
7171 return unsubscribeNavigationFocus ;
72- } , [ browser , navigationContainerRef , navigator , isReducedMotionEnabled ] ) ;
72+ } , [ browser , navigationContainerRef , navigator , isReduceMotionEnabled ] ) ;
7373
7474 useEffect ( ( ) => {
7575 if ( ! browser || ! navigationContainerRef || ! navigator ) {
@@ -118,13 +118,12 @@ function Lottie({source, webStyle, shouldLoadAfterInteractions, ...props}: Props
118118 < LottieView
119119 // eslint-disable-next-line react/jsx-props-no-spreading
120120 { ...props }
121- autoPlay = { isReducedMotionEnabled ? false : props . autoPlay }
122- loop = { isReducedMotionEnabled ? false : props . loop }
123121 source = { animationFile }
124122 key = { `${ hasNavigatedAway } ` }
125123 ref = { ( newRef ) => {
126124 animationRef . current = newRef ;
127125 } }
126+ autoPlay = { ! isReduceMotionEnabled }
128127 style = { [ aspectRatioStyle , props . style ] }
129128 webStyle = { { ...aspectRatioStyle , ...webStyle } }
130129 onAnimationFailure = { ( ) => setIsError ( true ) }
0 commit comments