How to use mobx in react-native 0.56 (Babel 7) with Decorators
Ok, i solved all the errors by adding @babel/runtime
, now the app works in DEBUG
and RELEASE
too.
Here the correct configuration:
package.json
..."devDependencies": { "@babel/core": "7.0.0-beta.47", "@babel/plugin-proposal-decorators": "7.0.0-beta.47", "@babel/plugin-transform-runtime": "7.0.0-beta.47", "@babel/runtime": "7.0.0-beta.47", "babel-jest": "23.2.0", "babel-preset-react-native": "5.0.2", "jest": "23.3.0", "react-test-renderer": "16.4.1"}...
.babelrc
{ "presets": [ "react-native" ], "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], ["@babel/plugin-transform-runtime", { "helpers": true, "polyfill": false, "regenerator": false }] ]}
Thanks @Hkan.
I solved this issue by installing @babel/plugin-proposal-decorators@7.0.0-beta.47
and @babel/plugin-transform-runtime@7.0.0-beta.47
.
Versions might change for you. I used those versions because @babel/core
was also at 7.0.0-beta.47
.
Current .babelrc
is:
{ "presets": [ "react-native" ], "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], ["@babel/plugin-transform-runtime", { "helpers": true, "polyfill": false, "regenerator": false }] ]}