react-router-native icon indicating copy to clipboard operation
react-router-native copied to clipboard

Component not unmounting on goBack()

Open lukefanning opened this issue 9 years ago • 3 comments

Hi, I am facing an issue with a fairly simple usage of this module. I am finding that after calling goBack() on the router it does not trigger a componentWillUnmount(). Here is my route configuration:

<Router history={nativeHistory}>
        <StackRoute path="master" component={App}>
            <Route
                path="/" component={ChatPage} overlayComponent={(props)=><DefaultHeader {...props} title="Home"/>}/>
            <Route
                path="/chat/:name/:id" component={RoomPage} overlayComponent={(props)=><DefaultHeader {...props} title={props.params.name}/>}/>
            <Route
                path="/other" component={OtherPage} overlayComponent={(props)=><DefaultHeader {...props} title="Other Page"/>}/>
        </StackRoute>
</Router>

What seems to happen is, if I use router.push() to go from path "/" to "/chat/:name/:id" I get a call to componentDidMount() and componentWillReceiveProps(). On calling router.goBack(), componentWillUnmount() is not triggered. If I go back to the exact same chat link then it will call componentDidMount() and componentWillReceiveProps() again.

Version

Dependency Version
react-router-native 2.0.0-beta.0
react-router N/A
react-native 0.37.0

lukefanning avatar Nov 16 '16 15:11 lukefanning

Very similar situation ,when push from one screen to next, did not fire componentWillUnmount

ophite avatar Feb 09 '17 23:02 ophite

Seeing the same issue. Any updates on this?

pilord12 avatar Sep 11 '17 14:09 pilord12

I am facing the same issue. Is there a solution?

mgiridhar avatar Apr 10 '18 21:04 mgiridhar