Last active
June 13, 2020 01:36
-
-
Save grabbou/72767db51f97fe86cfea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, | |
}, | |
}, | |
}); |
9mm
commented
Mar 22, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment