Uncaught TypeError: Cannot read property 'scrollWidth' of undefined
See original GitHub issueHi, I’m using your react-select component but it keeps throwing errors. But I think the real problem is here.
First error shown is
Uncaught Error: Invariant Violation: addComponentAsRefTo(…): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component’s render
method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).
And then following Uncaught TypeError: Cannot read property ‘scrollWidth’ of undefined which appears in updateInputWidth() function in AutosizeInput component in the first condition
typeof this.refs.sizer.scrollWidth === 'undefined'
Here is listing of npm ls | grep react
to show you versions I’m working with
├─┬ react@0.14.3 ├── react-dom@0.14.3 ├─┬ react-dropzone-component@0.8.1 ├─┬ react-select@1.0.0-beta6 │ └── react-input-autosize@0.6.5
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (1 by maintainers)
I just ran into this problem and changed line 68 to:
if (!this.isMounted() || typeof this.refs.sizer === ‘undefined’){
And it worked for me.
The mount functionality has been rewritten and I can’t reproduce this so I believe it’s been fixed