question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Cannot read property 'scrollWidth' of undefined

See original GitHub issue

Hi, 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:closed
  • Created 8 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
laifharwoodcommented, Aug 30, 2016

I just ran into this problem and changed line 68 to:

if (!this.isMounted() || typeof this.refs.sizer === ‘undefined’){

And it worked for me.

0reactions
JedWatsoncommented, Nov 23, 2017

The mount functionality has been rewritten and I can’t reproduce this so I believe it’s been fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'scrollHeight' of ...
So when you try to get scrollHeight , you are trying to get a field from an undefined value. This is because the...
Read more >
Cannot read property 'scrollWidth' of null · Issue #910 - GitHub
"Cannot read property 'scrollWidth' of null" is the message that I'm receiving on start drag the only element at canvas.
Read more >
Cannot read property 'scrollHeight' of Undefined in JS
The "Cannot read property 'scrollHeight' of undefined" error occurs when the scrollHeight property is accessed on an undefined value, e.g. array index out...
Read more >
Cannot read property 'scrollHeight' of undefined - MSDN
When you try to get scrollHeight, you are trying to get a field from an undefined value. This is because the code in...
Read more >
Exception Uncaught TypeError:cannot read property ...
I am getting the error message "Exception Uncaught TypeError:cannot read property 'scrollheight' of undefined" when I add an Epic.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found