-
Notifications
You must be signed in to change notification settings - Fork 1
/
item.js
59 lines (53 loc) · 2.67 KB
/
item.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React, { Component } from 'react';
import { TouchableOpacity } from 'react-native';
import { styles, iconColor, iconSize, iconActiveColor } from './styles';
// icons
import AntDesign from 'react-native-vector-icons/AntDesign';
import Entypo from 'react-native-vector-icons/Entypo';
import EvilIcons from 'react-native-vector-icons/EvilIcons';
import Feather from 'react-native-vector-icons/Feather';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import Fontisto from 'react-native-vector-icons/Fontisto';
import Foundation from 'react-native-vector-icons/Foundation';
import Ionicons from 'react-native-vector-icons/Ionicons';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons';
import Octicons from 'react-native-vector-icons/Octicons';
import Zocial from 'react-native-vector-icons/Zocial';
export default class SpaceNavigationSingle extends Component{
constructor(props){
super(props);
this.state = {
name: this.props.icon,
size: iconSize,
color: this.props.active ? iconActiveColor : iconColor
};
}
static getDerivedStateFromProps(nextProps, prevState){
return {
color: nextProps.active ? iconActiveColor : iconColor
};
}
render(){
return (
<TouchableOpacity activeOpacity={0.72} onPress={() => this.props.clickFunction(this.props.id)} style={[styles.singleIcon, { width: this.props.singleWidth }]}>
{ this.props.packet === 'AntDesign' && <AntDesign {...this.state} /> }
{ this.props.packet === 'Entypo' && <Entypo {...this.state} /> }
{ this.props.packet === 'EvilIcons' && <EvilIcons {...this.state} /> }
{ this.props.packet === 'Feather' && <Feather {...this.state} /> }
{ this.props.packet === 'FontAwesome' && <FontAwesome {...this.state} /> }
{ this.props.packet === 'FontAwesome5' && <FontAwesome5 {...this.state} /> }
{ this.props.packet === 'Fontisto' && <Fontisto {...this.state} /> }
{ this.props.packet === 'Foundation' && <Foundation {...this.state} /> }
{ this.props.packet === 'Ionicons' && <Ionicons {...this.state} /> }
{ this.props.packet === 'MaterialCommunityIcons' && <MaterialCommunityIcons {...this.state} /> }
{ this.props.packet === 'MaterialIcons' && <MaterialIcons {...this.state} /> }
{ this.props.packet === 'SimpleLineIcons' && <SimpleLineIcons {...this.state} /> }
{ this.props.packet === 'Octicons' && <Octicons {...this.state} /> }
{ this.props.packet === 'Zocial' && <Zocial {...this.state} /> }
</TouchableOpacity>
);
}
}