storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
996 stars 141 forks source link

Crash depending on order of stories inside getStories method #513

Closed gunti96 closed 8 months ago

gunti96 commented 9 months ago

Describe the bug It matters the order of specifying stories inside getStories method (storybook.requires.js file).

So it is a strange behavior, and basically enforces me to not use the "storybook-generate": "sb-rn-get-stories" script provided by you for regenerating the storybook.requires.js file. I update it manually and I need to find an order which is okay and does not crashes the app. I did not found a rule for this yet.

Expected behavior Should run without errors regardless the order of stories inside getStories

Screenshots

https://github.com/storybookjs/react-native/assets/124141134/64509e64-4ad8-49e2-826b-1e2fb551e825

Code snippets

System: Storybook Environment Info:

System: OS: macOS 13.1 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn <----- active npm: 8.5.0 - /usr/local/bin/npm Browsers: Chrome: 116.0.5845.187 Safari: 16.2 npmPackages: @storybook/addon-actions: ^6.5.16 => 6.5.16 @storybook/addon-controls: ^6.5.16 => 6.5.16 @storybook/addon-ondevice-actions: ^6.5.6 => 6.5.6 @storybook/addon-ondevice-controls: ^6.5.6 => 6.5.6 @storybook/react-native: ^6.5.6 => 6.5.6

Additional context

dannyhw commented 9 months ago

@gunti96 Reordering the requires shouldn't matter, that would suggest to me theres a different issue with your story or something. Are you able to provide a reproduction of the issue in a public repo?

dannyhw commented 8 months ago

since there has been no response I'm closing this for now, let me know if you want to reopen

bsheikh commented 8 months ago

Getting a similar issue, but this is after upgrading to React 18. Does react-native storybook support react 18?

dannyhw commented 8 months ago

there is no difference for react 18, if you have a reproduction then I can try to offer more insight but I can't tell what your problem is without more details.

dannyhw commented 8 months ago

@bsheikh I just published a potential fix in 6.5.7 can you check