woofers / react-yat

🌀 🔠 📜 Yet Another Typer component for React
MIT License
2 stars 1 forks source link

Event listeners #8

Open farmstrong8 opened 3 years ago

farmstrong8 commented 3 years ago

Awesome library! A couple things that I think would be helpful are. Exposing event listeners like when the text is changing or when a typer element completes. The ability to render each child line by line vs. one single line. Also updating the docs to include some examples and maybe have a live demo. If you want some help with this, I'd be down to submit a PR as well!

woofers commented 3 years ago

Hi @farmstrong8, these are definitely some awesome ideas. Thanks for contributing.

  1. For the first point of event listeners, I think this is a must add and just a matter of how many event listeners to add. I was thinking something like the following: onTypeStart - Called when a word is starting to be typed. (or equivalently when the typer changes words) onTypeComplete - Called when a word is fully typed out. onDeleteStart - Called when a word is starting to be deleted. onDeleteComplete - Called when a word is fully deleted. If you're interested in submitting some PRs for this feel free, if not I will probably do this eventually as I think its an important feature.

  2. For the second point if I am understanding correctly, some kind of option to control if the typer displays content inline or on a newline. I think this could be accomplished with some sort of React prop that controls the flex-direction. Again if you're interesting in submitting a PR for this feel free. If not this will probably happen after the event listeners but it should not be too big of a feature.

  3. For the docs and examples, definitely if you find any confusing areas in the docs, feel free to submit a PR. I plan on creating a project site at some point but just have not found the time yet.

Thanks again.