css-in-js-platform
v1.0.0
Published
Platform.select for native CSS-IN-JS solutions(styled-components, emotion, etc.)
Downloads
9
Readme
🛫 css-in-js-platform
📦 Installation
npm install css-in-js-platform
# Or with yarn
yarn add css-in-js-platform
🚀 Usage
You can use this module in 3 different ways.
import platform from 'css-in-js-platform';
const exampleText = styled.Text`
${platform({
ios: css`
font-size: 14px;
`,
android: css`
font-size: 12px;
`,
})}
`;
import platform from 'css-in-js-platform';
const exampleText = styled.Text`
font-size: 14px;
${platform('android', css`
font-size: 14px;
`)}
`;
import platform from 'css-in-js-platform';
const exampleText = styled.Text`
font-size: 14px;
${platform.android(css`
font-size: 14px;
`)}
`;
- The platform keys can be one of
'ios' | 'android' | 'macos' | 'windows' | 'web'
, which is fromPlatformOSType
ofreact-native
(here).