Open kburnik opened 6 years ago
any solution for this ?
It's been a while since I've worked with react-native and babel. As I recall, I fixed my problem by removing all autobind annotations and binding all the methods in the constructor manually. I used a python script and some regex magic to do most of the replacements.
Thank you!
I am using RN 0.61.5, react 16.9.0, and I solve the problem by adding this line to babel.config.js "plugins": [ ["@babel/plugin-proposal-decorators", {"legacy": true}] } Actually I got a clue from your babel.rc file configuration @kburnik posted here.
Glad it helped. :-)
P.S. I think I had tinkered around with what you suggested but that didn't work out. That's why after a few hours, I decided to remove autobind.
I'm attempting to upgrade my project to react-native 0.57.1, due to a multitude of reasons and issues with the current versions of packages.
Seems core-decorators are broken by Babel 7 or something else is amiss.
I ran
Same issue with
run-ios
on mac.Essentially we only use
@autobind
on methods and these decorators seem not to work.E.g.
So this happens during runtime (i.e. the metro bundler finishes ok).
BTW, I tried using the replacement autobind-decorator package, but also get an error, seems Babel 7 isn't welcoming these decorators...
Any input would be appreciated.
My package.json
My .babelrc
BTW, this works just fine with old react-native, see my OLD package.json:
Please let me know if you had and resolved the issue or have a suggestion on how to approach this.