-
-
Notifications
You must be signed in to change notification settings - Fork 174
Description
Describe the bug
Once i provision Storybook into a brand new React Native app (via react native cli, not expo), add @babel/plugin-proposal-decorators to dev dependencies, and provision the plugin in babel.config.js, app builds but crashes on launch (see screenshot).
To Reproduce
Steps to reproduce the behavior:
npx react-native init StorybookIssue && cd StorybookIssuenpx -p @storybook/cli sb init --type react_native- add
export {default} from './storybook';to App.js; comment/removeexport default App; yarn add -D @babel/plugin-proposal-decoratorscd ios && pod install && cd ..open ios/StorybookIssue.xcworkspace/- Run app on xcode
- see crash
Expected behavior
See Storybook Demo preview ("Hello Button"). Happy to provide a repo to repro the issue, but i figured repro steps were simple enough.
Code snippets
// babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [['@babel/proposal-decorators', {decoratorsBeforeExport: true}]],
};
System
Environment Info:
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
Browsers:
Chrome: 86.0.4240.193
Safari: 14.0
npmPackages:
@storybook/addon-actions: ^5.3 => 5.3.21
@storybook/addon-knobs: ^5.3 => 5.3.21
@storybook/addon-links: ^5.3 => 5.3.21
@storybook/addon-ondevice-actions: ^5.3.23 => 5.3.23
@storybook/addon-ondevice-knobs: ^5.3.23 => 5.3.23
@storybook/react-native: ^5.3.23 => 5.3.23
@storybook/react-native-server: ^5.3.23 => 5.3.23
Additional context
There's no issue using legacy: true option for plugin, but unfortunately the app i'm adding storybook to uses decoratorsBeforeExport: true option. The repro steps are for a brand new app (for testing). Existing app works fine with this babel plugin.
