UNPKG

react-native-reanimated-progress-bar

Version:

React Native animated progress bar, using react-native-reanimated

15 lines 551 B
import { useEffect, useState } from "react"; import Animated, { EasingNode } from "react-native-reanimated"; const { Value, timing } = Animated; export default function useAnimatedProgress(width, percent) { const [translateX] = useState(new Value(0)); useEffect(() => { timing(translateX, { toValue: width * percent, duration: 200, easing: EasingNode.inOut(EasingNode.ease) }).start(); }, [percent, width]); return translateX; } //# sourceMappingURL=useAnimatedProgress.native.js.map