android - 如何新鲜导航到特定屏幕?

标签 android reactjs react-native

我是 React Native 的新手

我有路线外观:

ScreenA -> ScreenB -> ScreenC

现在我想从 ScreenC 重新导航到 ScreenA,我使用 this.props.navigation.navigate('ScreenA');

But i get the fact, i get previous screenA (not new one) or i can say it is like back to previous screen method. What i want similar to Intent intent = new Intent(ScreenA) in Android Native. Can anyone help to solve it?

更新:

我有 2 个路由组,这可能会导致真正的问题:

StackNavigator {
 screenA,
 screenB
}

TabNavigator {
 screenC
}

I can't move screenC to screenA using .push or .dispatch. But working well using .navigate. But if i use .navigate , screenA is previous screen not new screen (same like before i move to screenB). I want move from screenC to a new screenA not previous screenA.

最佳答案

尝试

import { NavigationActions, StackActions } from 'react-navigation';
//Reset and navigate
    const resetAction = StackActions.reset({
            index: 0,
            actions: [
              NavigationActions.navigate({ routeName: 'YourScreen' })
            ]
          })
          this.props.navigation.dispatch(resetAction);
//Or Navigate
this.props.navigation.navigate("YourScreen");
//Similar to navigate, push will move you forward to a new route in the stack
this.props.navigation.push(routeName, params, action)

有关更多信息,请参阅 here

关于android - 如何新鲜导航到特定屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52870511/

相关文章:

android - Application 子类中的静态变量。 (安卓)

json - 如何将 getJSON 数据绑定(bind)到 ReactJS 状态

javascript - 我如何在 ReactJS 的 ComponentDidMount 中使用 {useState}

javascript - 扩展 TextInput 以在 React Native 中自定义默认字体和文本颜色,就像在 Java 中一样

android - 安装 apk 时出现 java.lang.SecurityException

java - 在 libgdx 中呈现错误的形状? (圆圈显示为菱形)

android - 编写单元测试以检查服务是否已启动

javascript - 使用 useState 添加一个 child 到树

javascript - 通过导航器打开 2 次时,react-native-camera 卡住应用程序

javascript - 警告 : Can't call setState (or forceUpdate) on an unmounted component in React Native