-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
119 lines (113 loc) · 2.66 KB
/
App.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import React from "react";
import {
Dimensions,
Linking,
Text,
View,
Platform,
StyleSheet,
TouchableOpacity
} from "react-native";
import IconMediumLogo from "./components/IconMediumLogo";
import Filters from "./Filters";
const filters = [
{
name: "employmentTypes",
label: "Employment type",
type: "MULTI_CHOICE"
},
{
name: "immediateStart",
label: "Immediate start",
type: "RADIO_BUTTON"
},
{
name: "experienceNotRequired",
label: "No experience",
type: "RADIO_BUTTON"
}
];
const MEDIUM_ARTICLE_URL = "https://medium.com/p/2bdde7a4f16c/";
const SCREEN_WIDTH = Dimensions.get("screen").width;
export default class App extends React.Component {
openArticle() {
Linking.canOpenURL(MEDIUM_ARTICLE_URL)
.then(supported => {
if (!supported) {
console.log("Can't handle url: " + MEDIUM_ARTICLE_URL);
} else {
return Linking.openURL(MEDIUM_ARTICLE_URL);
}
})
.catch(err => console.error("An error occurred", err));
}
render() {
return (
<View style={styles.container}>
<View style={styles.header}>
<Text style={styles.title}>Animated Filters Bar</Text>
</View>
<Filters
filters={filters}
activeFiltersCount={0}
activeFiltersMap={{}}
/>
<View style={styles.body}>
<TouchableOpacity style={styles.link} onPress={this.openArticle}>
<IconMediumLogo />
<Text style={styles.linkText}>Back to the Article</Text>
</TouchableOpacity>
{SCREEN_WIDTH > 500 && (
<Text style={styles.tip}>
If you opened example on desktop, please, switch to mobile view in
dev tools and reload the page.
</Text>
)}
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "flex-start"
},
header: {
width: "100%",
alignItems: "center",
paddingTop: Platform.select({ web: 20, default: 40 }),
paddingBottom: 15,
backgroundColor: "#2252C7"
},
title: {
fontSize: 20,
fontWeight: "500",
lineHeight: 20,
color: "#FFFFFF"
},
body: {
flex: 1,
justifyContent: "center",
paddingBottom: 30
},
link: {
flexDirection: "row",
alignItems: "center"
},
linkText: {
paddingLeft: 10,
fontSize: 24,
fontWeight: "500",
fontFamily: Platform.select({ web: "Serif", default: undefined }),
textDecorationLine: "underline"
},
tip: {
width: 400,
marginTop: 100,
textAlign: "center",
color: "#777"
}
});