@@ -18,67 +18,90 @@ import EvilIcons from "react-native-vector-icons/EvilIcons";
18
18
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames" ;
19
19
20
20
class IconNB extends Component {
21
- static contextTypes = {
22
- theme : PropTypes . object ,
23
- } ;
21
+ static contextTypes = {
22
+ theme : PropTypes . object
23
+ } ;
24
24
25
- setIcon ( iconType ) {
26
- if ( iconType == undefined && this . context . theme ) {
27
- iconType = this . context . theme [ "@@shoutem.theme/themeStyle" ] . variables . iconFamily ;
28
- }
29
- switch ( iconType ) {
30
- case "Ionicons" :
31
- this . Icon = Ionicons ;
32
- break ;
33
- case "Entypo" :
34
- this . Icon = Entypo ;
35
- break ;
36
- case "FontAwesome" :
37
- this . Icon = FontAwesome ;
38
- break ;
39
- case "Foundation" :
40
- this . Icon = Foundation ;
41
- break ;
42
- case "MaterialIcons" :
43
- this . Icon = MaterialIcons ;
44
- break ;
45
- case "MaterialCommunityIcons" :
46
- this . Icon = MaterialCommunityIcons ;
47
- break ;
48
- case "Octicons" :
49
- this . Icon = Octicons ;
50
- break ;
51
- case "Zocial" :
52
- this . Icon = Zocial ;
53
- break ;
54
- case "SimpleLineIcons" :
55
- this . Icon = SimpleLineIcons ;
56
- break ;
57
- default :
58
- this . Icon = Ionicons ;
59
- }
60
- }
25
+ setIcon ( iconType ) {
26
+ if ( iconType == undefined && this . context . theme ) {
27
+ iconType = this . context . theme [ "@@shoutem.theme/themeStyle" ] . variables
28
+ . iconFamily ;
29
+ }
30
+ switch ( iconType ) {
31
+ case "Ionicons" :
32
+ this . Icon = Ionicons ;
33
+ break ;
34
+ case "Entypo" :
35
+ this . Icon = Entypo ;
36
+ break ;
37
+ case "Feather" :
38
+ this . Icon = Feather ;
39
+ break ;
40
+ case "FontAwesome" :
41
+ this . Icon = FontAwesome ;
42
+ break ;
43
+ case "Foundation" :
44
+ this . Icon = Foundation ;
45
+ break ;
46
+ case "MaterialIcons" :
47
+ this . Icon = MaterialIcons ;
48
+ break ;
49
+ case "MaterialCommunityIcons" :
50
+ this . Icon = MaterialCommunityIcons ;
51
+ break ;
52
+ case "Octicons" :
53
+ this . Icon = Octicons ;
54
+ break ;
55
+ case "Zocial" :
56
+ this . Icon = Zocial ;
57
+ break ;
58
+ case "SimpleLineIcons" :
59
+ this . Icon = SimpleLineIcons ;
60
+ break ;
61
+ default :
62
+ this . Icon = Ionicons ;
63
+ }
64
+ }
61
65
62
- componentWillMount ( ) {
63
- this . setIcon ( this . props . type ) ;
64
- }
66
+ componentWillMount ( ) {
67
+ this . setIcon ( this . props . type ) ;
68
+ }
65
69
66
- componentWillUpdate ( nextProps , nextState ) {
67
- if ( nextProps . type && this . props . type != nextProps . type ) {
68
- this . setIcon ( nextProps . type ) ;
69
- }
70
- }
70
+ componentWillUpdate ( nextProps , nextState ) {
71
+ if ( nextProps . type && this . props . type != nextProps . type ) {
72
+ this . setIcon ( nextProps . type ) ;
73
+ }
74
+ }
71
75
72
- render ( ) {
73
- return < this . Icon ref = { c => ( this . _root = c ) } { ...this . props } /> ;
74
- }
76
+ render ( ) {
77
+ return < this . Icon ref = { c => ( this . _root = c ) } { ...this . props } /> ;
78
+ }
75
79
}
76
80
77
81
IconNB . propTypes = {
78
- style : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . number , PropTypes . array ] ) ,
79
- type : PropTypes . oneOf ( [ "Ionicons" , "Entypo" , "FontAwesome" , "Foundation" , "MaterialIcons" , "MaterialCommunityIcons" , "Octicons" , "Zocial" , "SimpleLineIcons" ] ) ,
82
+ style : PropTypes . oneOfType ( [
83
+ PropTypes . object ,
84
+ PropTypes . number ,
85
+ PropTypes . array
86
+ ] ) ,
87
+ type : PropTypes . oneOf ( [
88
+ "Ionicons" ,
89
+ "Entypo" ,
90
+ "Feather" ,
91
+ "FontAwesome" ,
92
+ "Foundation" ,
93
+ "MaterialIcons" ,
94
+ "MaterialCommunityIcons" ,
95
+ "Octicons" ,
96
+ "Zocial" ,
97
+ "SimpleLineIcons"
98
+ ] )
80
99
} ;
81
100
82
- const StyledIconNB = connectStyle ( "NativeBase.IconNB" , { } , mapPropsToStyleNames ) ( IconNB ) ;
101
+ const StyledIconNB = connectStyle (
102
+ "NativeBase.IconNB" ,
103
+ { } ,
104
+ mapPropsToStyleNames
105
+ ) ( IconNB ) ;
83
106
84
107
export { StyledIconNB as IconNB } ;
0 commit comments