forked from oblador/react-native-vector-icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.osx.js
89 lines (81 loc) · 1.78 KB
/
index.osx.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
import React, { PureComponent } from 'react';
import {
AppRegistry,
Dimensions,
Image,
StyleSheet,
Text,
View,
} from 'react-native-desktop';
import Icon from 'react-native-vector-icons/Ionicons';
import IconSetList from './IconSetList';
import IconList from './IconList';
const LEFT_PANEL_WIDTH = 300;
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
},
leftPanel: {
width: LEFT_PANEL_WIDTH,
},
rightPanel: {
flex: 1,
backgroundColor: '#fff',
},
welcomeWrapper: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
welcomeText: {
color: '#999',
fontSize: 20,
},
});
class Welcome extends PureComponent {
render() {
return (
<View style={styles.welcomeWrapper}>
<Text style={styles.welcomeText}>
Choose an icon set on the left side
</Text>
</View>
);
}
}
class IconExplorer extends PureComponent {
constructor() {
super();
this.state = {
iconSet: null,
layout: Dimensions.get('window'),
};
}
render() {
const { iconSet, iconSetTitle, layout } = this.state;
return (
<View
style={styles.container}
onLayout={e => this.setState({ layout: e.nativeEvent.layout })}
>
<View style={styles.leftPanel}>
<IconSetList
navigator={{
push: route => this.setState({ iconSet: route.iconSet }),
}}
/>
</View>
<View
style={[
styles.rightPanel,
{ width: layout.width - LEFT_PANEL_WIDTH },
]}
>
{iconSet ? <IconList iconSet={iconSet} /> : <Welcome />}
</View>
</View>
);
}
}
AppRegistry.registerComponent('IconExplorer', () => IconExplorer);