mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 17:34:59 +08:00
createNavigationContainer: cache previously used navigation when stateful (#202)
Prevents unnecessary creating new navigation objects when the container is passing through other props that are changing
This commit is contained in:
committed by
Satyajit Sahoo
parent
aead8ff9fb
commit
33767311ae
@@ -148,10 +148,13 @@ const createNavigationContainer = (
|
||||
render() {
|
||||
let navigation = this.props.navigation;
|
||||
if (this._isStateful()) {
|
||||
navigation = addNavigationHelpers({
|
||||
dispatch: this.dispatch.bind(this),
|
||||
state: this.state.nav,
|
||||
});
|
||||
if (!this._navigation || this._navigation.state !== this.state.nav) {
|
||||
this._navigation = addNavigationHelpers({
|
||||
dispatch: this.dispatch.bind(this),
|
||||
state: this.state.nav,
|
||||
});
|
||||
}
|
||||
navigation = this._navigation;
|
||||
}
|
||||
return (
|
||||
<Component
|
||||
|
||||
Reference in New Issue
Block a user