Skip to content

Instantly share code, notes, and snippets.

@grabbou
Last active June 13, 2020 01:36
Show Gist options
  • Save grabbou/72767db51f97fe86cfea to your computer and use it in GitHub Desktop.
Save grabbou/72767db51f97fe86cfea to your computer and use it in GitHub Desktop.
// 1. Queries for width, min-width, height & min-height
const a = StyleSheet.create({
container: {
fontSize: 16,
},
'@media (min-width: 500px) and (min-height: 600px)': {
container: {
fontSize: 10,
},
},
'@media (min-width: 200px)': {
container: {
fontSize: 8,
},
},
});
// 2. Queries for orientation
StyleSheet.create({
container: {
fontSize: 16,
},
'@media (orientation: landscape)': {
container: {
fontSize: 15,
}
},
});
// 3. Queries with platform-specific stuff (via custom non-standard `ios/android` media_type)
StyleSheet.create({
container: {
fontSize: 16,
},
'@media ios (min-width: 600px)': {
container: {
fontSize: 15,
}
},
'@media android (min-width: 600px)': {
container: {
fontSize: 14,
}
},
});
// 4. Queries for device ratio
StyleSheet.create({
container: {
fontSize: 16,
},
'@media ios (aspect-ratio: 16 / 9)': {
container: {
fontSize: 15,
},
},
});
// 5. Also nest inside styles as well
StyleSheet.create({
container: {
fontSize: 16,
'@media ios (aspect-ratio: 16 / 9)': {
fontSize: 15,
},
},
});
// 6. Platform specific styles
StyleSheet.create({
container: {
fontSize: 16,
},
'@media ios': {
container: {
fontSize: 15,
},
},
'@media android': {
container: {
fontSize: 14,
},
},
});
@janicduplessis
Copy link

Oh, I see that's good then!

@9mm
Copy link

9mm commented Mar 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment