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);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章