Socket
Socket
Sign inDemoInstall

@expo/vector-icons

Package Overview
Dependencies
6
Maintainers
24
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/vector-icons


Version published
Weekly downloads
516K
decreased by-4.66%
Maintainers
24
Created
Weekly downloads
 

Package description

What is @expo/vector-icons?

@expo/vector-icons is a popular npm package that provides a set of customizable icons for React Native applications. It includes a wide variety of icons from different icon sets such as FontAwesome, MaterialIcons, Ionicons, and more. This package is particularly useful for developers looking to enhance the visual appeal of their applications with minimal effort.

What are @expo/vector-icons's main functionalities?

Basic Icon Usage

This feature allows you to easily include icons in your React Native application. The example demonstrates how to import and use a FontAwesome icon.


import React from 'react';
import { View } from 'react-native';
import { FontAwesome } from '@expo/vector-icons';

const App = () => (
  <View>
    <FontAwesome name="home" size={24} color="black" />
  </View>
);

export default App;

Customizing Icon Size and Color

This feature allows you to customize the size and color of the icons. The example shows how to use a MaterialIcon with a specific size and color.


import React from 'react';
import { View } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';

const App = () => (
  <View>
    <MaterialIcons name="alarm" size={48} color="red" />
  </View>
);

export default App;

Using Different Icon Sets

This feature allows you to use icons from different icon sets within the same application. The example demonstrates the usage of Ionicons and Entypo icons.


import React from 'react';
import { View } from 'react-native';
import { Ionicons, Entypo } from '@expo/vector-icons';

const App = () => (
  <View>
    <Ionicons name="ios-add-circle" size={32} color="green" />
    <Entypo name="aircraft" size={32} color="blue" />
  </View>
);

export default App;

Other packages similar to @expo/vector-icons

Readme

Source

@expo/vector-icons

This library is a compatibility layer around @oblador/react-native-vector-icons to work with the Expo asset system. If you're using React Native without Expo, you have no need for this library -- carry on! (or maybe check out Expo).

👀: this library does not provide access to react-native-vector-icon's Icon.getImageSource() function for generating images from icons at runtime (for context on why, see this issue). If you find yourself needing an icon in the form of an image rather than text, you should generate that image yourself and bundle it with your app.

Resources

Usage

This library is part of the expo package, so if you are using expo you can simply use it like so

import React from 'react';
import { Ionicons } from '@expo/vector-icons';

export default class IconExample extends React.Component {
  render() {
    return <Ionicons name="md-checkmark-circle" size={32} color="green" />;
  }
}

for more usage see Expo icons documentation

Maintainers

How to upgrade the react-native-vector-icons version

I'll be honest with you, it's not straightforward. You should set aside about an hour to do this.

  1. Clone react-native-vector-icons
  2. Copy files from the cloned directory into src/vendor/react-native-vector-icons, except the dotfiles.
  3. Run git status and look at the untracked files. Remove anything that doesn't seem needed. For example, remove package.json, react-native.config.js, react-native.osx.js. Things to look out for are new icon fonts or new create-* files.
  4. Run git diff **/*.js - do any of the changes look like they should be synced over to the equivalent .ts files in src?/
  • ToolBarAndroid and TabBarIOS are not included in @expo/vector-icons
  • Neither are the native vendor font loading or image source related methods.
  • Probably there won't be anything important. The main thing to look out for are user-facing API changes, the @expo/vector-icons internals are different enough that you don't need to worry about it.
  • Were any dependencies added? Check imports against those in the current package.json, see why they were added - maybe they support the bin scripts, in which case we need them.
  1. Run yarn when you're done and it'll copy vendor files over to build.
  2. Go to the website directory, test it out. If new icons were added, ensure that they work here.
  • While you're here, it would be kind of you to update the Expo SDK version to latest.
  1. You are done! Open a PR, have someone else like @brentvatne look at it, merge it. The website will be deployed when you merge to master.

How to deploy the website

Create a commit on master.

Keywords

FAQs

Last updated on 02 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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