[RN] Failed to parse declaration of padding
See original GitHub issueI have to use padding-vertical
, padding-horizontal
but I can’t use padding: [number];
Same for margin
Code example
const ComponentName = styled.View`
padding: 5; <--- this fails
`

Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to show View within styled (using styled-components) View
1) When I set padding={10} , I get an error Failed to parse declaration "padding: 10" . 2) After Googling a bit, I...
Read more >Failed To Parse Declaration "Background: Url(1): Using Styled ...
After investigating with @Trobyss we found an issue with styledcomponents after View backgroundcolor: red; padding: 20px; borderradius: 8px; flex: 1; margin: ...
Read more >Using Styled Components with React Native - Level Up Coding
CSS properties such as padding and margin are used to add space between UI elements in relation to one another. This is the...
Read more >How To Customize React Components with Props
PropTypes are a simple type system to check that data matches the expected types during runtime. They serve as both documentation and an...
Read more >react-native-render-html - npm
react-native-render-html. TypeScript icon, indicating that this package has built-in type declarations. 6.3.4 • Public • Published a year ...
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 Free
Top 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
@philpl I am new into RN but as far as I know there is no
px
in RN right? Isn’t everything without unit?Why those
px
because now I am super confuse. I wouldn’t use any metric using regularStylesheet.create
@yordis well, in fact, we’re basically removing complexity by making it more similar to vanilla CSS 😉 but that’s a matter of perspective.
The point is not that we do it because it’s a shorthand; We do it to differentiate between units inside shorthands. Otherwise we wouldn’t be able to recognise percentages and px values and be able to correctly translate them and split them up later.
Anyway, I hope I’ve helped you here, and feel free to checkout css-to-react-native if you have some suggestions or issues 😄