chenglou / react-motion

A spring that solves your animation problems.
MIT License
21.68k stars 1.15k forks source link

React.children only expected to receive a single React element child. #392

Open johanatan opened 7 years ago

johanatan commented 7 years ago

When used in conjunction with the material-ui library (http://www.material-ui.com/#/), the above error is generated in response to passing a single function as the children for any of the Motion components. If instead an array containing a single function is passed, then the following error is generated:

Failed prop type: Invalid prop `children` of type `array` supplied to `Motion`, expected `function
johanatan commented 7 years ago

Edit: I'm using this wrapper (which claims to do its own packaging of React for injectTapPlugin purposes): https://github.com/cljsjs/packages/tree/master/material-ui & this wrapper for the wrapper: https://github.com/madvas/cljs-react-material-ui

Although I also tried this other wrapper for the wrapper (and got the same result): https://github.com/DaveWM/reagent-material-ui

karna41317 commented 7 years ago

Hej @johanatan How did u fix it ?, I have this similar issue

johanatan commented 7 years ago

@karna41317 I ended up having to drop this dependency and use jQuery animations instead.

livtanong commented 6 years ago

I've received similar errors, and it usually helps to just wrap the return value of the child function with an additional div (or two).