|
@@ -103,15 +103,25 @@ class Root extends Component<Props, State> {
|
103
|
103
|
}
|
104
|
104
|
|
105
|
105
|
/**
|
106
|
|
- * Implements React's {@link Component#componentWillReceiveProps()}.
|
|
106
|
+ * Implements React's {@link Component#componentDidUpdate()}.
|
107
|
107
|
*
|
108
|
108
|
* New props can be set from the native side by setting the appProperties
|
109
|
109
|
* property (on iOS) or calling setAppProperties (on Android).
|
110
|
110
|
*
|
111
|
111
|
* @inheritdoc
|
112
|
112
|
*/
|
113
|
|
- componentWillReceiveProps({ url }) {
|
114
|
|
- equals(this.props.url, url) || this.setState({ url: url || null });
|
|
113
|
+ componentDidUpdate(prevProps, prevState) {
|
|
114
|
+ // Ignore the special state update triggered on {@code Root}
|
|
115
|
+ // instantiation where an undefined url prop is set to a default.
|
|
116
|
+ if (typeof prevState.url === 'undefined'
|
|
117
|
+ && typeof this.state.url !== 'undefined') {
|
|
118
|
+ return;
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ if (!equals(prevProps.url, this.props.url)) {
|
|
122
|
+ // eslint-disable-next-line react/no-did-update-set-state
|
|
123
|
+ this.setState({ url: this.props.url || null });
|
|
124
|
+ }
|
115
|
125
|
}
|
116
|
126
|
|
117
|
127
|
/**
|