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.

Number in @emotion/native does not work

See original GitHub issue

Current 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.0
  • react-native version: 0.61.2
  • emotion version: 10.0.20

https://snack.expo.io/H1xW-yR_S

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
Andaristcommented, Oct 11, 2019

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.

2reactions
imcvampirecommented, Oct 24, 2019

Hi @nitin42, do you have any update for this problem?

Thank you!

Read more comments on GitHub >

github_iconTop 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 >

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