反应本机路由器流量动作。currentParams道具

这不是问题,更多是一个奇怪的问题。

我一段时间以来一直在使用actions.currentParams道具来获取当前屏幕上的对象信息,或者进行actions.currentParams.backAndroidHandler()之类的操作来访问传递给RNRF的Router的函数。

我在浏览线程时发现了这个技巧,但是没有任何解释以及它的工作方式。 在RNRF的github上也找不到任何文档。我现在掌握的所有信息都主要基于打印道具进行控制台以及剖析和推测答案。我想这样盲目地操作,而没有我在代码中使用的东西的具体文档,这很烦人。

如果您有任何有关此方面的信息,将非常感谢您提供资料阅读的链接,因为它已经困扰我DAYS了!大声笑

Z584036976 回答:反应本机路由器流量动作。currentParams道具

我在document中发现了一些东西。

看起来有些相关。希望对您有所帮助。

...
onNavigationStateChange = async (prevState,currentState,action) => {
    this.state = currentState;
    this.prevState = prevState;
    const activeState = getActiveState(this.state);
    const currentScene = activeState.routeName;
    this.currentParams = { ...activeState.params,...action.params }; //Here!!
    this.currentScene = currentScene;
    this.prevScene = this.prevState ? getActiveState(this.prevState).routeName : null;
    if (this.currentScene !== this.prevScene) {
      // run onExit for old scene
      this.onExitHandler(this.prevScene);
      setTimeout(() => this.dispatch({
        type: ActionConst.FOCUS,routeName: this.currentScene,params: this.currentParams,}));
      this.onEnterHandler(currentScene);
}
...
本文链接:https://www.f2er.com/2529664.html

大家都在问