post:增加React Native文章内容。

This commit is contained in:
徐涛 2021-07-16 09:06:03 +08:00
parent ee626923d7
commit 66171e7e01

View File

@ -38,3 +38,21 @@ source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
```
即可完成CocoaPods镜像的切换。
## 连接原生依赖库
在React Native中有一些库是带有原生代码的这些库除了需要使用`npm install`完成安装以外,还需要将原生代码连接进不同平台的应用中。
连接带有原生代码的库非常简单,只需要使用`react native link`命令。例如平时经常会使用的`react-native-safe-area-context`库和`react-native-vector-icons`库,在安装的时候就需要使用以下命令。
```bash
# 安装react-native-safe-area-context
npm install react-native-safe-area-context
npx react-native link react-native-safe-area-context
# 安装react-native-vector-icons
npm install react-native-vector-icons
npx react-native link react-native-vector-icons
```
完成连接以后,就可以在项目中正常的使用完成安装的库了。