如何刷新到特定屏幕?

Cro*_*ile 5 android reactjs react-native

我是React Native的新手

我有路线外观:

屏幕A->屏幕B->屏幕C

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

但是我知道事实,我得到以前的screenA(不是新的),或者我可以说这就像回到以前的屏幕方法一样。我想要类似于Android Native中的Intent intent = new Intent(ScreenA)。谁能帮助解决?

更新 :

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

StackNavigator {
 screenA,
 screenB
}

TabNavigator {
 screenC
}
Run Code Online (Sandbox Code Playgroud)

我无法使用.push或.dispatch将screenC移至screenA。但是使用.navigate可以很好地工作。但是,如果我使用.navigate,则screenA是先前的屏幕,而不是新的屏幕(类似于我移至screenB之前的屏幕)。我想从screenC移到新的screenA,而不是以前的screenA。

Pra*_*h S 3

尝试

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)
Run Code Online (Sandbox Code Playgroud)

更多信息请参考这里