From 61fd4e4ce402ba7b4686b750ab24574594ff4b36 Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Thu, 6 Jul 2017 13:27:00 -0500 Subject: [PATCH] [RN] Fix passing url prop to Root and App components --- react/features/app/components/AbstractApp.js | 8 +++++--- react/index.native.js | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js index 2f985aab1..699639d32 100644 --- a/react/features/app/components/AbstractApp.js +++ b/react/features/app/components/AbstractApp.js @@ -138,9 +138,11 @@ export class AbstractApp extends Component { }); } - // Deal with URL changes - if (typeof nextProps.url !== 'undefined') { - this._openURL(nextProps.url || this._getDefaultURL()); + // Deal with URL changes. + const { url } = nextProps; + + if (this.props.url !== url) { + this._openURL(url || this._getDefaultURL()); } } diff --git a/react/index.native.js b/react/index.native.js index 88a5c4e6e..3617bc399 100644 --- a/react/index.native.js +++ b/react/index.native.js @@ -56,8 +56,8 @@ class Root extends Component { url: this.props.url }; - // Handle the URL the application was launched with, but props have - // precedence. + // Handle the URL, if any, with which the app was launched. But props + // have precedence. if (typeof this.props.url === 'undefined') { Linking.getInitialURL() .then(url => this.setState({ url })) @@ -79,8 +79,10 @@ class Root extends Component { * * @inheritdoc */ - componentWillReceiveProps(nextProps) { - this.setState({ url: nextProps.url || null }); + componentWillReceiveProps({ url }) { + if (this.props.url !== url) { + this.setState({ url: url || null }); + } } /**