Skip to content

Fix DirectionFactory to support shorthand syntax without unit (Fixes #17) #42

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
wants to merge 2 commits into from

Conversation

aminroosta
Copy link

@jacobp100 This small change will support margin: 10 or padding: 2 5.
This Fixes #17

@aminroosta
Copy link
Author

The last unit test

it('throws useful errors', () => {
  expect(() => transformCss([['margin', '10']]))
    .toThrow('Failed to parse declaration "margin: 10"');
});

Is not an error at all, margin: 10 is perfectly valid 😢
So i changed it to margin: #fff which should actually give an error.

@jacobp100
Copy link
Contributor

We've made the decision to require units where the CSS spec requires units. Thanks anyway!

@jacobp100 jacobp100 closed this Jun 21, 2017
@aminroosta
Copy link
Author

@jacobp100 Thanks!
A more descriptive error message like Failed to parse declaration 'padding: 5', CSS spec requires units may help.
I'm not the first one to open an issue/pr for this :-)

@alvelig
Copy link

alvelig commented Aug 13, 2017

What units are required for react-native?

@johnpaulada
Copy link

johnpaulada commented Aug 23, 2017

@alvelig I tried dp, and it didn't work so I used px and it worked.

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

Successfully merging this pull request may close these issues.

4 participants