reactjs / react-autocomplete

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

Using `this.refs` is deprecated #332

Closed sadafie closed 6 years ago

sadafie commented 6 years ago

I'm attempting to use this along with React 16.3 but am having issues with refs. The console error is

Autocomplete.js:183 Uncaught TypeError: node.getBoundingClientRect is not a function
    at Autocomplete.setMenuPositions (Autocomplete.js:183)
    at Autocomplete.componentDidUpdate (Autocomplete.js:90)
    at commitLifeCycles (react.9dcdcc3b.js:19590)
    at commitAllLifeCycles (react.9dcdcc3b.js:21253)
    at HTMLUnknownElement.callCallback (react.9dcdcc3b.js:9898)
    at Object.invokeGuardedCallbackDev (react.9dcdcc3b.js:9936)
    at invokeGuardedCallback (react.9dcdcc3b.js:9985)
    at commitRoot (react.9dcdcc3b.js:21392)
    at completeRoot (react.9dcdcc3b.js:22300)
    at performWorkOnRoot (react.9dcdcc3b.js:22250)

When traced, the issue is here.

I believe the correct solution is to update Autocomplete to use the new React.createRef() API.