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

React Native 0.16.0 won't work with decorators #53

Closed
pietropizzi opened this issue Dec 2, 2015 · 3 comments
Closed

React Native 0.16.0 won't work with decorators #53

pietropizzi opened this issue Dec 2, 2015 · 3 comments

Comments

@pietropizzi
Copy link

RN 0.16.0 comes with Babel 6. So for one thing the syntax of all babel.rc files needs changing (right?) and as mentioned in the 0.16.0-rc release message https://github.com/facebook/react-native/releases/tag/v0.16.0-rc:

Decorators won't work until T2645 lands in Babel.

I tried upgrading my project to the RC and even after changing the syntax of my .babelrc to include

"plugings: ["transform-decorators"]

I still get this error:

simulator screen shot 02 12 2015 10 31 35

Any plans around this for when 0.16.0 stable lands?

@ide
Copy link
Member

ide commented Dec 2, 2015

0.16 is unfortunately going to break a lot of existing projects for this specific reason. Until there's a Babel 6 port of the Babel 5 decorators plugin, a lot of early adopters of RN are stuck.

Looking into the complexity of writing the plugin, my current thinking is the best way forward is for someone who works on Babel to add support for Babel 5 decorators. Facebook doesn't use decorators but insofar as they care about open source and the external community, fixing decorators would simultaneously boost Babel 6 adoption and RN 0.16 adoption. Specifically for RN 0.16, several early adopters who have been providing feedback and helping improve RN aren't going to be using the latest releases.

If you can help convince Facebook / Babel experts to implement support for decorators that'd be great. But open source is not Facebook's primary mission either so it's kind of a hard sell.

@pietropizzi
Copy link
Author

I see, that's quite unfortunate.

Have you thought about removing the requirement for decorators in this repo? As far as I can tell it is just a couple of @autobind that could be done with property initializers too, right?

@ide
Copy link
Member

ide commented Dec 2, 2015

I'm not 100% sure but the binding semantics of class properties might change too. It's probably the right short term solution to manually bind in the constructor but fixing the Babel issue is a scalable solution.

@ide ide closed this as completed in 757b7f9 Dec 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants