我需要 从create-react-native-app生成的项目中添加{"plugins": [["import", { "libraryName": "antd-mobile" }]]}
,以使ant-design-mobile在 react native 中工作。.babelrc
我已经使用create-react-native-app开始了一个新项目。将 .babelrc 更改为:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source",
]
}
},
"plugins": [
["import", { "libraryName": "antd-mobile" }]
]
}
班级:
import { Button } from 'antd-mobile';
export class Screen extends React.Component<any,{}>{
render(){
return(
<View>
<Button>Something</Button>
</View>
)
}
}
但是,我仍然在开始时收到此错误:
Note: must use https://github.com/ant-design/babel-plugin-import .
For more information, please see https://github.com/ant-design/ant-design-mobile/issues/602
谁能指出我的解决方案?