Skip to content
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

undefined is not an object (evaluating 'regeneratorRuntime.mark') in react native on generator functions #2080

Closed
macrozone opened this issue Oct 18, 2017 · 7 comments

Comments

@macrozone
Copy link
Contributor

macrozone commented Oct 18, 2017

when exporting a generator function * () {}

e.g.

export default function() * {}

(which is common when using redux-saga)

this error is thrown in the app when its started with storybook: undefined is not an object (evaluating 'regeneratorRuntime.mark')

looks like this issue: facebook/react-native#14838

but all the solution do not work as every babel plugin is installed and even in newer versions. Any idea whats wrong?

@AndreiCalazans
Copy link

same here
screen shot 2017-10-23 at 15 00 13

the solution for me was to to this
screen shot 2017-10-23 at 15 03 24

instead of this
screen shot 2017-10-23 at 15 03 14

@JCMais
Copy link

JCMais commented Oct 23, 2017

Probably related to this commit facebook/react-native@3103258

The Babel plugin is part of react-native-babel-preset, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js.

@geastwood
Copy link

@macrozone which RN version do you have?

I also run into this problem, the reason is after upgrade to 0.49, RN changed entry point from index.ios.js to index.js, make sure the entry point for storybook is also updated.

@macrozone
Copy link
Contributor Author

@geastwood react native 0.49. Yes the entrypoint for storybook was index.js, otherwise it would not work at all

@matt-oakes
Copy link
Contributor

To fix this I needed to create another .babelrc in the /storybook directory with this content:

{
  "presets": [
    "react-native"
  ]
}

I had to do this even though I had the same file in the root of the project. It doesn't seem to pick this one up.

This workaround is ok, but if possible I think the packager should be able to pick up the babel config from the root repo to avoid duplication and potential issues when it is changed.

@stale
Copy link

stale bot commented Jan 4, 2018

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 60 days. Thanks!

@stale stale bot added the inactive label Jan 4, 2018
@stale
Copy link

stale bot commented Jan 19, 2018

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants