question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Failed to parse declaration "transform"

See original GitHub issue

I was trying tailwind-rn 4.0.0 and had a build issue Error: Failed to parse declaration “transform: translate(var(–tw-translate-x), var(–tw-translate-y)) rotate(var(–tw-rotate)) skewX(var(–tw-skew-x)) skewY(var(–tw-skew-y)) scaleX(var(–tw-scale-x)) scaleY(var(–tw-scale-y))”

Comparing to previous version, v4.0.0 doesn’t omit unsupported styles which causes error in css-to-react-native lib. Did you experience this issue before?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
HeleneGrinicommented, Jan 11, 2022

Disabling the properties that are not supported worked for me. Add this to your tailwind config

  corePlugins: {
    boxShadow: false,
    translate: false, 
    transform: false, 
    ringWidth: false
  }

I dont use these classes, but the css was still being generated. This should perhaps be added to the readme?

1reaction
vadimdemedescommented, Jan 24, 2022

I see what’s happening here. Tailwind’s JIT compiler finds that transform is mentioned in your source code (in styles object), so it thinks that you’re using the transform utility when you clearly don’t. Then tailwind-rn fails to parse it, which causes this error.

@HeleneGrini’s fix is nice, I think I should include it in the readme instructions as well as setup-tailwind-rn CLI. Going to open this issue until it’s resolved. Thanks Helene!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to parse declaration "transform: translate(0, 100%)" #3
It seems this package doesn't handle css transforms properly. I get the error shown in the title when using css transforms.
Read more >
Failed to parse declaration "background: url(1) : using styled ...
I'm new to react native and I'm trying to use the "Imagebackground" using styled-components but I get an error on android when I...
Read more >
Using Styled Components with React Native - Level Up Coding
Styled Components is a CSS-in-JS library that enables developers to write each component with their own styles and allows the code to be...
Read more >
How to fix: CSS: Parse Error. - Rocket Validator
CSS styles could not be parsed, check the indicated line to find what caused the parser to fail. Common causes are unclosed curly...
Read more >
babel/parser
The Babel parser (previously Babylon) is a JavaScript parser used in Babel. The latest ECMAScript version enabled by default (ES2020). Comment attachment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found