<motion.div> breaks styled jsx
See original GitHub issueDescribe the bug
With styled-jsx a <style jsx>{
…}</style>
tag is added right before the closing element tag in a component. Adding Motion to that component breaks the styled-jsx and does not style the component.
To Reproduce Check out this sandbox showing the issue: https://codesandbox.io/s/hello-world-ec8og
Expected behavior Its expected that the styles would be applied to a motion element just like it would if it wasn’t a motion element.
Desktop (please complete the following information):
- OS: MacOS
- Browser Chrome
- Version 75
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
Styled-jsx styling not applied to Framer-Motion element
Just for kicks I created a new react app with framer-motion and it worked without issue there. import {motion} from 'framer-motion'; export ...
Read more >Layout animations | Framer for Developers
Create layout and shared layout animations with React and Framer Motion. CSS layouts are difficult and expensive to animate. Animating a style like...
Read more >How to use the framer-motion.motion.div function in ... - Snyk
width};` : 'width: 200px;')} display: inline-block; `; const BottomWrapper = styled(motion.div)``; export const FormField: React.FC<Props> = React.forwardRef( ( ...
Read more >framer-motion.motion.div JavaScript and Node.js code examples
origin: indreklasn/react-framer-motion-examples. src/pop.js/Pop. const Pop = () => ( <motion.div style={styles} animate={{ scale: [1, 2, 2, 1, 1], ...
Read more >page-break-before - CSS: Cascading Style Sheets | MDN
The page-break-before CSS property adjusts page breaks before the current ... Avoid page break before div elements of class note */ div.note ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the corrected version its not the best way to do it. Hope this get fixed in some advanced version of framer motion.
Got the same issue today… Thanks for the solution @krall12 .
Here is my example of using more than one classNames in a component:
modal.styles.js
modal.js