storybookjs / addon-react-native-web

Build react-native-web projects in Storybook for React
MIT License
83 stars 24 forks source link

[Bug] storybook try to load native code in web mode #46

Open StarHosea opened 1 year ago

StarHosea commented 1 year ago

image


"@storybook/addon-essentials": "6.5.13",
"@storybook/addon-links": "6.5.13",
"@storybook/addon-ondevice-actions": "6.0.1-beta.10",
"@storybook/addon-ondevice-backgrounds": "6.0.1-beta.10",
"@storybook/addon-ondevice-controls": "6.0.1-beta.10",
"@storybook/addon-ondevice-notes": "6.0.1-beta.10",
"@storybook/react-native": "6.0.1-beta.10",
"@storybook/addon-react-native-web": "0.0.19",
"@storybook/react": "6.5.13",
"@storybook/docs-tools": "6.5.13"

tw-map-view folder like this

tw-map-view/
     __stories__
           index.stories.tsx
    index.ts
    TwMapView.native.tsx: which contains  native platform code
    TwMapView.tsx:  which only has web platform code

----
I try some steps
- delte TwMapView.native.tsx ,restart storybook , works fine
- rename TwMapView to TwMapView.web.ts,  rename TwMapView.native.tsx to TwMapView.tsx,  storybook will break while loading TwMapview.tsx
StarHosea commented 1 year ago

I created a repo to reproducre https://github.com/StarHosea/storybook-react-native-debug

StarHosea commented 1 year ago
dannyhw commented 1 year ago

@StarHosea Thanks for the reproduction, I'll take a look soon 👍

tomas-phillips-95 commented 5 months ago

Hi, I'm running into this issue as well. Was there ever a resolution to this? Thanks!

Some context: I am updated storybook from version 6 to 7.