typewriterjs icon indicating copy to clipboard operation
typewriterjs copied to clipboard

Why clearing text in the end by default?

Open engin-can opened this issue 2 years ago • 3 comments

Hey, I was wondering why the default behavior is to clear the text after typing. Wouldn't it make more sense to keep the typed text by default? I don't see why you would clear after typing the last word...

options={{
  strings: ["hello", "world"],
  autoStart: true,
}}

engin-can avatar Dec 07 '22 00:12 engin-can

check what the string data is it object or array if it's object but you declare the strings:[] then it causing the problem if you using vanilla js loop: false should be pervent the clearance effect here is mine example { TypingComponent ? ( <Typewriter options={{ autoStart: true, loop: false, delay: 20, strings: description, }} /> ) : ( description ) }

wibawasuyadnya avatar Aug 18 '23 10:08 wibawasuyadnya

I have a basic component wrapper I made and followed this advice @wibawasuyadnya and still have the problem of the last message getting deleted.

const TypewriterHero = ({ messages }) => (
  <Typewriter
    options={{
        autoStart: true,
        loop: false,
        delay: 35,
        strings: messages,
    }}
  />
);

You're saying it doesn't work when you set strings with a sequential object?

dyerrington avatar Jan 13 '24 21:01 dyerrington

I agree 1000%. This is a cool library, but why on earth does it delete your text after it renders? I can't find an option to disable that behavior in options, too bad, will have to build this custom.

Edit: Here's a workaround: https://github.com/tameemsafi/typewriterjs/issues/214

bennyschmidt avatar Feb 12 '24 16:02 bennyschmidt