Skip to content

flex: 0 1 auto causes a "Failed to parse declaration" error #43

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
Kingles opened this issue Jun 29, 2017 · 1 comment
Closed

flex: 0 1 auto causes a "Failed to parse declaration" error #43

Kingles opened this issue Jun 29, 2017 · 1 comment

Comments

@Kingles
Copy link

Kingles commented Jun 29, 2017

the default value for the flex shorthand (0 1 auto) fails to be parsed by css-to-react-native when passed through styled-components

repro case:

import { styled } from 'styled-components/native'

const MyComponent = styled.View`
  flex: 0 1 auto;
`
@Kingles
Copy link
Author

Kingles commented Jun 29, 2017

seems as if https://github.com/styled-components/css-to-react-native/blob/master/src/transforms/flex.js#L33 may hold the key here. Perhaps

  function matchesLengthOrAuto(tokenStream){
    return tokenStream.matches(LENGTH) || tokenStream.matches(AUTO);
  }
// ... later
    else if (flexBasis === undefined && matchesLengthOrAuto(tokenStream)) {
      flexBasis = tokenStream.lastValue;
    }
// ...

could be a workable solution.

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

No branches or pull requests

1 participant