reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

Fix binding error with preact-compat #258

Closed bgelineau closed 7 years ago

bgelineau commented 7 years ago

When using preact-compat, the updater function passed to the setState method is not called in the context of the class. Thus, ensureHighlightedIndex and maybeAutoCompleteText crash when calling this, which is undefined.

CMTegner commented 7 years ago

Hi! Any chance you can bind these methods in the constructor using Function#bind directly instead? We'll probably move away from transpiling stage 0 proposals in the future (stage 2/3 should be enough), and this particular proposal hasn't seen any movement in a while.

bgelineau commented 7 years ago

Hi! No problem, here is the new version without the bind operator.

Indeed, from what I've seen (and jest), your code already works with stage 3 + class properties.

CMTegner commented 7 years ago

Thanks! Released in v1.5.10. Let us know if you find any other incompatibilities so we can try to keep Autocomplete working for both React and React-like libraries.

bgelineau commented 7 years ago

Thanks.