Skip to content

Crash: undefined is not an object (evaluating '_this.props.updateCellsBatchingPeriod') when using @babel/proposal-decoratorsΒ #133

@jeremyeaton89

Description

@jeremyeaton89

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:

  1. npx react-native init StorybookIssue && cd StorybookIssue
  2. npx -p @storybook/cli sb init --type react_native
  3. add export {default} from './storybook'; to App.js; comment/remove export default App;
  4. yarn add -D @babel/plugin-proposal-decorators
  5. cd ios && pod install && cd ..
  6. open ios/StorybookIssue.xcworkspace/
  7. Run app on xcode
  8. 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.

Screenshots
Screen Shot 2020-11-09 at 12 19 50 PM

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions