addon-smart-knobs icon indicating copy to clipboard operation
addon-smart-knobs copied to clipboard

React Native?

Open rammoozz opened this issue 6 years ago • 3 comments

are there any plans for bringing smart knobs over to React Native Storybook? (onDevice Addons)

rammoozz avatar Nov 13 '18 20:11 rammoozz

I assumed this would work out of the box - unless we're both missing something i can get knobs to work but not smart knobs 👎 so +1 for this.

rory-pickering avatar Jan 21 '19 12:01 rory-pickering

Doing a bit of research on this I can see the difference is __docgenInfo is undefined in react-native. Can write a workaround for this, but I'm going to try and figure out why this is the case first.

kyle-ssg avatar Oct 11 '19 13:10 kyle-ssg

@rkhayat @rory-pickering Although this is a workaround, I've got this working for react native here https://github.com/kyle-ssg/addon-smart-knobs. Basically I've added my own parser for prop types as there's docgen support in React Native.

Parsing prop types https://github.com/kyle-ssg/addon-smart-knobs/blob/master/dist/index.js#L17

Using the parser https://github.com/kyle-ssg/addon-smart-knobs/blob/master/dist/index.js#L269

kyle-ssg avatar Oct 11 '19 15:10 kyle-ssg