Skip to content

does it support Platform.select? #46

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
sibelius opened this issue Aug 2, 2017 · 3 comments
Closed

does it support Platform.select? #46

sibelius opened this issue Aug 2, 2017 · 3 comments

Comments

@sibelius
Copy link

sibelius commented Aug 2, 2017

in StyleSheet we can have this:

separatorAndroid: {
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0,
    ...Platform.select({
      ios: {
        height: 0,
        backgroundColor: '#ffffff',
      },
      android: {
        height: 10,
        backgroundColor: '#EEEEEE',
      },
    }),
  },

how this works on styled-components?

@jacobp100
Copy link
Contributor

I think you have the wrong repo, but in SC, you can just interpolate this.

styled`
  color: ${Platform.select({ iOS: 'red', android: 'blue' })};
`

@fakenickels
Copy link

hey @jacobp100, first of all, thanks for the great lib!

I know this is already closed, but do you think it would be out of the scope of css-to-react-native creating a Platform.select shorthand with this syntax:

const Wrapper = styled.View`
 @media android { background-color: red; }
 @media ios { background-color: blue; }
`

or maybe

const Wrapper = styled.View`
 @platform android { background-color: red; }
 @platform ios { background-color: blue; }
`

@jacobp100
Copy link
Contributor

So this library just takes property and value pairs instead of blocks of CSS. You could ask on the styled-components repo—that shouldn't be too hard to implement.

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

3 participants