From 0ab5636145e33b26febae1de23b82bc3e06109ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=AE=87=E4=B8=9C?= Date: Wed, 13 Feb 2019 14:00:14 +0800 Subject: [PATCH] InnerNaviBar navigation undefined check --- src/navibar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/navibar.js b/src/navibar.js index 1f47f5b..416f217 100644 --- a/src/navibar.js +++ b/src/navibar.js @@ -32,12 +32,12 @@ export class InnerNaviBar extends React.PureComponent { left: null, right: null, }; - this._didFocusSubscription = props.navigation.addListener('didFocus', + this._didFocusSubscription = props.navigation && props.navigation.addListener('didFocus', () => BackHandler.addEventListener('hardwareBackPress', this._clickBack)); } componentDidMount() { - this._willBlurSubscription = this.props.navigation.addListener('willBlur', + this._willBlurSubscription = this.props.navigation && this.props.navigation.addListener('willBlur', () => BackHandler.removeEventListener('hardwareBackPress', this._clickBack)); Dimensions.addEventListener('change', this._onWindowChanged); }