ant-design-mobile 是否与 create-react-native-app 一起使用?

Does ant-design-mobile work with create-react-native-app?

我需要从 create-react-native-app 生成的项目中将 {"plugins": [["import", { "libraryName": "antd-mobile" }]]} 添加到 .babelrc 以使 ant-design-mobile 工作在本机反应中。

我用 create-react-native-app 开始了一个新项目。 将 .babelrc 更改为:

 {
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source",
      ]
    }
  },
  "plugins": [
    ["import", { "libraryName": "antd-mobile" }]
  ]
}

Class:

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

任何人都可以指出解决方案吗?

你可以看看官方的react-native app demo:https://github.com/ant-design/antd-mobile-samples/tree/master/react-native