UNPKG

1.89 kBJavaScriptView Raw
1const customIcons = {};
2export const registerCustomIconType = (id, customIcon) => {
3 customIcons[id] = customIcon;
4};
5export default (type) => {
6 switch (type) {
7 case 'zocial':
8 return require('react-native-vector-icons/Zocial').default;
9 case 'octicon':
10 return require('react-native-vector-icons/Octicons').default;
11 case 'material':
12 return require('react-native-vector-icons/MaterialIcons').default;
13 case 'material-community':
14 return require('react-native-vector-icons/MaterialCommunityIcons')
15 .default;
16 case 'ionicon':
17 return require('react-native-vector-icons/Ionicons').default;
18 case 'foundation':
19 return require('react-native-vector-icons/Foundation').default;
20 case 'evilicon':
21 return require('react-native-vector-icons/EvilIcons').default;
22 case 'entypo':
23 return require('react-native-vector-icons/Entypo').default;
24 case 'font-awesome':
25 return require('react-native-vector-icons/FontAwesome').default;
26 case 'font-awesome-5':
27 return require('react-native-vector-icons/FontAwesome5').default;
28 case 'simple-line-icon':
29 return require('react-native-vector-icons/SimpleLineIcons').default;
30 case 'feather':
31 return require('react-native-vector-icons/Feather').default;
32 case 'antdesign':
33 case 'ant-design':
34 return require('react-native-vector-icons/AntDesign').default;
35 case 'fontisto':
36 return require('react-native-vector-icons/Fontisto').default;
37 default:
38 if (Object.prototype.hasOwnProperty.call(customIcons, type)) {
39 return customIcons[type];
40 }
41 return require('react-native-vector-icons/MaterialIcons').default;
42 }
43};