RN (react native) into the pit guide-05, use the icon font fontawesome

Source: Internet
Author: User
PrerequisitesRN 0.23 NPM 3.7.3 node 5.9.1 system WinX python 2.7.x Preface

The development process of a variety of icons naturally, if you can use Fontawesome and other icon fonts, nature can bring great convenience, but in the RN is not directly quoted, fortunately, someone has done the relevant components, React-native-vector-icons is one of the best.
If you are interested in this component you can go to the GitHub page star this project
Https://github.com/oblador/react-native-vector-icons Installation

The official Readme How to use has been written in detail, here are a few points to note.
Because the installation depends on Node-gyp, and Node-gyp in win will have a lot of reliance here to Winx for example, Winx need to install the dependency

1.python environment: Until the blog published only support to the 2.7.X version, if the download Zip package needs to add Python path to the environment variable

2.vs C + +: For convenience I have installed Microsoft Visual Studio Express directly

3.RNPM:NPM Install rnpm-g use

After you make sure that the above three points are not a problem, you can install this component with the following command

    NPM Install react-native-vector-icons--save

Since I am developing an Android App, I continue to do so according to the official documentation

    RNPM Link

Where you need to use the icon, here is the ES6, ES5 's writing is also possible

    Import Icon from ' React-native-vector-icons/fontawesome ';

Working with Components

    <icon name= "QQ" size={30} color= "#52C0FE"/>
Notes

parameter Description

Parameters type Default Value Description
Name String No Icon name, it is important to note that if you use font-awesome icons, such as QQ can only write QQ, no need to write FA Fa-qq
Size Numerical 12 The size of the icon
Color The color format supported by RN Automatic inheritance The color of the icon

Supported Icons Entypo by Daniel Bruce (411 icons) evilicons by Alexander Madyankin & Roman shamin (v1.8.0, icons Fontawesome by Dave Gandy (v4.5, 605 icons) Foundation by Zurb, Inc. (v3.0, 283 icons) ionicons by Ben Sperry (v2.0.1, 733 icons) Materialicons by Google, Inc. (v2.1.1, 893 icons) octicons by Github, Inc. ( v3.5.0, 196 icons) zocial by Sam Collins (v1.0, icons)

Error Logging
Python will appear if it is not installed correctly

-gyp err! Configure error 
Gyp err! stack error:can ' t find python executable "python", you Can set the Python env variable.
  gyp err! Stack  

Not installed correctly vs C + + will appear

Failed to load Visual C + + component VCBuild.exe ", requires installation of. NET Framms Build,. NET Framework 2.0 SDK, Microsoft Visual Studio 2005.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.