([]);
-
- const numbers = useMemo(() => {
- if (!numberString) return [];
-
- const parsed = numberString
- .replace(/-/g, '')
- .split('')
- .map((char) => parseInt(char, 10));
-
- if (isInitialLoading) {
- setIsStopped(new Array(parsed.length).fill(false));
- setIsInitialLoading(false);
- }
-
- return parsed;
- }, [numberString, isInitialLoading]);
-
- const handleAnimationComplete = useCallback((index: number) => {
- setIsStopped((prev) => {
- const newState = [...prev];
- newState[index] = true;
- return newState;
- });
- }, []);
-
- if (isInitialLoading) {
- return (
-
- Loading...
-
- );
- }
-
- return (
-
- {numbers.map((num, index) => (
- handleAnimationComplete(index)}
- isStopped={isStopped[index]}
- showHyphen={(index + 1) % 2 === 0 && index !== numbers.length - 1}
- />
- ))}
-
- );
-};
-
-export default RollingCounterWorking;