owner ref errors on open/close
I implemented by copy/pasting the docs, but when I open I get this error and it does open.
Uncaught 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 when I try to I get this error, and it fails to close:
Uncaught Invariant Violation: removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing 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).
@mgenev
I have same errors in react v0.14.6. And #89 have not worked for me.
This problems looks being caused by other components.
In my case, I just solved it to arrange package dependencies.
Especially, I removed react by npm remove --save react. After that, It worked well.
@mgenev Did you manage to resolve this in the end?
Deleting the modules didn't work for me, nor did moving the package to peerDependencies.
https://github.com/reactjs/react-modal/issues/146 is a duplicate of this but I commented on there about a potential fix (upgrading to [email protected] and [email protected] seemed to solve it for me)
Hey, I'm running on [email protected] and [email protected] and still getting this bug on some modals. It's particularly weird because it doesn't happen everywhere, only on one particular modal. Based on how other people resolved this, any ideas on how I can fix it?
EDIT: Did some more debugging, removing another React component I had defined got rid of the error. The other working modals use a number of React components which are coming from npm packages, it's specifically using components I've defined that caused the issue. Not sure why removing them fixed things, but now I've at least got a workaround!
Same here with react 15.1.0 and react-modal 1.3.0, if I put in modal one of my own Component (statefull) I have this error (Only a ReactOwner can have refs…), not found any workaround…
In my case, I had loaded multiple versions of react without knowing. I had separated react into a vendor bundle and using browserify-shim to resolve the requires. react-modal also requires react and so it was loading it's own react since browserify does not execute transforms for required modules.
Simply put, I changed transform('browserify-shim') to transform({global: true}, 'browserify-shim') and everything was fine. You could also add the specific transform to react-modal's package.json and it would work.
Hi, I'm using react 15.4.0 and react-modal 1.6.5, same thing here.
What is causing this ? Isn't there any fix ?
This issue must be fixed on current version v2+.
I'm closing this issue for clean up. Please, feel free to reopen this issue if needed. Thank you!