react-native - 如何在 React-Native 模态中定义 Stack Navigator?
问题描述
我想在我的 React-native 模态中使用堆栈导航器。有什么办法可以解决我的问题吗?
解决方案
我认为你的方法是错误的。您可以将新场景添加到您的 stackNavigator 并设置为 mode:'modal' 和 headerShown: false 使用此道具,您可以将场景作为模态打开。同样使用此方法,您可以将此场景用作自定义模态并对其进行修改。
这是示例:
<WorkFormNavigator.Navigator {...props} mode="modal">
<WorkFormNavigator.Screen
name={Modules.WorkForm.WorkForms}
component={WorkForms}
options={{title: ModuleScreenNames.WorkForms, headerShown: false}}
/>
如果您打算在模态(导航道具)中使用导航,您可以获取道具并将它们发送到您的模态,现在您可以在此处使用它们。
const MyScene = ({navigation}) => {}
export default MyScene;
推荐阅读
- sql - SQL查询多个多值
- wordpress - 具有多个 ACF 分类法的 Wp_Query - 类别和标签
- r - 在 R 中循环相同的动作
- json - 该项目无法识别 AsyncSnapshot
- github-actions - 如果有使用 GitHub Action 的 git 标签,则将标签添加到 Docker 映像
- javascript - 表达错误处理程序不适用于给定的 http 状态代码和自定义消息
- winapi - 如何根据文本大小自动正确增长标签?
- javascript - JavaScript FormData 排序条目(没有 jQuery)
- php - WooCommerce:在结帐页面中默认为未登录用户设置国家/地区
- c++ - C++中无与伦比的组的位置是什么?