react native中引入antd-mobile

1.安装antd-mobilebabel-plugin-import

yarn add antd-mobile react-dom
yarn add --dev babel-plugin-import

2.编辑 .babelrc

{"plugins": [["import", { "libraryName": "antd-mobile" }]]}

3.使用

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { Button } from 'antd-mobile';

class HelloWorldApp extends Component {
  render() {
    return <Button>Start</Button>;
  }
}

AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);

猜你喜欢

转载自blog.csdn.net/qq_35844177/article/details/79208261