storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
1.07k stars 155 forks source link

React-native-navigation with Storybook v6 #474

Closed jvenus99 closed 1 year ago

jvenus99 commented 1 year ago

I can't find anything that solves how to solve the error in components that use navigation for Storybook v6, as in the web version I have an addon for react-router, is there something similar for react-native-navigation in version 6?

dannyhw commented 1 year ago

@jvenus99 you can add a decorator that wraps the story with the navigation provider

jvenus99 commented 1 year ago

I am using that in version 5, that decorator still working in version 6?

dannyhw commented 1 year ago

I don't know any reason why it wouldn't work.

in csf you can add decorators like this

export const ButtonPrimary = {
  decorators: [
    (Story) => <Provider><Story/></Provider>
  ];
}
jvenus99 commented 1 year ago

Cool, I was waiting for the addon for react-native-navigation to update my project, but now with the decorator I can use it, in the future will you make the addon for navigation?