【发布时间】:2020-06-06 19:50:42
【问题描述】:
我按照这个tutorial 将react-native-web 添加到react-native 项目。但
将react-native-vector-icons 添加到项目时出现错误。
./node_modules/react-native-vector-icons/lib/create-icon-set.js
SyntaxError: /home/hamidreza/Desktop/myApp/node_modules/react-native-vector-icons/lib/create-icon-set.js: Support for the experimental syntax 'classProperties' isn't currently enabled (43:22):
41 |
42 | class Icon extends PureComponent {
> 43 | static propTypes = {
| ^
44 | allowFontScaling: PropTypes.bool,
45 | name: IconNamePropType,
46 | size: PropTypes.number,
我还将我的babel.config.js 更改为:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
],
};
或
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
'@babel/plugin-proposal-class-properties'
],
};
但还是有问题。
我该怎么办?
【问题讨论】:
标签: javascript react-native babeljs react-native-web react-native-vector-icons