ianbjorndilling / react-typewriter

A React component for creating typing animations.
MIT License
86 stars 37 forks source link

Timeout conflict when changing some props #21

Open halmos opened 8 years ago

halmos commented 8 years ago

Version

0.4.1

Steps to reproduce

  1. set typing prop to 1
  2. set interval to toggle typing prop between 1 and -1

    Expected behavior

What should happen the direction of typing / deleting should alternate

Actual behavior

What is happening the setInterval function inside of typewriter are not being cleared and are racing/conflicting, causing erratic behavior I was able to resolve by adding clearTimeout(this._timeoutId) inside of typewriter's componentWillRecieveProps.

rg1220 commented 8 years ago

+1 I too ran into this issue.