我需要从create-react-native-app生成的项目中将{"plugins": [["import", { "libraryName": "antd-mobile" }]]}添加到.babelrc中,以使蚂蚁设计-移动在react本机中工作。
我用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有人能给我找个解决办法吗?
发布于 2017-05-17 12:42:29
您可以查看官方的react本地应用程序演示:https://github.com/ant-design/antd-mobile-samples/tree/master/react-native。
https://stackoverflow.com/questions/44016412
复制相似问题