-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Version
- react-native-router-flux v4.0.5 (happening on older version too)
- react v16.2.0
- react-native v0.5.2
Android/iOS
Expected behaviour
Using only react native and one component:
- app is going to appstate inactive/background
- component unmounts
- thats it
Actual behaviour
Using rnrf and one view:
class AppRouter extends React.Component {
render() {
return (
<Router >
<Stack hideNavBar key="root">
<Scene
init
initial
key="start"
hideNavBar
component={StartView}
/>
</Stack>
</Router>
);
}
}
- app is going to appstate
inactive/background
- component lifecycle methods called:
- componentWillMount
- componentWillUnmount
- componentDidMount
- componentWillMount
- componentWillUnmount
- componentDidMount
This only happens for the first scene in your routes. Others are not affected.
I'm pretty sure that this is around since a few versions.
I encountered the issue on several other projects in the past that the the component gets remounted in the background. For most usecases this is not a big deal.
In my current case I'm starting an interval on componentDidMount
for that view. And I wondered why its always started again when my app went to inactive/background.
Whats also weird is that componentWillMount
is called before componentDidMount
running0x, zomars and hmoule