duongdev / phosphor-react-native

phosphor-icons for react-native. A flexible icon family for React Native
https://www.npmjs.com/package/phosphor-react-native
MIT License
189 stars 25 forks source link

Storybook error: Element type is invalid: expected a string or a class/function but got: undefined. #44

Open spsaucier opened 9 months ago

spsaucier commented 9 months ago

I'm trying to include Phosphor in a design system displayed in Storybook (web), but I'm getting this error whenever I include Phosphor icon:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Has anyone else gotten this working in Storybook? Is there some change I should be making to .storybook/main.js to work with phosphor-react-native?

spsaucier commented 9 months ago

For a temporary resolution, I've ended up installing @phosphor-icons/react and adding this to my .storybook/main.js addon options for @storybook/addon-react-native-web:

modulesToAlias: {
  'phosphor-react-native': '@phosphor-icons/react',
},

Downsides: The React web icons are not the same size as the RN ones.

ChrisCoder9000 commented 6 months ago

I'm having this issue while creating a web static project with expo

rodrix commented 4 months ago

Same here. Not working on Storybook. =/

image

mrkpatchaa commented 1 month ago

Folks, this should be fixed by the 2.1 release. Can you please try again?