Fix initial action dispatch for nonPersisted apps (#4104)

This commit is contained in:
Eric Vicenti 2018-05-02 09:17:00 -07:00 committed by Brent Vatne
parent 4b39e2db3c
commit c641bee11b

View File

@ -252,12 +252,7 @@ export default function createNavigationContainer(Component) {
}
}
if (startupState === this.state.nav) {
return;
}
this.setState({ nav: startupState }, () => {
_reactNavigationIsHydratingState = false;
const dispatchActions = () =>
this._actionEventSubscribers.forEach(subscriber =>
subscriber({
type: 'action',
@ -266,6 +261,15 @@ export default function createNavigationContainer(Component) {
lastState: null,
})
);
if (startupState === this.state.nav) {
dispatchActions();
return;
}
this.setState({ nav: startupState }, () => {
_reactNavigationIsHydratingState = false;
dispatchActions();
});
}