简体   繁体   English

为什么在react-navigation中无法访问TabRouter中的参数?

[英]Why can't access params in TabRouter in react-navigation?

In react-navigation I am navigating doing props.navigate("Page", { index: 1 }) in a react component. react-navigation中,我正在对react组件中的props.navigate("Page", { index: 1 })进行导航。

So I am creating a TabRouter with createNavigator in a way like this: 所以我用createNavigator的方式用createNavigator创建一个TabRouter

import {
    TabRouter,
    createNavigator
} from "react-navigation";

createNavigator(TabRouter(Page: {
    screen: Page,
    path: "page/:page"
}))(NavView)

Then I can't access to navigation.state.params.index , but I can if using StackRouter instead. 然后,我无法访问navigation.state.params.index ,但我可以的,如果使用StackRouter代替。

any thoughts? 有什么想法吗?

拉取请求旨在将setState添加到TabRouter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 似乎无法访问反应导航中的参数 - Can't seem to access the params in react navigation 无法解决反应导航/核心 - Can't resolve react-navigation/core 开玩笑 + react-navigation 未定位路线/参数 - Jest + react-navigation not locating route / params 即使遵循 react-navigation 文档,react-navigation 也无法在屏幕之间导航 - react-navigation can't navigate between screens even after following react-navigation docs 反应导航goBack不起作用 - react-navigation goBack doesn't works 如何从不是 HomeScreen 的组件内部访问 react-navigation? - How do I access react-navigation from inside a component that isn't the HomeScreen? 找不到模块:无法解析'@react-navigation/stack' React-Native - Module not found: Can't resolve '@react-navigation/stack' React-Native 我不知道如何在子组件中使用反应导航 - I can't figure out how to use react-navigation in a child component 无法在 useEffect 中使用来自 react-navigation 的“useIsFocused()”作为依赖项设置状态 - Can't setState inside useEffect with "useIsFocused()" from react-navigation as dependency 无法解析“../SecondApp\\node_modules\\react-navigation-stack\\lib\\module\\navigators”中的“react-navigation” - Can't resolve 'react-navigation' in '../SecondApp\node_modules\react-navigation-stack\lib\module\navigators'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM