npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

be-icon

v1.0.0

Published

An advance button component that should render nicely on any platform. Supports a great level of customization.

Downloads

8

Readme

react-native-fontawesome

React Native Fontawesome Icons

npm version npm downloads

Benefits

  • No bloatware, one package with one iconset, nothing more nothing less
  • Full set of FontAwesome Icons properly updated
  • Insanely fast with minimal memory footprint
  • Uses the OS to render icons, for best in class performance (refer to performance note bellow)

Installation process

Using yarn

npm i -g yarn

yarn add react-native-fontawesome

Using npm

npm i --save react-native-fontawesome

This module uses Font Awesome version 5.9.0. There is no need to link binaries just import the package and include the Font File in your project.

This package will not download Font Awesome for you. You have to manually download the package and put it into your working folder.

Follow this guides for adding FontAwesome.ttf to your projects:

Adding Custom Fonts to A React Native Application for IOS

Custom Fonts in React Native for Android

Usage

import FontAwesome, { SolidIcons, RegularIcons, BrandIcons } from 'react-native-fontawesome';

...
render() {
  return (
    <View>
        <FontAwesome icon={SolidIcons.smile} />
        <FontAwesome icon={RegularIcons.smileWink} />
        <FontAwesome icon={BrandIcons.github} />
    </View>
  );
},

Note on hyphens

Javascript don't accept hyphens as valid object names hence all hyphens were removed and names converted to camel case.

Example: th-large becomes thLarge

You can parse the name if you want, like this:

import { parseIconName } from 'react-native-fontawesome';

const validIcon = parseIconFromClassName('fas fa-chevron-left') // will be parsed to chevronLeft

// So anywhere you would have used Icons.chevronLeft (or some other icon name) 
// you can now just use the returned value directly (validIcon in this example).  
// The function parseIconName internally returns an BrandIcons[parsedIconName] or SolidIcons[parsedIconName] or RegularIcons[parsedIconName] result.
// So you can use like that:

<FontAwesome style={{fontSize: 32}} icon={validIcon}>

You can use that in some cases when you store the icon from web in you database and then you use dynamically in your mobile.

Styling

You can apply styles directly into the FontAwesome RN component by just passing a style as you do in a <Text> component.

<FontAwesome style={{fontSize: 32}} icon={BrandIcons.github}>

You can find all font families files here: fontawesome-free-5.9.0-web.zip

Warning!

Font Awesome have some paid icons and the link above is for downloading the free icons set. So if you choose some icon from our list, and this icon does not show properly, check if the icon that you choose is a paid one before open a issue. In this case, you must buy the PRO icons set in the Font Awesome's PRO website. In case you are using a paid icon, and you are using a paid icon set that you already bough, you must pass a pro property to the icon, like this:

<FontAwesome icon={RegularIcons.exclamationTriangle} pro={true}>

Why this is fast, and uses almost no extra memory

This package uses the Text element to render Icons. The Text element delegates to the OS the render process of the icons based on the Font file. Both IOS and Android render fonts amazingly fast with little memory overhead. In essence FontAwesome.ttf will be used by the OS to render icons and will benefit of years of native software improvement as well hardware acceleration.

Do you want to create a Custom Font with your Icons?

Take a look on this https://github.com/entria/font-generator, it will generate a TTF font to be used much like this package