Preact with v2 : Uncaught TypeError: Cannot read property 'scrollTop' of null
See original GitHub issueHi there,
First of : great project and awesome work. I’ve been using it for quite some time now in multiple projects, and rarely had any problem. Now I’m testing the v2 with my Preact project and finding some weird behaviour / errors. The component works as expected, most of the time, but when I select a value and scroll again in the dropdown menu, the error “Uncaught TypeError: Cannot read property ‘scrollTop’ of null” gets spammed in the console.
I’d love to add a plunker to reproduce, but its quite a pain to get it to work with preact and react select dependencies, right in the live html page…
Also I know it’s in Preact not and directly React, I’ve used this lib in preact before and didnt have any trouble. Plus, Preact is being used more and more so I figured it might be worth reporting as it seems to be linked to the use of refs with a particular syntax. My usage is very basic, so it does not seem to be an issue related to some exotic config of the component :
<ReactSelect
options={options}
styles={{
option: (styles, {data, isSelected, isFocused}) => {
return ({
...styles,
backgroundColor: (isSelected || isFocused) ? '#EEE' : '#FFF',
color: '#444',
textAlign: 'left'
})
}
}}
/>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
I have the same problem, as a temporary fix I use the next solution:
It’s been more than a month, the issue is still present in the .7 of the beta. Any idea ?