forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIconNB.js
More file actions
72 lines (63 loc) · 1.97 KB
/
IconNB.js
File metadata and controls
72 lines (63 loc) · 1.97 KB
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
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connectStyle } from "native-base-shoutem-theme";
import Ionicons from "react-native-vector-icons/Ionicons";
import Entypo from "react-native-vector-icons/Entypo";
import FontAwesome from "react-native-vector-icons/FontAwesome";
import Foundation from "react-native-vector-icons/Foundation";
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import Octicons from "react-native-vector-icons/Octicons";
import Zocial from "react-native-vector-icons/Zocial";
import SimpleLineIcons from "react-native-vector-icons/SimpleLineIcons";
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames";
class IconNB extends Component {
static contextTypes = {
theme: PropTypes.object,
};
componentWillMount() {
if (this.context.theme) {
switch (this.context.theme["@@shoutem.theme/themeStyle"].variables.iconFamily) {
case "Ionicons":
this.Icon = Ionicons;
break;
case "Entypo":
this.Icon = Entypo;
break;
case "FontAwesome":
this.Icon = FontAwesome;
break;
case "Foundation":
this.Icon = Foundation;
break;
case "MaterialIcons":
this.Icon = MaterialIcons;
break;
case "MaterialCommunityIcons":
this.Icon = MaterialCommunityIcons;
break;
case "Octicons":
this.Icon = Octicons;
break;
case "Zocial":
this.Icon = Zocial;
break;
case "SimpleLineIcons":
this.Icon = SimpleLineIcons;
break;
default:
this.Icon = Ionicons;
}
} else {
this.Icon = Ionicons;
}
}
render() {
return <this.Icon ref={c => (this._root = c)} {...this.props} />;
}
}
IconNB.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
};
const StyledIconNB = connectStyle("NativeBase.IconNB", {}, mapPropsToStyleNames)(IconNB);
export { StyledIconNB as IconNB };