Mac中react-native 环境的搭建、react-navigation路由 环境搭建、react-native-vector-icons 安装图标

react-native 环境的搭建

  1. 全局安装
sudo npm i watchman react-native-cli -g

2.构建项目

react-native init +项目名

安装过程中勾选gem cocospods … 即可

3.启动项目

npm run ios

react-navigation路由 环境搭建 实现路由跳转功能

1.在项目目录安装

npm install --save react-navigation-tabs react-navigation react-native-gesture-handler react-navigation-stack @react-native-community/masked-view 
npm i react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context -S

2.cd ios文件夹

pod install

3.启动项目即可

native-vector-icons 安装图标

1.在项目目录安装

npm install --save react-native-vector-icons

2.找到info.plist文件(ios—项目名文件夹—info.plist)
将以下代码复制到文件末尾 后面

<key>UIAppFonts</key>
<array>
  <string>AntDesign.ttf</string>
  <string>Entypo.ttf</string>
  <string>EvilIcons.ttf</string>
  <string>Feather.ttf</string>
  <string>FontAwesome.ttf</string>
  <string>FontAwesome5_Brands.ttf</string>
  <string>FontAwesome5_Regular.ttf</string>
  <string>FontAwesome5_Solid.ttf</string>
  <string>Foundation.ttf</string>
  <string>Ionicons.ttf</string>
  <string>MaterialIcons.ttf</string>
  <string>MaterialCommunityIcons.ttf</string>
  <string>SimpleLineIcons.ttf</string>
  <string>Octicons.ttf</string>
  <string>Zocial.ttf</string>
</array>

3.cd ios 执行
js pod install

4.启动项目即可

你可能感兴趣的:(react,native)