问题标签 [react-navigation]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
6404 浏览

reactjs - React Navigation: How to update navigation title for parent, when value comes from redux and gets updated in child?

I'm using react-navigation and have a StackNavigator with a ParentScreen and a ChildScreen.

Both screens have the same navigation bar with a dynamic value from redux. Implemented like described in Issue #313

This works as expected. When I'm in DetailScreen and I update the value for the count variable, it also updates the value in the navigation bar.

Problem is, if I go back to the parent scene, there is still the old value in the navigation bar. It doesn't update to the current value in redux store.

Child

screen shot 2017-04-11 at 15 20 28

Parent (when I go back)

screen shot 2017-04-11 at 15 21 31

ChildScreen

ParentScreen

Any advice?

0 投票
2 回答
7047 浏览

ios - 找不到变量:导航 - ReactNative 导航

几天以来,我一直在尝试解决这个问题。我想推动导航堆栈并导航到另一个视图。我在这里提到了这个官方文件。https://reactnavigation.org。但我没有成功。请谁能告诉我我在哪里做错了。

甚至这个标题也没有出现。

这是我的 Login.js 代码。

0 投票
1 回答
382 浏览

javascript - 如何在 React-native 组件之间导航?

当我点击 <TouchableOpacity onPress= this.onPressCheckParkingStatus.bind(this)}>

它显示错误Navigator: Cannot read property 'push' of undefined 尽管它在Login.js to Floor.js. 但它不工作FloorItem.js

这是我的组件结构:-

有很多js,但上面提到的都是必需的。

登录.js

我在这里没有提到 CSS,因为文件变得庞大。在登录点击它正在重定向到所需的楼层组件。在地板组件中,我继承了FloorItem

我的导航器正在从登录到楼层工作。我正在将 FloorItem 作为 Floor 类中的组件加载,这是我的问题:-

我没有得到基于组件的导航器示例,这就是我在这里提出问题的原因。提前致谢。我现在受够了。我不知道为什么它在一个组件上工作而不在其他组件上工作。

0 投票
1 回答
2661 浏览

reactjs - React Navigation - 从 TabNavigator 导航到 StackNavigator

我正在尝试使用重置操作从 TabNavigator 中的一个选项卡导航到 StackNavigator 中的屏幕。这是(缩写)代码:

我正在尝试从Friends进入FriendsNavigatorLogin进入Main并重置堆栈(就像用户正在注销一样)。有没有人有任何想法?

0 投票
0 回答
204 浏览

react-native - react-navigation TabNavigator screen flex:1 显示奇怪

当我使用 TabNavigator 时, flex:1 会显示这个,

使用 TabNavigator 在此处输入图像描述

当我不使用 TabNavigator 时,flex:1 将显示此 不使用 TabNavigator 在此处输入图像描述

0 投票
1 回答
2602 浏览

javascript - 反应导航自定义 OnClick

我正在尝试在屏幕中间制作一个按钮,单击该按钮将导航用户,并且我正在使用 react-navigation 库。如果没有 stackNavigator、HeaderNavigator 或 DrawerNavigator,我该怎么做?

0 投票
0 回答
369 浏览

reactjs - 如何在 ignite react-navigation 中传递道具?

我想将一个组件的参数传递给另一个组件,下面是我的代码。

以下是我如何尝试获取值并且我收到 NULL。

输出 在此处输入图像描述

当我尝试调试器时,我得到了以下结果。

在此处输入图像描述

我正在尝试获取 mobileNo 变量。

0 投票
4 回答
10960 浏览

reactjs - React-native/react-navigation:如何从“静态导航选项”访问组件的状态?

例如,当您有一个表单组件并且需要使用导航栏中的按钮提交组件的一部分状态时,您如何处理这种情况?

0 投票
3 回答
9841 浏览

react-native - 如何使用 ReactNavigation 判断视图何时出现

我正在使用 ReactNavigation 并且想知道如何判断视图何时出现(以便我可以触发数据刷新)。我看到这个示例使用不同的导航器 NavigatorIOS - 是否有 viewDidAppear 或 viewWillAppear 等效项?但不确定它如何与https://reactnavigation.org/一起使用。

我在导航调度上看到了 console.log - 但是是否有一些事件处理程序可以挂接到屏幕/组件级别以了解该组件/屏幕是否在前台?我应该getStateForAction以某种方式挂钩该方法吗? https://reactnavigation.org/docs/routers/api。我不想真正创建自定义路由处理程序本身,只是为了检测视图是否进入前台/是否会出现,我猜我可以使用导航事件以某种方式做到这一点。

0 投票
2 回答
1313 浏览

javascript - 未定义不是对象(评估“this.props.navigator.replace”)

我按照教程使用 React-Navigation,尝试移动到另一个页面时遇到问题。我收到此错误:Undefined is not an object (evaluating 'this.props.navigator.replace')

我在这里和其他网站上搜索过,但对我没有任何帮助。这是我的代码:

指数:

路由器:

登录(点击这里的按钮,出现问题):

我究竟做错了什么 ?

提前致谢。