react-motion: Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined
I’m new to React Motion, and spent all day yesterday trying to get what I need. However, I can’t figure out what has caused this issue
Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined
I’ve been playing around with the demos and currently this is what I have. If this is not enough code, please let me know!
getStyles() {
const endValue = this.state;
return [endValue];
},
render() {
return (
<TransitionMotion
styles={ this.getStyles }
willEnter={() => null}
willLeave={() => null}>
{ball =>
<div className="demo1">
<div
key="demo1"
className={`demo1-ball ball-0`}
style={{
WebkitTransform: `translate3d(${ball[0].x - 25}px, ${ball[0].y + 25}px, 0)`,
transform: `translate3d(${ball[0].x - 28}px, ${ball[0].y - 54}px, 0)`,
}} />
)}
</div>
}
</TransitionMotion>
);
},
What is causing the error?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 16
- Comments: 24
Try deleting your node_modules folder and run yarn or npm install again, then rerun your build process / file watcher.
This error might happen if two separate versions of react-dom are loaded, e.g., by oneself (index.js) and another dependency (react-apollo) on the server side when used for SSR. Are you trying to render react-motion on the server side?
I also had the problem with React 15 and jest, but updating to 16 was not an option. Downgrading react-test-renderer to ^15 worked though.
I had exactly the same problem in two projects.
In the first project that I have, I updated jest to 20.0.4 and babel-jest to 20.0.3 and everything worked like a charm.
In the second I had to do,
Facing same issue without react-motion.
Make sure you’re on the same version of all the related dependencies.
For example, I just got this issue after upgrading to
react-native v0.45.1. I fixed it by installingreact v16.0.0-alpha.12andreact-test-renderer v16.0.0-alpha.12to match (you can find the correct version number inreact-native’spackage.json).It happened to me as well, but i have no
react-motioninstalled, it happened to me in latestreact-nativeversion0.45.1.Now to search an answer to my issue.
I ran into the problem when executing my Jest tests for the first time. I hadn’t updated my package.json dependencies for a while (not using React 16), that’s why I had to update them. I used
npm-check-updatesas a neat node package for it:For me the problem was that i was using React 15.x.x. I updated to 16 and now I don’t get this problem with Jest anymore
For me the problem was that I had react and react-dom different versions. Updating those fixed the problem.
I got this issue because I did not include react as a dependency
https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md Like @cooperka said, we need match version. Please look above page to correct version