vlad-ignatov/react-numeric-input

Error: Only a ReactOwner can have refs...

Opened this issue · 2 comments

If I use jest.resetModules() before each test case there is such error when I try to mount with enzyme my react component that uses react-numeric-input: "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)"

When I import mount function from enzyme error is occurred, but when I require it in test scope everything is ok.

This error happens in react 16 as well as in 15.6.2

I wrapped react-numeric-input with other html tags and created own component based on it. Then I compiled this new component and put it to git. Next I created new "create-react-app" project that includes this component from git and then I got this error. On the other hand, other components that were created by me and compiled the same way do not cause this error

This should be fixed in the latest version. Could you confirm?