/
index.android.js
57 lines (52 loc) · 1.39 KB
/
index.android.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
50
51
52
53
54
55
56
57
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, {Component} from "react";
import {
AppRegistry,
StyleSheet,
Text,
View
} from "react-native";
import ResponsiveLayout from "./src/responsive.js";//ResponsiveStore?
import MediaQuery from "./src/mediaquery.js";
class ReactNativeResponsive extends Component {
render() {
return (
<View style={{flex: 1}}>
<MediaQuery style={styles.mediaquery} minDeviceWidth={200} maxDeviceWidth={1080}>
<View style={[styles.container, {backgroundColor: "blue"}]}>
<Text> Container 1 </Text>
</View>
</MediaQuery>
<MediaQuery style={styles.mediaquery} minDeviceWidth={200} maxDeviceWidth={1080} maxPixelRatio={3}>
<View style={[styles.container, {backgroundColor: "white"}]}>
<Text> Container 2 </Text>
</View>
</MediaQuery>
<MediaQuery style={styles.mediaquery} minDeviceWidth={200} maxDeviceWidth={1080}>
<View style={[styles.container, {backgroundColor: "red"}]}>
<Text> Container 3 </Text>
</View>
</MediaQuery>
</View>
);
}
}
const styles = StyleSheet.create({
responsivelayout: {
flex: 1,
backgroundColor: "yellow"
},
mediaquery: {
flex: 1,
backgroundColor: "#000000"
},
"container": {
flex: 1,
justifyContent: "center",
alignItems: "center"
}
});
AppRegistry.registerComponent("ReactNativeResponsive", () => ReactNativeResponsive);