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

Cannot read property 'getComputedStyle' of undefined #186

Closed
anibali opened this issue Aug 1, 2016 · 9 comments
Closed

Cannot read property 'getComputedStyle' of undefined #186

anibali opened this issue Aug 1, 2016 · 9 comments

Comments

@anibali
Copy link

anibali commented Aug 1, 2016

Version: react-draggable 2.2.0
Browser: Google Chrome Linux 51.0.2704.106 (64-bit)
Error: Cannot read property 'getComputedStyle' of undefined
Source of error: https://github.com/mzabriskie/react-draggable/blob/ac269435565fe584f0409345dcb79e8f5b682828/lib/utils/positionFns.es6#L29

Looking a few lines up from the source of the error, I think that changing

const ownerWindow = node.defaultView;

to

const ownerWindow = ownerDocument.defaultView;

might fix the problem. I've never used defaultView before though, and I'm not sure what is trying to be achieved with it, so take that with a pinch of salt.

I have no problems with react-draggable 2.1.2.

@grunnlock
Copy link

Happens to me as well when using the "bounds" property:
<ReactDraggable bounds="body" handle=".dashboard-panel-header" onStart={ @focusPanel } onClick={ @focusPanel } >

@afilp
Copy link

afilp commented Aug 2, 2016

It happens to me too, this is very problematic and I do not know what to do! I would appreciate a quick fix, thanks a lot!

@CaptainChemist
Copy link

CaptainChemist commented Aug 5, 2016

@anibali I ran into this same issue, did you end up fixing it? I too was able to fix it by reverting to an earlier version (2.1.2).

@anibali
Copy link
Author

anibali commented Aug 6, 2016

@CaptainChemist I ended up reverting to the earlier version. I did some poking around in the console and found that the window object was available via the document, but I didn't actually make the change. The line I'm referring to is https://github.com/mzabriskie/react-draggable/blob/ac269435565fe584f0409345dcb79e8f5b682828/lib/utils/positionFns.es6#L21

Essentially node.defaultView is undefined, and that's causing the problem.

@vhmth
Copy link

vhmth commented Aug 6, 2016

Confirmed that this is the case for me as well. Reverting to 2.1.2 indeed fixed the issue.

@jonshamir
Copy link

Any updates on this issue?

@uriklar
Copy link

uriklar commented Aug 11, 2016

+1

@STRML
Copy link
Collaborator

STRML commented Aug 11, 2016

If you guys have an issue please submit a PR.

@STRML
Copy link
Collaborator

STRML commented Aug 11, 2016

Published in v2.2.1. Thanks.

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

8 participants