first commit

This commit is contained in:
rohit-kumar-fullstack
2026-01-02 17:56:16 +05:30
parent b94f98a764
commit 59fb7e0df4
149 changed files with 9362 additions and 12549 deletions
+45
View File
@@ -0,0 +1,45 @@
import React, { useEffect, useRef, useState } from 'react';
import { View, Text, Animated, StyleSheet } from 'react-native';
import colors from '../../Constant/Color';
const Counter = ({ toValue = 1000, duration = 2000 }) => {
const animatedValue = useRef(new Animated.Value(0)).current;
const [displayValue, setDisplayValue] = useState(0);
useEffect(() => {
Animated.timing(animatedValue, {
toValue,
duration,
useNativeDriver: false,
}).start();
const listener = animatedValue.addListener(({ value }) => {
setDisplayValue(Math.floor(value));
});
return () => {
animatedValue.removeListener(listener);
};
}, [toValue]);
return (
<View style={styles.container}>
<Text style={styles.counterText}>{displayValue}</Text>
</View>
);
};
export default Counter
const styles = StyleSheet.create({
container: {
backgroundColor: '#f2f2f2',
padding: 5,
borderRadius: 5,
},
counterText: {
fontSize: 20,
fontWeight: 'bold',
color: colors.primary,
},
});