美文网首页
React Native入门3(react-navigation

React Native入门3(react-navigation

作者: again龙 | 来源:发表于2020-04-14 11:41 被阅读0次

大部分APP项目页面以TabBar和NavigationBar为主,默认创建的项目中没有navigation,需要引入@react-navigation组件。

1、

npm install @react-navigation/native

1)安装到Expo管理的项目中

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

2)安装到本地项目中

npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view

iOS安装完后需要pod install

npx pod-install ios

2、使用,因为需要在整个项目中使用,所以要在项目的入口文件中引入NavigationContainer

import 'react-native-gesture-handler';

import * as React from 'react';

import { NavigationContainer } from '@react-navigation/native';

相关文章

网友评论

      本文标题:React Native入门3(react-navigation

      本文链接:https://www.haomeiwen.com/subject/vjyzmhtx.html