forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sankhadeep
committed
Jan 13, 2017
1 parent
362893e
commit e4a5fd8
Showing
4 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* @flow */ | ||
'use strict'; | ||
|
||
import React from 'react'; | ||
import NativeBaseComponent from '../../Base/NativeBaseComponent'; | ||
import computeProps from '../../../Utils/computeProps'; | ||
|
||
import Ionicons from 'react-native-vector-icons/Ionicons'; | ||
import Entypo from 'react-native-vector-icons/Entypo'; | ||
import FontAwesome from 'react-native-vector-icons/FontAwesome'; | ||
import Foundation from 'react-native-vector-icons/Foundation'; | ||
import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; | ||
import Octicons from 'react-native-vector-icons/Octicons'; | ||
import Zocial from 'react-native-vector-icons/Zocial'; | ||
|
||
export default class Icon extends NativeBaseComponent { | ||
|
||
propTypes: { | ||
style : React.PropTypes.object | ||
} | ||
|
||
contextTypes: { | ||
theme: React.PropTypes.object | ||
} | ||
|
||
componentWillMount() { | ||
switch(this.getTheme().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; | ||
} | ||
} | ||
|
||
static getImageSource = FontAwesome.getImageSource | ||
|
||
getInitialStyle() { | ||
return { | ||
icon: { | ||
fontSize: this.getTheme().iconFontSize, | ||
color: this.getContextForegroundColor() | ||
} | ||
} | ||
} | ||
prepareRootProps() { | ||
var defaultProps = { | ||
style: this.getInitialStyle().icon | ||
}; | ||
|
||
return computeProps(this.props, defaultProps); | ||
|
||
} | ||
|
||
render() { | ||
return( | ||
<this.Icon ref={c => this._root = c} {...this.prepareRootProps()}/> | ||
); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.