react-native-vector-icons
Advanced tools
Comparing version 0.6.11 to 0.7.0
@@ -424,3 +424,3 @@ /** | ||
var Entypo = createIconSet(glyphMap, 'Entypo'); | ||
var Entypo = createIconSet(glyphMap, 'Entypo', 'Fonts/Entypo.ttf'); | ||
@@ -427,0 +427,0 @@ module.exports = Entypo; |
@@ -81,3 +81,3 @@ /** | ||
var EvilIcons = createIconSet(glyphMap, 'EvilIcons'); | ||
var EvilIcons = createIconSet(glyphMap, 'EvilIcons', 'Fonts/EvilIcons.ttf'); | ||
@@ -84,0 +84,0 @@ module.exports = EvilIcons; |
@@ -687,3 +687,3 @@ /** | ||
var FontAwesome = createIconSet(glyphMap, 'FontAwesome'); | ||
var FontAwesome = createIconSet(glyphMap, 'FontAwesome', 'Fonts/FontAwesome.ttf'); | ||
@@ -690,0 +690,0 @@ module.exports = FontAwesome; |
@@ -296,3 +296,3 @@ /** | ||
var Foundation = createIconSet(glyphMap, 'fontcustom'); | ||
var Foundation = createIconSet(glyphMap, 'fontcustom', 'Fonts/Foundation.ttf'); | ||
@@ -299,0 +299,0 @@ module.exports = Foundation; |
@@ -32,3 +32,3 @@ #!/usr/bin/env node | ||
fs.writeFileSync( | ||
outputFile, | ||
argv.output, | ||
content | ||
@@ -35,0 +35,0 @@ ); |
@@ -746,3 +746,3 @@ /** | ||
var Ionicons = createIconSet(glyphMap, 'Ionicons'); | ||
var Ionicons = createIconSet(glyphMap, 'Ionicons', 'Fonts/Ionicons.ttf'); | ||
@@ -749,0 +749,0 @@ module.exports = Ionicons; |
@@ -14,4 +14,8 @@ /** | ||
TabBarIOS, | ||
requireNativeComponent, | ||
NativeModules, | ||
Platform, | ||
processColor, | ||
} = React; | ||
var RNVectorIconsManager = NativeModules.RNVectorIconsManager; | ||
@@ -27,3 +31,9 @@ var StyleSheetPropType = require('react-native/Libraries/StyleSheet/StyleSheetPropType'); | ||
function createIconSet(glyphMap : Object, fontFamily : string) : Function { | ||
var TypefaceTextView; | ||
if(Platform.OS === 'android') { | ||
TypefaceTextView = require('./TypefaceTextView'); | ||
} | ||
function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string) : Function { | ||
var styles = StyleSheet.create({ | ||
@@ -37,5 +47,2 @@ container: { | ||
}, | ||
text: { | ||
fontFamily, | ||
} | ||
}); | ||
@@ -66,3 +73,3 @@ | ||
var textStyle = _.pick( | ||
flattenStyle([this.props.style, styles.text]), | ||
flattenStyle([this.props.style]), | ||
Object.keys(TextStylePropTypes) | ||
@@ -79,5 +86,19 @@ ); | ||
var icon; | ||
// For android we have to use our own subclass of the TextView since it | ||
// doesn't yet support custom fonts | ||
if(Platform.OS === 'android') { | ||
if(!textStyle.width) { | ||
// FIXME: Temporary workaround until I can figure out how to automatically size icons | ||
textStyle.width = size; | ||
} | ||
icon = (<TypefaceTextView style={textStyle} fontFile={fontFile}>{glyph}</TypefaceTextView>); | ||
} else { | ||
textStyle.fontFamily = fontFamily; | ||
icon = (<Text style={textStyle}>{glyph}</Text>); | ||
} | ||
return ( | ||
<View ref={component => this._root = component} {...this.props} style={containerStyle}> | ||
<Text style={textStyle}>{glyph}</Text> | ||
{icon} | ||
{this.props.children} | ||
@@ -92,2 +113,5 @@ </View> | ||
var getImageSource = function(name : string, size? : number, color? : string) : Promise { | ||
if(Platform.OS === 'android') { | ||
throw new Error('getImageSource not yet implemented for Andorid'); | ||
} | ||
if(!RNVectorIconsManager) { | ||
@@ -94,0 +118,0 @@ throw new Error('RNVectorIconsManager not available, did you add the library to your project and link with libRNVectorIcons.a?'); |
@@ -809,3 +809,3 @@ /** | ||
var MaterialIcons = createIconSet(glyphMap, 'MaterialIcons'); | ||
var MaterialIcons = createIconSet(glyphMap, 'MaterialIcons', 'Fonts/MaterialIcons.ttf'); | ||
@@ -812,0 +812,0 @@ module.exports = MaterialIcons; |
@@ -218,3 +218,3 @@ /** | ||
var Octicons = createIconSet(glyphMap, 'octicons'); | ||
var Octicons = createIconSet(glyphMap, 'octicons', 'Fonts/Octicons.ttf'); | ||
@@ -221,0 +221,0 @@ module.exports = Octicons; |
{ | ||
"name": "react-native-vector-icons", | ||
"version": "0.6.11", | ||
"version": "0.7.0", | ||
"description": "Customizable Icons for React Native with support for NavBar/TabBar, image source and full styling. Choose from 3000+ bundled icons or use your own.", | ||
@@ -28,2 +28,3 @@ "main": "index.js", | ||
"ios", | ||
"android", | ||
"ui", | ||
@@ -50,3 +51,3 @@ "icon", | ||
"peerDependencies": { | ||
"react-native": ">=0.4.0 || 0.5.0-rc1 || 0.6.0-rc || 0.7.0-rc || 0.7.0-rc.2 || 0.8.0-rc || 0.8.0-rc.2 || 0.9.0-rc || 0.10.0-rc || 0.11.0-rc" | ||
"react-native": ">=0.4.0 || 0.5.0-rc1 || 0.6.0-rc || 0.7.0-rc || 0.7.0-rc.2 || 0.8.0-rc || 0.8.0-rc.2 || 0.9.0-rc || 0.10.0-rc || 0.11.0-rc || 0.12.0-rc" | ||
}, | ||
@@ -53,0 +54,0 @@ "dependencies": { |
@@ -11,2 +11,4 @@ # Vector Icons for React Native | ||
### iOS | ||
If you want to use any of the bundled icons, you need to add the icon fonts to your XCode project. Just follow these steps: | ||
@@ -24,2 +26,14 @@ | ||
### Android (experimental) | ||
* Copy the whole `Fonts` folder to `android/app/src/main/assets`. | ||
* Add the following to the end of `android/settings.gradle`: | ||
``` | ||
include ':react-native-vector-icons' | ||
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') | ||
``` | ||
* Add `compile project(':react-native-vector-icons')` to the `dependencies` section of `android/app/build.gradle` | ||
* In your `MainActivity.java` (deep in `android/app/src/main/java/...`), add `import com.oblador.vectoricons.VectorIconsPackage;` on the second line and `.addPackage(new VectorIconsPackage())` after the `.addPackage(new MainReactPackage())` line. | ||
## Usage | ||
@@ -26,0 +40,0 @@ You can either use one of the bundled icons or roll your own custom font. Currently available options for bundled icon sets are: |
@@ -113,3 +113,3 @@ /** | ||
var Zocial = createIconSet(glyphMap, 'zocial'); | ||
var Zocial = createIconSet(glyphMap, 'zocial', 'Fonts/Zocial.ttf'); | ||
@@ -116,0 +116,0 @@ module.exports = Zocial; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
248
779134
42
3665