diff --git a/README.md b/README.md index 10d77436..4f0c6af7 100644 --- a/README.md +++ b/README.md @@ -99,24 +99,31 @@ yarn add @ant-design/react-native ### Installing peer dependencies ```bash -npm install @react-native-community/segmented-control @react-native-community/slider +npm install @react-native-community/segmented-control @react-native-community/slider @ant-design/icons-react-native react-native-gesture-handler ``` or ```bash -yarn add @react-native-community/segmented-control @react-native-community/slider +yarn add @react-native-community/segmented-control @react-native-community/slider @ant-design/icons-react-native react-native-gesture-handler ``` > You need go to ios folder and run `pod install` (auto linking),Android will handle it by itself. ### Link icon fonts +```js +// config `react-native.config.js` in project’s root directory +module.exports = { + assets: ['node_modules/@ant-design/icons-react-native/fonts'], +}; +``` +then ```bash -npx react-native link +npx react-native-asset ``` -[introduce](docs/react/introduce.en-US.md#安装) +[introduce](docs/react/introduce.en-US.md#2-installation) ## Links diff --git a/README.zh-CN.md b/README.zh-CN.md index ae8f6217..324d8704 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -110,14 +110,22 @@ yarn add @react-native-community/segmented-control @react-native-community/slide > 安装完依赖后需要到 iOS 目录 `pod install`(auto linking),Android 不需要手动处理 -### 链接字体图标以及自动链接 +### 链接字体图标 + +```js +// 配置根目录下的 `react-native.config.js` 文件 +module.exports = { + assets: ['node_modules/@ant-design/icons-react-native/fonts'], +}; +``` +然后 ```bash -# 手动链接字体图标 -npx react-native link +# 手动执行命令 +npx react-native-asset ``` -[介绍](docs/react/introduce.zh-CN.md#安装) +[介绍](docs/react/introduce.zh-CN.md#2-安装) ## 链接 diff --git a/docs/react/introduce.en-US.md b/docs/react/introduce.en-US.md index 6f2b9b2d..4c794994 100644 --- a/docs/react/introduce.en-US.md +++ b/docs/react/introduce.en-US.md @@ -80,9 +80,21 @@ or $ yarn add @ant-design/icons-react-native ``` +
+Add assets to your `react-native.config.js` ( If not exist, please create in project’s root directory ) + +```js +module.exports = { + assets: ['node_modules/@ant-design/icons-react-native/fonts'], +}; +``` + +Run the [`react-native-asset`](https://github.com/unimonkiez/react-native-asset)'s command and linking + unlinking is automatic + ```bash -$ npx react-native link @ant-design/icons-react-native +npx react-native-asset ``` +
> If you are using expo please make sure fonts has been loaded diff --git a/docs/react/introduce.zh-CN.md b/docs/react/introduce.zh-CN.md index 503dffd4..c1f82115 100644 --- a/docs/react/introduce.zh-CN.md +++ b/docs/react/introduce.zh-CN.md @@ -80,9 +80,22 @@ or $ yarn add @ant-design/icons-react-native ``` +
+ +将字体资源路径配置到根目录下的 `react-native.config.js` 文件中 ( 如果没有,请创建 ) + +```js +module.exports = { + assets: ['node_modules/@ant-design/icons-react-native/fonts'], +}; +``` + +然后执行[`react-native-asset`](https://github.com/unimonkiez/react-native-asset)的命令 + ```bash -$ npx react-native link @ant-design/icons-react-native +npx react-native-asset ``` +
> 如果你用的是 expo 请确保字体已经加载完成再初始化 app diff --git a/package.json b/package.json index 746421b1..6b336580 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ant-design/react-native", - "version": "5.1.1", + "version": "5.1.2", "description": "基于蚂蚁金服移动设计规范的 React Native 组件库", "keywords": [ "ant", @@ -24,14 +24,12 @@ }, "files": [ "lib", - "es", - "react-native.config.js" + "es" ], "license": "MIT", "main": "lib/index.js", "module": "es/index.js", "dependencies": { - "@ant-design/icons-react-native": "^2.3.1", "@bang88/react-native-ultimate-listview": "^4.1.0", "@types/shallowequal": "^1.1.1", "babel-runtime": "^6.x", @@ -42,7 +40,6 @@ "rc-util": "^4.21.1", "react-native-codegen": "^0.0.7", "react-native-collapsible": "^1.6.0", - "react-native-gesture-handler": "~2.2.1", "react-native-modal-popover": "^2.0.1", "shallowequal": "^1.1.0", "utility-types": "^3.10.0" @@ -99,10 +96,12 @@ "typescript": "^4.3.2" }, "peerDependencies": { + "@ant-design/icons-react-native": ">= 2.3.1", "@react-native-community/segmented-control": ">= 1.4.0", "@react-native-community/slider": ">= 2.0.0", "react": ">=17.0.1", - "react-native": ">=0.64.1" + "react-native": ">=0.64.1", + "react-native-gesture-handler": ">=2.2.1" }, "scripts": { "lint": "npm run tslint && npm run srclint && npm run applint",