Number in @emotion/native does not work
See original GitHub issueCurrent behavior:
If I pass a number to styled
, it doesn’t work. I need to use toString()
styled.View`
height: ${{ paddingTop }: { paddingTop: number }) => props.paddingTop.toString()}px;
`
Expected behavior:
styled.View`
height: ${{ paddingTop }: { paddingTop: number }) => props.paddingTop}px;
`
Environment information:
react
version: 16.9.0react-native
version: 0.61.2emotion
version: 10.0.20
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:20 (9 by maintainers)
Top Results From Across the Web
TypeScript - Emotion
Emotion includes TypeScript definitions for @emotion/react and @emotion/styled . These definitions infer types for css properties with the object syntax, ...
Read more >Emotion in React - LogRocket Blog
Emotion has a package called @emotion/native that's for React Native itself, so there's no need for the developer to use Emotion on the...
Read more >emotion-native-media-query - npm package - Snyk
The npm package emotion-native-media-query was scanned for known vulnerabilities and missing license, and no issues were found.
Read more >Using Emotion with React Native - styled components
I was able to get it to work with styled-components , but not emotion . I am also using styled-system to set up...
Read more >@emotion/native - npm
@emotion/native. TypeScript icon, indicating that this package has built-in type declarations · Keywords.
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
Ok, so I’ve debugged this a little bit and it seems that
StyleSheet.create
outputs an object with numbers as values and currently, we allow for interpolating those values (numbers) - so it’s hard to differentiate between those special numbers and regular ones (like in your case).The native library was developed by @nitin42 , maybe he could take a look at this or at least clarify if this is intended, how he believes it should work etc.
Hi @nitin42, do you have any update for this problem?
Thank you!