You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native中Font Awesome常规图标无法找到问题求助

Fixing Font Awesome Regular Icon Import Error in React Native

Root Cause

The error @fontawesome/free-regular-svg-icons/faArrowLeft could not be found occurs because faArrowLeft does not have a free regular variant in Font Awesome's free icon set. Many icons (including faArrowLeft) are only available in the solid style for free users.

Step-by-Step Solutions

1. Use Icons With Free Regular Variants

For icons that do exist in the free regular set (like faPlus), adjust your import path correctly:

// Import from the package root (supports tree-shaking)
import { faPlus } from "@fortawesome/free-regular-svg-icons";

// Or import individual icon files directly
import { faPlus } from "@fortawesome/free-regular-svg-icons/faPlus";

2. Handle Icons Without Free Regular Variants

If you need a left arrow in regular style, choose one of these options:

  • Switch to an alternative icon: Look for a similar icon that has a free regular variant (e.g., check Font Awesome's icon library for comparable options).
  • Upgrade to Font Awesome Pro: The Pro tier includes regular variants for more icons, including faArrowLeft.

3. Confirm Package Installation

Double-check that you installed the regular icon package correctly:

npm install --save @fortawesome/free-regular-svg-icons

If using Yarn:

yarn add @fortawesome/free-regular-svg-icons

Example Working Code

Here’s how to use faPlus in regular style alongside faArrowLeft in solid:

import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
import { faArrowLeft } from "@fortawesome/free-solid-svg-icons/faArrowLeft";
import { faPlus } from "@fortawesome/free-regular-svg-icons/faPlus";

// Component usage
<FontAwesomeIcon icon={faArrowLeft} size={50} />
<FontAwesomeIcon icon={faPlus} size={50} />

内容的提问来源于stack exchange,提问作者George Garman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 09:05:19