美文网首页
ReactNative升级到0.56以后,装饰器无法使用

ReactNative升级到0.56以后,装饰器无法使用

作者: 飞奔在路上 | 来源:发表于2018-10-11 09:45 被阅读99次

解决方案

  1. 移除babel-plugin-transform-decorators-legacy
  2. npm install --save-dev @babel/plugin-proposal-decorators
  3. 配置.babelrc文件
{
    "presets": ["module:metro-react-native-babel-preset"],
    "plugins":[["@babel/plugin-proposal-decorators", { "legacy": true }]]
}

相关文章

网友评论

      本文标题:ReactNative升级到0.56以后,装饰器无法使用

      本文链接:https://www.haomeiwen.com/subject/ihivaftx.html