react navigation 多页面路由

1.安装集成 react navigation

复制代码
1.项目初始化后,集成React Navigation在项目根目录运行命令:

expo install react-navigation

react-native-gesture-handler

react-native-reanimated

react-native-screens

2.在已创建的项目中安装 React Navigation ,在项目根目录下运行命令:
yarn add react-navigation
yarn add react-native-reanimated
yarn add react-native-gesture-handler
yarn add react-native-screens @'1.0.0-aipha.23'
复制代码

2.为了完成 react-native-screens在Andriod上的安装,请在android/app/build.gradle中dependencies选项中添加下面这两行:

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

3. 添加栈 

yarn add react-navigation-stack

 4. 遇到 Unable to resolve module react-native-safe-area-context错误

yarn add react-native-safe-area-view react-native-safe-area-context

5. 遇到@react-native-community/masked-view 错误

 

 运行命令

npm install @react-native-community/masked-view

 

posted @   创客未来  阅读(274)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示