How to use the react-native-vector-icons/lib/create-icon-set function in react-native-vector-icons

To help you get started, we’ve selected a few react-native-vector-icons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrarronz / react-native-blog-examples / Chapter9-Iconfont / IconfontExample / src / screen / IconfontAdvanced / CustomIconFont.js View on Github external
import createIconSet from 'react-native-vector-icons/lib/create-icon-set';
import glyphMap from './iconfont.json';

// glyphMap, fontFamily, fontFile三个参数,注意看react-native-vector-icons官方文档中方法注释,
// Android中fontFamily可以随便写,iOS必须是正确的名字否则运行报错,iOS可以直接双击iconfont.ttf打开看字体实际叫什么名字
const iconSet = createIconSet(glyphMap, 'iconFont', 'iconfont.ttf');

export default iconSet;

export const Button = iconSet.Button;
export const TabBarItem = iconSet.TabBarItem;
export const TabBarItemIOS = iconSet.TabBarItemIOS;
export const ToolbarAndroid = iconSet.ToolbarAndroid;
export const getImageSource = iconSet.getImageSource;
github CodeRabbitYu / ShiTu / app / components / CustomIcon / index.js View on Github external
/**
 * Created by Rabbit on 2018/4/13.
 */

import createIconSet from 'react-native-vector-icons/lib/create-icon-set';
import glyphMap from './iconfont';

const CustomIcon = createIconSet(glyphMap, 'iconfont', 'iconfont.ttf');

export default CustomIcon;
github binggg / mrn / lib / Icon.js View on Github external
*/
'use strict';

import createIconSet from 'react-native-vector-icons/lib/create-icon-set';
import {
  GLYPH_MAP,
  FONT_NAME,
  FONT_FILE
} from './config'

/**
 * Icon Component
 * @example
 * 
 */
export default class Icon extends createIconSet(GLYPH_MAP, FONT_NAME, FONT_FILE) {
  /**
   * @param {object} prop
   * @param {string} prop.name - Icon name
   * @param {number} [prop.size=12] - Icon size
   * @param {string} [prop.color] - Icon color
   */
  constructor(props) {
    super(props);
  }
}