【问题标题】:Actions.replace(key) is not working in react native it is giving error like shown in errorActions.replace(key) 在本机反应中不起作用,它给出错误,如错误所示
【发布时间】:2018-09-20 11:00:23
【问题描述】:
The error generated like this when I am trying to replace scene in 
react native router flux.

Actions.replace('home') like this 
Give me solution what should I do to remove this error

It is not able to pop the previous scene or how can I remove scene 
from router 

在这种情况下,Actions.replace 不适用于此主场景,仅适用于它正在工作的另一个场景

TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at popPrevious (State.js:63)
    at reducer (Reducer.js:36)
    at Object.Navigator.router.getStateForAction (navigationStore.js:500)
    at NavigationContainer._this.dispatch (createNavigationContainer.js:315)
    at NavigationStore.dispatch (navigationStore.js:840)
    at NavigationStore.replace (navigationStore.js:908)
    at LoginScreen.js:92
    at tryCallOne (core.js:37)
    at core.js:123

【问题讨论】:

  • 您能否添加有关此错误的更多详细信息?我是该项目的贡献者,在我看来,这个场景是一个真正的错误。
  • Router-flux 使用 JSON 结构进行路由,这就是产生此错误的原因,最近我找到了如下解决方案

标签: react-native react-native-router-flux


【解决方案1】:

Actions.home({type:'reset'}) 使用它,我们可以将路由器通量路由到主屏幕或登录屏幕,并在注销时也执行相同操作 Actions,login({type:'reset'}) 像这样,您可以在路由器通量中重置您的路线

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-03
    • 2020-01-26
    • 1970-01-01
    • 2017-03-31
    • 2023-01-22
    • 1970-01-01
    • 1970-01-01
    • 2018-04-09
    相关资源
    最近更新 更多