-
-
Notifications
You must be signed in to change notification settings - Fork 132
/
component.js
49 lines (47 loc) · 1.06 KB
/
component.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from 'react';
import {View, Text} from 'react-native';
import EStyleSheet from 'react-native-extended-stylesheet';
export default class extends React.Component {
render() {
return (
<View style={styles.column}>
<Text>
Column width depends on device width: {'\n'}- 70% for {'<'}350{'\n'}- 80% for 350-500{'\n'}- 90% for {'>'}500
</Text>
<Text style={styles.text}>Text size/color depends on platform.</Text>
</View>
);
}
}
const styles = EStyleSheet.create({
column: {
alignSelf: 'center',
borderWidth: 1,
marginTop: '10%',
padding: 5,
},
'@media (max-width: 350)': { // media query on sheet level
column: {
width: '70%',
}
},
'@media (min-width: 350) and (max-width: 500)': {
column: {
width: '80%',
}
},
'@media (min-width: 500)': {
column: {
width: '90%',
}
},
text: {
fontSize: '$fontSize',
'@media ios': { // media query on style level
color: 'green',
},
'@media android': {
color: 'blue',
},
},
});