aksonov / aksonov/react-native-router-flux

Initial Scene remounts (twice) after appstate going to inactive/background

Abierto
#3,349 3 comentarios 3 reacciones 0 asignados Ver en GitHub
needs response from author
Lenguaje dominante
JavaScript
Estrellas
8.9k
Forks
2.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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 (





);
}
}
```
- app is going to appstate `inactive/background`
- component lifecycle methods called:
1. componentWillMount
2. componentWillUnmount
3. componentDidMount
4. componentWillMount
5. componentWillUnmount
6. 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`

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.