fisshy / react-scroll

React scroll component
https://github.com/fisshy/react-scroll/blob/master/README.md
MIT License
4.36k stars 437 forks source link

React-scroll not working with Material UI 5 Tabs - Cannot read property 'addEventListener' of undefined #484

Open sufius opened 3 years ago

sufius commented 3 years ago

Hello here is a working example with Material-UI 4

https://codesandbox.io/s/cranky-tess-xd72g

And here the same code with Material-UI 5 - not working

https://codesandbox.io/s/crazy-jasper-5ozl5

Error-Message: Cannot read property 'addEventListener' of undefined

Thank you.

prKrumm commented 3 years ago

Ive got the same problem after updating to Mui5.

AlexCernik commented 3 years ago

solution?? :(

chrmoritz commented 2 years ago

Wrap it in forwardRef and use component={SLink}.

const SLink = forwardRef((props, ref) => <Link {...props}/>);
sufius commented 2 years ago

@chrmoritz Thank you, it worked:

https://codesandbox.io/s/nifty-waterfall-en9to

Unfortunately there is now this error message:

Warning: React does not recognize the innerRef prop on a DOM element.