To drive an animation using a Reanimated SharedValue (e.g., for scrubbing or custom easing), pass a progress shared value (from 0 to 1) to the Skottie component.
Note: When using the progress prop, neither the autoPlay prop nor the imperative ref API will work; you are responsible for controlling the animation state via the shared value.
To determine the animation duration for your Reanimated timing, use SkottieAPI.createFrom(source) to create a SkSkottie instance.
import { Skottie, SkottieAPI } from 'react-native-skottie';
import { useSharedValue, withTiming, Easing } from 'react-native-reanimated';
import { useMemo, useEffect } from 'react';
export default function App() {
const progress = useSharedValue(0);
const lottieFile = require('./animation.json');
// Get duration from the Skottie instance
const skottieAnimation = useMemo(() => SkottieAPI.createFrom(lottieFile), []);
const duration = skottieAnimation.duration;
useEffect(() => {
progress.value = withTiming(1, {
duration: duration * 1000,
easing: Easing.linear,
});
}, [duration]);
return (
<Skottie
autoPlay={true}
style={styles.flex1}
source={lottieFile}
progress={progress}
/>
);
}