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

How to completely stop the typing using React #218

Open
dids-reyes opened this issue Apr 14, 2024 · 0 comments
Open

How to completely stop the typing using React #218

dids-reyes opened this issue Apr 14, 2024 · 0 comments

Comments

@dids-reyes
Copy link

This is rendered in Modal, now the problem is when i close the modal and open another, there's 2 instance one running in display and the previous one that is running in background waiting to finish typing.

  <Typewriter
    options={{delay: 50, loop: false}}
    onInit={typewriter => {
      typewriter
        .typeString(newMessage)
        .pauseFor(1000)
        .callFunction(() => {
         // this is called when newMessage completes typing
          if (trackId) {
            setShow(true);
          }
        })
        .start();
    }}
  />

what i want to do is call a stop or restart of event so it won't reach the callFunction on the previous one that is running in background.

once handleCloseModal is called it should restart and only one Typewriter should start

  const handleCloseModal = () => {
    Typewriter.restart()
  };

is this possible? and how can i achieve this using react?

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

No branches or pull requests

1 participant