前言
- 官方文档地址:rn.mobile.ant.design/index-cn
- 官方 github 仓库地址:github.com/ant-design/…
项目目前维护情况
- Ant Design React Native 版本从 3.x 版本开始蚂蚁金服不再维护该项目,现在由我 Github 维护
- 不过从 github 仓库的提交频率上,这个仓库目前还是维护的比较频繁的。
安装
npm install @ant-design/react-native --save
or
yarn add @ant-design/react-native
安装依赖
npm install @react-native-community/cameraroll @react-native-picker/picker @react-native-community/segmented-control @react-native-community/slider react-native-pager-view
or
yarn add @react-native-community/cameraroll @react-native-picker/picker @react-native-community/segmented-control @react-native-community/slider react-native-pager-view
配置按需引入
-
安装依赖
npm i babel-plugin-import or yarn add babel-plugin-import
-
配置 babel.config.js
//babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
"plugins": [ // ant按需引入
["import", { libraryName: "@ant-design/react-native" }] // 与 Web 平台的区别是不需要设置 style
]
};