Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for reverse typing bug (Issue #31) #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

archieherbias
Copy link

Bug was caused by setting the visibleChars state twice when prop typingis changed.

Solution is to clear the _handleTimeout from running so that changing state won't fire twice.

@archieherbias
Copy link
Author

Demo for the fix:
Demo

@@ -28,10 +28,12 @@ class TypeWriter extends React.Component {
const active = this.props.typing;

if (active > 0 && next < 0) {
clearInterval(this._timeoutId);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition block here causes setting of visibleChars state to fire twice along with the _handleTimeout handler. So, clearing _handleTimeout is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant