maxeth / react-type-animation

A React typewriter animation based on typical with extended functionality and customization.
https://react-type-animation.netlify.app/
MIT License
427 stars 24 forks source link

Using preRenderFirstString and splitter together are incompatible if splitter splits words. #44

Open omranjamal opened 1 year ago

omranjamal commented 1 year ago
<TypeAnimation
  sequence={[
    "hello world, this is kinda cool",
    2000,
    "magical machines they are; computers",
    2000,
    "down with the tyrants",
    2000,
  ]}
  preRenderFirstString={true}
  splitter={(text) => text.split(" ")}
/>

The above code causes the library to not animate to the next string.

  1. Splitting each character via splitter={(text) => text.split("")} works just fine though.
  2. Oddly enough, if I'm splitting by spaces and set preRenderFirstString={false} then it also works just fine.