[RN] Fix passing url prop to Root and App components

pull/1745/head
Lyubo Marinov 8 years ago
parent 9bd6bbfd95
commit 61fd4e4ce4
  1. 8
      react/features/app/components/AbstractApp.js
  2. 10
      react/index.native.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());
}
}

@ -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 });
}
}
/**

Loading…
Cancel
Save