UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
🐛 fix: start ticker when in view
Dillion Verma5d57c37b00f6
diff --git a/registry/components/magicui/number-ticker.tsx b/registry/components/magicui/number-ticker.tsxindex 465879b8..dbfb2911 100644--- a/registry/components/magicui/number-ticker.tsx+++ b/registry/components/magicui/number-ticker.tsx@@ -23,10 +23,11 @@ export default function NumberTicker({const isInView = useInView(ref, { once: true, margin: "-100px" });useEffect(() => {- setTimeout(() => {- motionValue.set(direction === "down" ? 0 : value);- }, delay * 1000);- }, [motionValue, isInView, delay]);+ isInView &&+ setTimeout(() => {+ motionValue.set(direction === "down" ? 0 : value);+ }, delay * 1000);+ }, [motionValue, isInView, delay, value]);useEffect(() =>