FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 262 forks source link

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

Open sampolahtinen opened 1 year ago

sampolahtinen commented 1 year ago

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)
  3. Attempt to use the icon:
    <FontAwesomeIcon icon="circle-exclamation" />
  4. 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 commented 1 year ago

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?

reinrl commented 7 months ago

@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.