我的reactNative项目用到的插件、组件及依赖

本文详细介绍了如何从零开始搭建ReactNative项目,包括安装ReactNative基础环境、配置react-navigation进行页面跳转、安装并集成UI组件库@ant-design/react-native、实现按需加载、安装轮播图组件react-native-swiper及底部导航react-navigation-tabs等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我的第一个reactNative项目用到的插件、组件及依赖

  1. 安装reactnative
npx react-native init NavStudy --version 0.60.0  //版本号自行定义
  1. 安装react-navigation
 npm install react-navigation
  1. 安装这些运行时依赖
    ( react-native-reanimated
    react-native-gesture-handler
    react-native-screens
    react-native-safe-area-context
    @react-native-community/masked-view)
npm install react-native-reanimated  react-native-gesture-handler react-native-screens  react-native-safe-area-context   @react-native-community/masked-view
  1. 安装navigatior库
 npm install react-navigation-stack
  1. 安装reactnative的UI组件库
npm install @ant-design/react-native --save

npm install @ant-design/icons-react-native
react-native link @ant-design/icons-react-native //链接所有的图标

或 (连接失败的情况下,升级@ant-design/react-native 到4.0.0,执行下列命令)

npx react-native link

6. 安装babel-plugin-import(按需加载)(使用ant-design,会按需加载)
npm install --save-dev  babel-plugin-import

然后在 babel.config.js中添加

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  "plugins": [
    ["import", { "libraryName": "@ant-design/react-native"}]
  ]
};

在所需要的的页面引入

import { Button } from '@ant-design/react-native';



  1. 安装轮播图组件
npm install --save react-native-swiper
  1. 安装react-navigation-tabs,底部导航
npm install react-navigation-tabs --save
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值