Icons are part of our culture, especially in the digital era as they play a key role from a UI point of view, providing guidance and information for any user interacting with your product.
Now, thanks to React Native dependencies we are able to implement as many icons as desired or needed, and in most cases, you won’t even have to add any native code at all to use them.
Here is a react native vector icons list that you might want to check out before you start:
Needless to say, there are some cool options for you to choose from. You may implement some popular bundle sets such as FontAwesome or Github, or any other of the listed above. React Native allows you to add any of them to your projects.
Also, popular UI libraries like React Native Paper and React Native Elements use React Native Vector Icons, so it’s definitely a package worth checking out!
By using the icon prop react-native-vector-icons library, it will allow you to import icons quickly by simply following a couple of steps:
Once you’ve created your new project, you must install react-native-vector-icons library and dev dependency in order to start using the icon component.
npm install react-native-vector-icons
Once it’s done, the next thing you want to do will be installing the CocoaPods for IOs and afterward navigate back to your IOs project folder.
cd ios && pod install && cd ..
Follow the next steps to import react-native vector icons in Android.
Importing the Icon files here is a bit more complex but pretty straightforward nonetheless.
The React-native-vector-icons dependency will provide two components:
1-Icon Component
The first one is used for creating icons. Prop “name” will render the icon in Android and IOs.
<Icon name=“rocket” size={30} color=“#900” />
As seen right above, props “size” and “color” are customizable.
2-Icon.Button Component
The Icon.Button Components grants you the opportunity to create buttons with an icon on its left side.
<Icon.Button
name=“facebook”
backgroundColor=“#3b5998”
onPress={this.loginWithFacebook}>
Login with Facebook
</Icon.Button>
In this case, we find many more props we can work with besides color and size; let’s take a look:
Besides such, there are other types of vector icons React Native available, for instance:
1-Ionicons: after installing react-native-ionicons dependency, you’ll have to link the library. Then, install the pods. Lastly, open App.js in any code editor, and replace them with this code.
2-Social Icons: in order to use ScialIcons, first you need to install react-native-elements plus react-native-vector-icons. You can dive into further detail here.
3-React Native Card Views: it’s mandatory to install react-native-elements and later on react-native vector icons dependencies. On the other hand, you may want to check the Card component by react-native-paper, same procedure: first, install react-native-paper and next React Native vector icons. Revise these steps here.
4-Vector Icon in Navigation Drawer/Sidebar: you can modify the Navigation Drawer or set your sidebar as it suits your needs. Make sure you have the node react-native init already installed, and go for installing react-native-cli command.
As far as dependencies go, you’ll need to add react-navigation and other supporting dependencies. Follow this step by step to pull this off.
5-Vector Icon in Bottom Navigation: this is probably the more complex of them all:
Take a peek at this guide for further instructions in order to avoid any important steps.
We have taken a glance at the advantages of using react-native vector icons, and rest assured that this is most likely just the beginning of new features yet to come that will allow developers a quick solution to improving product design.
Working with these vector icon libraries in React-Native will provide you with some top-notch bundle icons ready to get the most out of your app.
Just make sure to follow the steps towards accomplishing your specific goal after deciding what type of vector icons you will be needing. You are just a few steps away from delivering a more appealing UI/UX to your future users.
Leave a Reply