upd: home
Deskripsi: - update progress pada kegiatan terupdate home No Issues
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user