qimingweng / react-modal-dialog

A modal dialog for ReactJS
http://www.qimingweng.com/react-modal-dialog/
MIT License
316 stars 94 forks source link

REF in react 15 #15

Open jamesjjk opened 8 years ago

jamesjjk commented 8 years ago

Hi Excellent component, however after updating to react 15 there is an issue..

invariant.js?99c6:39 Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs.

I think because you give the component ref self it is causing the issue:

  1. The application has multiple react modules in the build.
  2. The ref attribute is not being used w/in the render method.
jamesjjk commented 8 years ago

Note that this component had a decorator with a context and stores.

qimingweng commented 8 years ago

Hmm, do you know how to solve this? Haven't quite taken a look at actual react-15 issues

jamesjjk commented 8 years ago

@qimingweng sorry not immediately I will try and have a look tomorrow - but it may not be easy to resolve.

qimingweng commented 8 years ago

I think it has to do with the fact that we're using render into subtree, which changes the "owner" vs the "parent" of a react element.

jamesjjk commented 8 years ago

@qimingweng Yep that would do it.

qimingweng commented 8 years ago

Happy to take a PR sometime if you can figure out the details

Aidar-Frontend-Developer commented 5 years ago

@qimingweng Hello i get error image Can you help me?