Created
October 16, 2015 13:02
-
-
Save PhilippKrone/6ee6ae3a2a1ee682e808 to your computer and use it in GitHub Desktop.
GenericIcon.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var React = require('react-native'); | |
var IonIcon = require('react-native-vector-icons/Ionicons'); | |
var FontAwesomeIcon = require('react-native-vector-icons/FontAwesome') | |
var GenericIcon = React.createClass({ | |
render: function() { | |
var type = this.props.name.split('|')[0]; | |
var name = this.props.name.split('|')[1]; | |
var props = {...this.props}; | |
props.name = name; | |
switch (type) { | |
case 'ion': | |
return (<IonIcon {...props} />); | |
break; | |
case 'fa': | |
return (<FontAwesomeIcon {...props} />); | |
break; | |
default: | |
return (<IonIcon {...props} />); | |
} | |
}, | |
}); | |
module.exports = GenericIcon; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment