moroshko / react-autosuggest

WAI-ARIA compliant React autosuggest component
http://react-autosuggest.js.org
MIT License
5.97k stars 585 forks source link

_this3.input.focus is not a function at Object.onSuggestionClick [as onClick] with StyledComponents #586

Closed gazpachu closed 5 years ago

gazpachu commented 6 years ago

I've been studying and testing #377 but I can't manage to make it work and get rid of the _this3.input.focus is not a function at Object.onSuggestionClick [as onClick] error with my use case.

My component flow is like this: <AutoComplete> -> <Textfield> -> <Input> -> <StyledInput>

Where <StyledInput> is a Styled-Components input field.

I've made a CodePen: https://codepen.io/gazpachu/pen/XxqzRd

What is wrong?

andyford commented 5 years ago

@gazpachu maybe my comment on #377 might help https://github.com/moroshko/react-autosuggest/issues/377#issuecomment-436394441

gazpachu commented 5 years ago

Thanks @andyford. At the end, I migrated to Styled Components v4, which no longer uses innerRef and problem solved. Thanks!