在react-native中默认使用decorator会红屏报错,需要安装一个babel插件: 

babel-plugin-transform-decorators-legacy
在react-native中使用es7语法中的decorator装饰器

 

然后在根目录下的.babelrc中添加刚刚安装的插件:
在react-native中使用es7语法中的decorator装饰器

重新运行项目就可以了。

相关文章: