react-native-vector-icons
Advanced tools
Comparing version 0.8.5 to 1.0.0-rc
@@ -424,3 +424,3 @@ /** | ||
var Entypo = createIconSet(glyphMap, 'Entypo', 'Fonts/Entypo.ttf'); | ||
var Entypo = createIconSet(glyphMap, 'Entypo', 'Entypo.ttf'); | ||
@@ -427,0 +427,0 @@ module.exports = Entypo; |
@@ -82,3 +82,3 @@ /** | ||
var EvilIcons = createIconSet(glyphMap, 'EvilIcons', 'Fonts/EvilIcons.ttf'); | ||
var EvilIcons = createIconSet(glyphMap, 'EvilIcons', 'EvilIcons.ttf'); | ||
@@ -85,0 +85,0 @@ module.exports = EvilIcons; |
@@ -687,3 +687,3 @@ /** | ||
var FontAwesome = createIconSet(glyphMap, 'FontAwesome', 'Fonts/FontAwesome.ttf'); | ||
var FontAwesome = createIconSet(glyphMap, 'FontAwesome', 'FontAwesome.ttf'); | ||
@@ -690,0 +690,0 @@ module.exports = FontAwesome; |
@@ -296,3 +296,3 @@ /** | ||
var Foundation = createIconSet(glyphMap, 'fontcustom', 'Fonts/Foundation.ttf'); | ||
var Foundation = createIconSet(glyphMap, 'fontcustom', 'Foundation.ttf'); | ||
@@ -299,0 +299,0 @@ module.exports = Foundation; |
@@ -746,3 +746,3 @@ /** | ||
var Ionicons = createIconSet(glyphMap, 'Ionicons', 'Fonts/Ionicons.ttf'); | ||
var Ionicons = createIconSet(glyphMap, 'Ionicons', 'Ionicons.ttf'); | ||
@@ -749,0 +749,0 @@ module.exports = Ionicons; |
@@ -36,9 +36,9 @@ /** | ||
var TypefaceTextView; | ||
function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string) : Function { | ||
var fontReference = fontFamily; | ||
// Android doesn't care about actual fontFamily name, it will only look in fonts folder. | ||
if(Platform.OS === 'android' && fontFile) { | ||
fontReference = fontFile.replace(/\.(otf|ttf)$/, ''); | ||
} | ||
if(Platform.OS === 'android') { | ||
TypefaceTextView = require('./TypefaceTextView'); | ||
} | ||
function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string) : Function { | ||
var Icon = React.createClass({ | ||
@@ -77,16 +77,4 @@ propTypes: { | ||
// For android we have to use our own subclass of the TextView since it | ||
// doesn't yet support custom fonts | ||
if(Platform.OS === 'android') { | ||
// FIXME: Temporary workaround until I can figure out how to automatically size icons | ||
styleDefaults.width = size; | ||
styleDefaults.height = size; | ||
styleDefaults.lineHeight = size; | ||
if (TypefaceTextView == null) { | ||
throw new Error("TypefaceTextView component must be available on Android"); | ||
} | ||
return (<TypefaceTextView {...props} fontFile={fontFile}>{glyph}{this.props.children}</TypefaceTextView>); | ||
} | ||
styleDefaults.fontFamily = fontReference; | ||
styleDefaults.fontFamily = fontFamily; | ||
return (<Text {...props}>{glyph}{this.props.children}</Text>); | ||
@@ -195,3 +183,3 @@ } | ||
} | ||
NativeIconAPI.getImageForFont(Platform.OS === 'android' ? fontFile : fontFamily, glyph, size, color, function(err, image) { | ||
NativeIconAPI.getImageForFont(fontReference, glyph, size, color, function(err, image) { | ||
if(typeof err === 'string') { | ||
@@ -198,0 +186,0 @@ err = new Error(err); |
@@ -809,3 +809,3 @@ /** | ||
var MaterialIcons = createIconSet(glyphMap, 'MaterialIcons', 'Fonts/MaterialIcons.ttf'); | ||
var MaterialIcons = createIconSet(glyphMap, 'MaterialIcons', 'MaterialIcons.ttf'); | ||
@@ -812,0 +812,0 @@ module.exports = MaterialIcons; |
@@ -218,3 +218,3 @@ /** | ||
var Octicons = createIconSet(glyphMap, 'octicons', 'Fonts/Octicons.ttf'); | ||
var Octicons = createIconSet(glyphMap, 'octicons', 'Octicons.ttf'); | ||
@@ -221,0 +221,0 @@ module.exports = Octicons; |
{ | ||
"name": "react-native-vector-icons", | ||
"version": "0.8.5", | ||
"version": "1.0.0-rc", | ||
"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.", | ||
@@ -50,3 +50,3 @@ "main": "index.js", | ||
"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 || 0.12.0-rc || 0.13.0-rc || 0.14.0-rc || 0.15.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 || 0.13.0-rc || 0.14.0-rc || 0.15.0-rc || 0.16.0-rc" | ||
}, | ||
@@ -53,0 +53,0 @@ "dependencies": { |
@@ -59,10 +59,15 @@ # Vector Icons for React Native | ||
### Android (experimental) | ||
### Android | ||
*Note: Android support requires React Native 0.12 or later* | ||
*Note: Android support requires React Native 0.16 or later, use [0.8.5](https://github.com/oblador/react-native-vector-icons/releases/tag/v0.8.5) for earlier versions* | ||
* Copy the whole `Fonts` folder to `android/app/src/main/assets`. | ||
* Edit `android/settings.gradle` to look like this: | ||
* Copy the contents in the `Fonts` folder to `android/app/src/main/assets/fonts` (*note lowercase font folder*). | ||
``` | ||
#### Integrating library for `getImageSource` support | ||
These steps are optional and only needed if you want to use the `Icon.getImageSource` function. | ||
* Edit `android/settings.gradle` to look like this (without the +): | ||
```diff | ||
rootProject.name = 'MyApp' | ||
@@ -72,5 +77,4 @@ | ||
//Add the following two lines: | ||
include ':react-native-vector-icons' | ||
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') | ||
+ include ':react-native-vector-icons' | ||
+ project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') | ||
``` | ||
@@ -80,3 +84,3 @@ | ||
``` | ||
```diff | ||
apply plugin: 'com.android.application' | ||
@@ -91,18 +95,14 @@ | ||
compile 'com.android.support:appcompat-v7:23.0.0' | ||
compile 'com.facebook.react:react-native:0.12.+' | ||
// Add this line: | ||
compile project(':react-native-vector-icons') | ||
compile 'com.facebook.react:react-native:0.16.+' | ||
+ compile project(':react-native-vector-icons') | ||
} | ||
``` | ||
* Edit your `MainActivity.java` (deep in `android/app/src/main/java/...`) to look like this: | ||
* Edit your `MainActivity.java` (deep in `android/app/src/main/java/...`) to look like this (note **two** places to edit): | ||
``` | ||
```diff | ||
package com.myapp; | ||
// Add this line: | ||
import com.oblador.vectoricons.VectorIconsPackage; | ||
+ import com.oblador.vectoricons.VectorIconsPackage; | ||
import android.app.Activity; | ||
.... | ||
@@ -125,6 +125,3 @@ | ||
.addPackage(new MainReactPackage()) | ||
// and this line: | ||
.addPackage(new VectorIconsPackage()) | ||
+ .addPackage(new VectorIconsPackage()) | ||
.setUseDeveloperSupport(BuildConfig.DEBUG) | ||
@@ -142,8 +139,3 @@ .setInitialLifecycleState(LifecycleState.RESUMED) | ||
### Known issues on android | ||
* Size can only be passed as a property, not with a stylesheet | ||
* Icons have a fixed width causing some icons to be clipped or have whitespace. Adjust with `style={{width: xx}}` for now. | ||
* Icons cannot be nested within a `Text` component. | ||
## `Icon` Component | ||
@@ -150,0 +142,0 @@ You can either use one of the bundled icons above or roll your own custom font. |
@@ -113,3 +113,3 @@ /** | ||
var Zocial = createIconSet(glyphMap, 'zocial', 'Fonts/Zocial.ttf'); | ||
var Zocial = createIconSet(glyphMap, 'zocial', '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
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
786811
42
3701
362