ianbjorndilling / react-typewriter

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

Update component when it's children have changed #13

Closed yn5 closed 8 years ago

yn5 commented 8 years ago

Proposed fix for issue https://github.com/ianbjorndilling/react-typewriter/issues/3.

yn5 commented 8 years ago

@ianbjorndilling @frostney Could this get merged please?

yn5 commented 8 years ago

@frostney I have added a temporary commit to show when when the component will be updated and it seems to me it is working as I intended. Please correct me if I'm wrong.

yn5 commented 8 years ago

@frostney I just realise the children in my code are just text (in which case my solution works fine) but react-typewriter supports having any kind of children which makes my solution problematic as you pointed out indeed. I'll try to have another look at it soon.

frostney commented 8 years ago

Hi @yn5, I'm sorry, I should have clarified that more specifically. (That's the default case for me when I'm using react-typewriter.) May I suggest something: I would love to this merged if there's a check in place that makes sure that both children and nextProps.children are strings. Then you could add the case for non-text children in a separate pull request at a later date if you would be willing to work on that.

yn5 commented 8 years ago

@frostney Nice suggestion! I have amended it into the original commit.

frostney commented 8 years ago

Thank you again for your contribution. This is now part of 0.4.0.