Skip to content

Commit ce499af

Browse files
author
SupriyaKalghatgi
committed
Merge branch 'master' into development
2 parents 9f796a7 + bc5574c commit ce499af

File tree

4 files changed

+107
-65
lines changed

4 files changed

+107
-65
lines changed

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ Essential cross-platform UI components for React Native
66

77
Updated docs [here!](https://docs.nativebase.io/)
88

9-
**For people having trouble upgrading to 2.1.5, check [this.](https://github.com/GeekyAnts/NativeBase/issues/928)**
10-
11-
### Use v2.2.1 with latest react-native version(0.46). Older versions may break.
12-
139
![Demo](https://github.com/GeekyAnts/NativeBase-KitchenSink/raw/master/screenshots/iOS.gif)
1410
![Demo](https://github.com/GeekyAnts/NativeBase-KitchenSink/raw/master/screenshots/Android.gif)
1511

dist/src/basic/IconNB.js

+30-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/basic/IconNB.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/basic/IconNB.js

+76-53
Original file line numberDiff line numberDiff line change
@@ -18,67 +18,90 @@ import EvilIcons from "react-native-vector-icons/EvilIcons";
1818
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames";
1919

2020
class IconNB extends Component {
21-
static contextTypes = {
22-
theme: PropTypes.object,
23-
};
21+
static contextTypes = {
22+
theme: PropTypes.object
23+
};
2424

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+
}
6165

62-
componentWillMount() {
63-
this.setIcon(this.props.type);
64-
}
66+
componentWillMount() {
67+
this.setIcon(this.props.type);
68+
}
6569

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+
}
7175

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+
}
7579
}
7680

7781
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+
])
8099
};
81100

82-
const StyledIconNB = connectStyle("NativeBase.IconNB", {}, mapPropsToStyleNames)(IconNB);
101+
const StyledIconNB = connectStyle(
102+
"NativeBase.IconNB",
103+
{},
104+
mapPropsToStyleNames
105+
)(IconNB);
83106

84107
export { StyledIconNB as IconNB };

0 commit comments

Comments
 (0)