webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
451 stars 80 forks source link

Listener doesn't work after first unmount of Textarea #16

Closed JokerNN closed 7 years ago

JokerNN commented 7 years ago

Hello, first of all thanks for your library

I faced an issue while using this. After first unmount of Textarea main component list navigation with keys becomes impossible. It happens because Textarea.jsx calls removeAll here https://github.com/webscopeio/react-textarea-autocomplete/blob/master/src/Textarea.jsx#L92

Which removes keydown event listener forever (until page refresh). Next mounts of Textarea components won't work properly.

I fixed it roughly here https://github.com/webscopeio/react-textarea-autocomplete/compare/master...JokerNN:master

This change effectively means that keydown event listener will persist forever. (downside of global singletone listener)

I will get rid of it in PR

jukben commented 7 years ago

Hi,

thanks for feedback and issue report. I'll also look on it, I wasn't aware of this behavior.

Anyway, PR is welcomed! ❤️

jukben commented 7 years ago

Closed by #17

Upgrade to v1.1.4. Thanks. 👍