react-fontawesome icon indicating copy to clipboard operation
react-fontawesome copied to clipboard

FontAwesomeIcon throwing "Could not find icon" when using with Pro regular sharp icons

Open sampolahtinen opened this issue 2 years ago • 2 comments

Describe the bug When trying to use FontAwesomeIcon react component with paid sharp regular icons, an error is being thrown in the console saying Could not find icon

Reproducible test case

  1. import { faCircleExclamation } from '@fortawesome/sharp-regular-svg-icons'
  2. Add it to the libary
import { library } from '@fortawesome/fontawesome-svg-core'
library.add(faCircleExclamation)
  1. Attempt to use the icon:
<FontAwesomeIcon icon="circle-exclamation" />
  1. Error in the browsers console: image

It seems that the FontAwesomeIcon component is trying to run a lookup using wrong prefix fas. The prefix of this icon is fasr image

Furthermore, it seems that the IconPrefix type does not include fasr:

export type IconPrefix = "fas" | "far" | "fal" | "fat" | "fad" | "fab" | "fak" | "fass" ;

, which means that following syntax throws static TS error:

<FontAwesomeIcon icon={{ prefix: `fasr`, iconName: `circle-exclamation` }} />

Expected behavior Should be able to render the icon.

Package versions

"@fortawesome/fontawesome-common-types": "^6.3.0",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-regular-svg-icons": "^6.3.0",
"@fortawesome/free-solid-svg-icons": "^6.3.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@fortawesome/sharp-regular-svg-icons": "^6.3.0",

Thanks in advance! Let me know if you need more information!

sampolahtinen avatar Feb 15 '23 11:02 sampolahtinen

This bug also applies to the library @fortawesome/pro-regular-svg-icons.

So basically pro icons can not be used with FontAwesomeIcon

Any movement in regards to fixing the issue?

sampolahtinen avatar Apr 06 '23 14:04 sampolahtinen

@sampolahtinen Is this specific to version 6? We are successfully using pro icons from Font Awesome V5 via react-fontawesome...but now you have me nervous about our planned migration to v6.

reinrl avatar Jan 04 '24 21:01 reinrl