Search code examples
react-nativereact-native-router-flux

Actions.replace(key) is not working in react native it is giving error like shown in error


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 

In this case Actions.replace is not working with this home scene only for another scene it is working

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

Solution

  • Actions.home({type:'reset'}) using this we can our route in router flux to home screen or login screen and do same in logout also Actions,login({type:'reset'}) Like this you can reset your route in router flux