-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[request] support CSF 3.0 in 6.0 release #385
Comments
@walkerdb would you be interested in trying out an experimental build with this already working? |
@walkerdb I'll make an npm version from it with canary tag and you just specify that version in package.json. |
Perfect thank you! |
@walkerdb the version is 6.0.1-canary.0 so if you can then give it a try and let me know if you need any assistance |
@walkerdb I've just tried this out myself and it looks like there might be some issues |
so I figured out what's going on, it seems like everything should work fine if you aren't using addon-react-native-web in the same project as the one where you add the new canary build. Something is clashing there for some reason. There is also now a dependency on react-dom which hopefully won't be the case for the final version. |
here's an example project on rn-cli with it working |
aw nuts we're a react-native-web project. Can give it a go later this week and see what happens |
well I'll figure out the problem when I get some time this week, I think it's probably just some version clashes or something. |
@walkerdb I found the problem and it wasn't actually a problem with the web. I'll put out a 6.0.1-canary.1 soon so it can be tested. |
6.0.1-canary.1 is now released, give it a try if you can |
@dannyhw gave it a go, am hitting the following when I try to open our storybook app
debug mode in the sim gives barely any more info than that, I'm not finding the stack trace there helpful at all:
The I cut the app down to just one story, rendering something directly from react-native to narrow down any issues with our code specifically. Here's current state: // src/components/typography/src/Text.stories.tsx
import React from 'react';
import { Text } from 'react-native';
import { ComponentMeta, ComponentStoryObj } from '@storybook/react';
export default {
title: 'INTERNAL/Typography/Text',
component: Text,
args: {
children: 'The quick onyx goblin jumps over the lazy dwarf',
},
} as ComponentMeta<typeof Text>;
export const Default: ComponentStoryObj<typeof Text> = {}; // storybook-native/main.js
module.exports = {
stories: ['../src/components/typography/src/Text.stories.?(ts|tsx|js|jsx)'],
addons: [],
}; // storybook-native/Storybook.tsx
import { getStorybookUI } from '@storybook/react-native';
import './storybook.requires';
const StorybookUIRoot = getStorybookUI({});
export default StorybookUIRoot; // storybook-native/storybook.requires.js
/* do not change this file, it is auto generated by storybook. */
import {
configure,
addDecorator,
addParameters,
addArgsEnhancer,
} from "@storybook/react-native";
import { decorators, parameters } from "./preview";
if (decorators) {
decorators.forEach((decorator) => addDecorator(decorator));
}
if (parameters) {
addParameters(parameters);
}
const getStories = () => {
return [require("../src/components/typography/src/Text.stories.tsx")];
};
configure(getStories, module, false); // index.js
import { AppRegistry } from 'react-native';
import StorybookUIRoot from './storybook-native/Storybook';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => StorybookUIRoot); // metro.config.js
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
resolverMainFields: ['sbmodern', 'react-native', 'browser', 'main'],
},
}; // babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset', '@babel/preset-typescript'],
}; commands I'm running: yarn add @storybook/[email protected]
npx storybook upgrade # get latest of storybook core, currently installs 6.5.13
yarn sb-rn-get-stories --config-path storybook-native
yarn react-native start --reset-cache --verbose then I'm starting the app from xcode. Some versions:
Any thoughts? Also happy to provide any more info if needed. |
@walkerdb i fixed this in 6.0.1-canary.3 i believe |
Canary 3 works!! All of our existing Thank you so much! Anything else we could test for you? |
Awesome! Thanks so much for testing it. Are you using add-ons and so on? Everything working as normal? |
Yeah it's been an issue since I added csf support, its something I have on my mind to get fixed and I know the right person to ask so there might be some progress on that front soon 🤞. |
ok nice! It's not actually a huge issue for us since we largely document our design system through web, with the native storybook just being a place to validate things do work on native - generally with these canary changes we're fully up and running. Thanks again for the help! |
@walkerdb I've just published these changes to 6.0.1-beta.9 since it all seems to be working now. |
going to go ahead and call this one closed since things seem to be working for us under the new beta. Thanks! |
@walkerdb fyi I have some experimental changes that will allow for auto args detection when using typescript. Let me know if you want to test it out. |
yeah would be happy to! |
@walkerdb hey sorry it took a while to get back to you but I actually made a quick post about how to get auto args working. It should work in beta-10 https://dev.to/dannyhw/automatic-args-in-react-native-storybook-140a |
Is your feature request related to a problem? Please describe.
Attempting to render a story using CSF 3.0 format on beta 8 results in a redbox error
Describe the solution you'd like
Rendering stories via CSF 3.0 Just Works™
Describe alternatives you've considered
CSF 2.0 format seems to work fine.
Additional context
We may be able to help with this but we're quite low context on the internals of storybook
The text was updated successfully, but these errors were encountered: