If you are using "@storybook/react-native": "^6.5.4" with last version "@storybook/addon-actions": "^7.0.26", where is a wrong import for argsEnhancers in autogenerated storybook.requires.js
Must be import { argsEnhancers } from "@storybook/addon-actions" instead of import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs"
To Reproduce
Steps to reproduce the behavior:
Add @storybook/addon-ondevice-actions to addons array in main.js
Add this script to your package.json "storybook-generate": "sb-rn-get-stories"
// TODO: implement presets or something similar
if (main.addons.includes('@storybook/addon-ondevice-actions')) {
enhancersImport =
'import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs"';
// try/catch is a temporary fix for https://github.com/storybookjs/react-native/issues/327 until a fix is found
enhancers = `
try {
argsEnhancers.forEach(enhancer => addArgsEnhancer(enhancer));
} catch{}
`;
}
Version 7 isn't compatible with version 6.5, Better to downgrade the v7 to v6.5. Major versions are breaking changes so things can be broken when trying to mix versions.
Describe the bug
If you are using "@storybook/react-native": "^6.5.4" with last version "@storybook/addon-actions": "^7.0.26", where is a wrong import for argsEnhancers in autogenerated storybook.requires.js
Must be
import { argsEnhancers } from "@storybook/addon-actions"
instead ofimport { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs"
To Reproduce
Steps to reproduce the behavior:
@storybook/addon-ondevice-actions
to addons array in main.js"storybook-generate": "sb-rn-get-stories"
yarn storybook-generate
Expected behavior
An app is working
Code snippets
Path: scripts/loader (132 line)
System:
System: OS: macOS 13.4.1 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 18.13.0 Yarn: 1.22.19 npm: 8.19.4 Browsers: Chrome: 114.0.5735.198 Safari: 16.5.1 npmPackages: @storybook/addon-actions: ^7.0.26 => 7.0.26 @storybook/addon-controls: ^7.0.26 => 7.0.26 @storybook/addon-links: ^7.0.26 => 7.0.26 @storybook/addon-ondevice-actions: ^6.5.4 => 6.5.4 @storybook/addon-ondevice-controls: ^6.5.4 => 6.5.4 @storybook/addons: ^7.0.26 => 7.0.26 @storybook/core-common: ^7.0.27 => 7.0.27 @storybook/react-native: ^6.5.4 => 6.5.4 @storybook/react-native-server: ^6.5.4 => 6.5.4