upd: home

Deskripsi:
- update progress pada kegiatan terupdate home

No Issues
This commit is contained in:
amel
2025-04-29 10:40:34 +08:00
parent c504d184b9
commit b4c560b88e
2 changed files with 9 additions and 6 deletions

View File

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