v6 with Framer Motion? #4063
-
|
Has anyone been able to get v6 working with Framer Motion? I tried adding StyleSheetManager with the emotion types used in prop forwarding mentioned in the documentation, but none of the animations/transitions work after doing so. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
It should work allowing props to be forwarded: |
Beta Was this translation helpful? Give feedback.
-
|
styled-components v6 works with Framer Motion. As noted in the thread, use const AnimatedItem = styled(motion.li).withConfig({
shouldForwardProp: () => true,
})`
margin: 0;
`;Alternatively, with Framer Motion v11+, use const MotionDiv = motion.create(MyStyledComponent);The key is ensuring that Framer Motion animation props ( |
Beta Was this translation helpful? Give feedback.
styled-components v6 works with Framer Motion. As noted in the thread, use
.withConfigto ensure motion props are forwarded:Alternatively, with Framer Motion v11+, use
motion.create():The key is ensuring that Framer Motion animation props (
animate,initial,exit, etc.) are not filtered out by styled-components default prop filtering.