mthuret / storybook-addon-specifications

:book: Write tests next to your stories and display their results inside storybook interface
457 stars 54 forks source link

Support react-native storybook #6

Open thani-sh opened 8 years ago

thani-sh commented 8 years ago

Hi, React Native Storybook supports addons form v2. The specifications addon doesn't seem to work out of the box with it. Got the error below when using with a simple repo. I'll try to find why we're getting this error and send a pull-request if I can.

If there are any Webpack Gurus around here, please check this out.

screen shot 2016-08-26 at 3 53 43 pm

mthuret commented 8 years ago

Is the repo can be access from outside ?

thani-sh commented 8 years ago

Just pushed changes to react-native-button repo. Check the test-specs branch there.

To reproduce the error from a clean app:

npm -g i getstorybook
react-native init MyTestApp
cd MyTestApp
npm install -D storybook-addon-specifications
echo "import 'storybook-addon-specifications/register';" >> storybook/addons.js
npm run storybook
react-native run-ios
thani-sh commented 8 years ago

It works fine if I install the missing babel plugin.

screen shot 2016-08-26 at 6 34 55 pm 2

npm install -D babel-plugin-add-module-exports

This is entirely a storybook side issue. I'll comment here when it's ready.

thani-sh commented 8 years ago

Here's what I found so far:

React Native uses babel config from dependencies to transform them. This error comes when RN tries to use babel config from inline-style-prefixer module (loaded by aphrodite). Unfortunately we can't fix it from react-native-storybook.

The easiest fix is to avoid using aphrodite for now.


Let's assume we fix the above error. The next problem is getting enzyme to run inside react-native. It's also giving an error. To reproduce this error, try running this repo with npm start and react-native run-ios.

screen shot 2016-08-26 at 6 45 03 pm

radwane-h commented 7 years ago

Hey what is the status of the plug-in with react-native ?

mthuret commented 7 years ago

Well, if someone wants to give this a try, I'm all in to add this feature :)

dan-kez commented 7 years ago

I would love for this addon work with react native.

theeheng commented 5 years ago

Am i right to think that this addon is only for react web? because normally react native addon package will have the prefix ''@storybook/addon-ondevice-****". Like knobs addon for web is @storybook/addon-knobs and for react-native is : @storybook/addon-ondevice-knobs