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