zamarrowski / react-ionicons

A React Ionicon component https://react-ionicons.netlify.app/
Apache License 2.0
192 stars 28 forks source link

Component error when using unknown icon name. #25

Closed edgeadjei closed 6 years ago

edgeadjei commented 6 years ago

The default behavior when using an unknown icon name is to present an error. The desired behavior would be to render null or to display a default ? icon.

Error

index.js:83 Uncaught TypeError: Cannot read property 'paths' of undefined
    at Ionicon._getPathByIconName (index.js:83)
    at Ionicon.render (index.js:68)
    at finishClassComponent (react-dom.development.js:10249)
    at updateClassComponent (react-dom.development.js:10226)
    at beginWork (react-dom.development.js:10605)
    at performUnitOfWork (react-dom.development.js:12573)
    at workLoop (react-dom.development.js:12682)
    at HTMLUnknownElement.callCallback (react-dom.development.js:1299)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:1338)
    at invokeGuardedCallback (react-dom.development.js:1195)
zamarrowski commented 6 years ago

Thanks @edgeadjei now return null icon when uses unknown icon name 👍

edgeadjei commented 6 years ago

Tested and working Thanks