Files
mobile-darmasaba/components/progressBar.tsx
amel b4c560b88e upd: home
Deskripsi:
- update progress pada kegiatan terupdate home

No Issues
2025-04-29 10:40:34 +08:00

31 lines
772 B
TypeScript

import Styles from "@/constants/Styles";
import { useEffect, useState } from "react";
import { Animated, View } from "react-native";
type Props = {
margin?: number
value: number
}
export default function ProgressBar({ margin, value }: Props) {
const [progress, setProgress] = useState(new Animated.Value(0));
useEffect(() => {
Animated.timing(progress, {
// 100% = 255
toValue: value / 100 * 255,
duration: 1000,
useNativeDriver: false
}).start();
}, []);
return (
<View style={[Styles.contentItemCenter]}>
<View style={[Styles.wrapBar, { margin: margin && margin }]}>
<Animated.View style={[Styles.contentBar, { width: progress }]} />
</View>
</View>
)
}