Rendering icons
In the final section of this chapter, you'll learn how to render icons in React Native components. Using icons to indicate meaning makes web applications more usable. So, why should native mobile applications be any different?
We'll use the @expo/vector-icons
package to pull various vector font packages into your React Native app. This package is already part of the Expo project that we use as base of the app and now, you can import Icon
components and render them. Let's implement an example that renders several FontAwesome
icons based on a selected icon category:
import React, { useState, useEffect } from "react"; import { View, FlatList, Text } from "react-native"; import { Picker } from "@react-native-picker/picker"; import Icon from "@expo/vector-icons/FontAwesome"; import styles from "./styles"; import iconNames from "./icon-names.json"; export default function RenderingIcons() { ...