UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: typing animation displaying emojis (#685)
Coline737792a6dc4
diff --git a/registry/example/typing-animation-demo.tsx b/registry/example/typing-animation-demo.tsxindex 807ee768..8aa29905 100644--- a/registry/example/typing-animation-demo.tsx+++ b/registry/example/typing-animation-demo.tsx@@ -1,5 +1,5 @@import { TypingAnimation } from "@/registry/magicui/typing-animation";export default function TypingAnimationDemo() {- return <TypingAnimation>Typing Animation</TypingAnimation>;+ return <TypingAnimation>Typing Animation 👋</TypingAnimation>;}diff --git a/registry/magicui/typing-animation.tsx b/registry/magicui/typing-animation.tsxindex 62ce90a4..813f70b5 100644--- a/registry/magicui/typing-animation.tsx+++ b/registry/magicui/typing-animation.tsx@@ -60,10 +60,11 @@ export function TypingAnimation({useEffect(() => {if (!started) return;+ const graphemes = Array.from(children);let i = 0;const typingEffect = setInterval(() => {- if (i < children.length) {- setDisplayedText(children.substring(0, i + 1));+ if (i < graphemes.length) {+ setDisplayedText(graphemes.slice(0, i + 1).join(""));i++;} else {clearInterval(typingEffect);