Socket
Socket
Sign inDemoInstall

react-native-vector-icons

Package Overview
Dependencies
17
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.1 to 0.7.2

7

lib/create-icon-set-from-fontello.js

@@ -9,3 +9,3 @@ /**

function createIconSetFromFontello(config : Object, fontFamily? : string) : Function {
function createIconSetFromFontello(config : Object, fontFamily? : string, fontFile? : string) : Function {
var glyphMap = {};

@@ -15,5 +15,8 @@ config.glyphs.forEach(function (glyph) {

});
return createIconSet(glyphMap, fontFamily || config.name)
fontFamily = fontFamily || config.name;
fontFile = fontFile || 'Fonts/' + fontFamily + '.ttf';
return createIconSet(glyphMap, fontFamily, fontFile)
};
module.exports = createIconSetFromFontello;

@@ -122,2 +122,6 @@ /**

if(processColor) {
color = processColor(color);
}
var cacheKey = glyph + ':' + size + ':' + color;

@@ -131,5 +135,2 @@

}
if(Platform.OS === 'android') {
color = processColor(color);
}
NativeIconAPI.getImageForFont(Platform.OS === 'android' ? fontFile : fontFamily, glyph, size, color, function(err, image) {

@@ -136,0 +137,0 @@ if(typeof err === 'string') {

{
"name": "react-native-vector-icons",
"version": "0.7.1",
"version": "0.7.2",
"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.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -37,13 +37,96 @@ # Vector Icons for React Native

*Note: Android support requires React Native 0.12 or later*
* Copy the whole `Fonts` folder to `android/app/src/main/assets`.
* Add the following to the end of `android/settings.gradle`:
* Edit `android/settings.gradle` to look like this:
```
rootProject.name = 'MyApp'
include ':app'
//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')
```
* 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.
* Edit `android/app/build.gradle` (note: **app** folder) to look like this:
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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')
}
```
* Edit your `MainActivity.java` (deep in `android/app/src/main/java/...`) to look like this:
```
package com.myapp;
// Add this line:
import com.oblador.vectoricons.VectorIconsPackage;
import android.app.Activity;
....
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
private ReactInstanceManager mReactInstanceManager;
private ReactRootView mReactRootView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
// and this line:
.addPackage(new VectorIconsPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "MyApp", null);
setContentView(mReactRootView);
}
...
}
```
## Usage

@@ -138,4 +221,4 @@ You can either use one of the bundled icons or roll your own custom font. Currently available options for bundled icon sets are:

#### `createIconSet(glyphMap, fontFamily)`
Returns your own custom font based on the `glyphMap` where the key is the icon name and the value is either a UTF-8 character or it's character code. `fontFamily` is the name of the font **NOT** the filename. Open the font in Font Book.app or similar to learn the name.
#### `createIconSet(glyphMap, fontFamily[, fontFile])`
Returns your own custom font based on the `glyphMap` where the key is the icon name and the value is either a UTF-8 character or it's character code. `fontFamily` is the name of the font **NOT** the filename. Open the font in Font Book.app or similar to learn the name. Optionally pass the third `fontFile` argument for android support, it should be a path to the font file in you asset folder.

@@ -148,3 +231,3 @@ ```js

#### `createIconSetFromFontello(config[, fontFamily])`
#### `createIconSetFromFontello(config[, fontFamily[, fontFile]])`
Convenience method to create a custom font based on a [fontello](http://fontello.com) config file. Don't forget to import the font as described above and drop the `config.json` somewhere convenient in your project.

@@ -151,0 +234,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc