Skip to content

Commit

Permalink
Merge branch 'master' of github.com:GeekyAnts/NativeBase
Browse files Browse the repository at this point in the history
  • Loading branch information
Sankhadeep committed Aug 25, 2016
2 parents a2fdd60 + e6a309b commit 034f00e
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions Components/Widgets/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,44 @@ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import Octicons from 'react-native-vector-icons/Octicons';
import Zocial from 'react-native-vector-icons/Zocial';

var Icon;

switch(variables.iconFamily) {
case 'Ionicons':
Icon = Ionicons;
break;
case 'Entypo':
Icon = Entypo;
break;
case 'FontAwesome':
Icon = FontAwesome;
break;
case 'Foundation':
Icon = Foundation;
break;
case 'MaterialIcons':
Icon = MaterialIcons;
break;
case 'Octicons':
Icon = Octicons;
break;
case 'Zocial':
Icon = Zocial;
break;
default:
Icon = Ionicons;
}


export default class IconNB extends NativeBaseComponent {

propTypes: {
style : React.PropTypes.object
}

contextTypes: {
theme: React.PropTypes.object
}

componentWillMount() {
switch(this.context.theme.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 'Octicons':
this.Icon = Octicons;
break;
case 'Zocial':
this.Icon = Zocial;
break;
default:
this.Icon = Ionicons;
}
}

getInitialStyle() {
return {
icon: {
Expand All @@ -69,7 +72,8 @@ export default class IconNB extends NativeBaseComponent {

render() {
return(
<Icon {...this.prepareRootProps()}/>
<this.Icon {...this.prepareRootProps()}/>
);
}
}

0 comments on commit 034f00e

Please sign in to comment.