Open ballad89 opened 5 years ago
Native base now supports icon type
Icon.propTypes = { ...IconNB.propTypes, style: PropTypes.oneOfType([ PropTypes.object, PropTypes.number, PropTypes.array ]), name: PropTypes.string, ios: PropTypes.string, android: PropTypes.string, active: PropTypes.bool, type: PropTypes.string };
which can be set to one of
setIcon(iconType) { if (iconType === undefined && this.context.theme) { // eslint-disable-next-line iconType = this.context.theme['@@shoutem.theme/themeStyle'].variables .iconFamily; } switch (iconType) { case 'AntDesign': this.Icon = AntDesign; break; case 'Entypo': this.Icon = Entypo; break; case 'EvilIcons': this.Icon = EvilIcons; break; case 'Feather': this.Icon = Feather; break; case 'FontAwesome': this.Icon = FontAwesome; break; case 'FontAwesome5': this.Icon = FontAwesome5; break; case 'Foundation': this.Icon = Foundation; break; case 'Ionicons': this.Icon = Ionicons; break; case 'MaterialCommunityIcons': this.Icon = MaterialCommunityIcons; break; case 'MaterialIcons': this.Icon = MaterialIcons; break; case 'Octicons': this.Icon = Octicons; break; case 'SimpleLineIcons': this.Icon = SimpleLineIcons; break; case 'Zocial': this.Icon = Zocial; break; default: this.Icon = Ionicons; } }
and used like this
<Icon name="exchange" type="FontAwesome" />
native-base already checks for iconType === undefined and also has a default in the switch
native-base
iconType === undefined
default: this.Icon = Ionicons;
Native base now supports icon type
which can be set to one of
and used like this
native-base
already checks foriconType === undefined
and also has a default in the switch