Skip to content

Handling of line-height with a multiplier value #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kristerkari opened this issue Jun 26, 2018 · 2 comments · Fixed by #120
Closed

Handling of line-height with a multiplier value #89

kristerkari opened this issue Jun 26, 2018 · 2 comments · Fixed by #120

Comments

@kristerkari
Copy link
Contributor

kristerkari commented Jun 26, 2018

Currently with a multiplier value for line-height:

transformCss([['line-height', '1.5']])

The result is this:

{ lineHeight: 1.5 }

React Native treats it as a pixel value instead of a multiplier. We can only calculate the multiplier if we know the font-size of the Text element.

Maybe we should only allow pixels (or other units) to be used with line-height and throw an error for a multiplier?

ping @jacobp100

@jacobp100
Copy link
Contributor

It’s just going through the generic remove-px route. Maybe we could just warn/throw an exception on dev for this case

@kristerkari
Copy link
Contributor Author

We could just add this to fix the issue:

const lineHeight = tokenStream =>
  tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants