aksonov / aksonov/react-native-router-flux

Can't change initial prop on a scene from a state variable

Aperta
#3,665 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
8.9k
Fork
2.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Version
Tell us which versions you are using:

- react-native-router-flux v4.2.0
- react v16.11.0
- react-native v0.62.2

### Expected behaviour

I have a routes.js file that handles my routes. I want to control what is the initial screen by setting the `initial` prop on my screens based on state object values.

I expected that changing a state value would update the initial screen that is rendered based on the one tied to that state value.

### Actual behaviour

Changes to state doesn't seem to affect the screens at all. The state updates, but the initial screen is not changed.

### Steps to reproduce
For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.
1. Add two scenes into a Stack component.
2. Set a default state of {isInitial: false}
3. Connect this state value to the second scene
4. In the `componentDidMount` change the state to `setState({isInitial: true})`
5. The second Scene is supposed to render, but the first Scene renders only

### Reproducible Demo

Please provide a minimized reproducible demonstration of the problem you're reporting.

Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.