Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

componentRef.current.addEventListener is not a function in React 16.5 #9

Closed
zrisher opened this issue Apr 10, 2019 · 3 comments
Closed

Comments

@zrisher
Copy link

zrisher commented Apr 10, 2019

I receive TypeError: this.componentRef.current.addEventListener is not a function when attempting the Unmanaged Example from the Readme while using React 16.5.

The error is thrown from panAndZoomHoc.tsx#L75

if (this.componentRef.current) {
  this.componentRef.current.removeEventListener('wheel', this.handleWheel);
}

Using Chrome debugger, it appears this.componentRef.current returns the component itself and not a DOM reference:

image

Purportedly we're supposed to use ReactDOM.findDOMNode(component) to get the DOM reference from a component.

@woutervh-
Copy link
Owner

Hi @zrisher
Good point, I forgot about wrapped React components.
I will fix it and release a new version, in the meantime version 1.4.1 still uses the old findDOMNode method and should work just fine.

Thanks

@woutervh-
Copy link
Owner

I also update the major version 2 so you can also use 2.0.1 now.
Let me know if it works for you.

@zrisher
Copy link
Author

zrisher commented Apr 10, 2019

@woutervh- Thanks for the quick response. You are correct, 1.4.1 works just fine. I don't see 2.0.1 up on NPM but will switch over asap. Thank you!

@zrisher zrisher closed this as completed Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants