Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(app): move initialization into componentDidMount

Leonard Kim9215b1e8b2b5
diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js
index 13e2a4cdb8..39abfcd723 100644
--- a/react/features/app/components/AbstractApp.js
+++ b/react/features/app/components/AbstractApp.js
@@ -45,8 +45,8 @@ export class AbstractApp extends BaseApp<Props, *> {
*
* @inheritdoc
*/
- componentWillMount() {
- super.componentWillMount();
+ componentDidMount() {
+ super.componentDidMount();
this._init.then(() => {
// If a URL was explicitly specified to this React Component, then
diff --git a/react/features/app/components/App.native.js b/react/features/app/components/App.native.js
index 900652e956..4e1ecf170a 100644
--- a/react/features/app/components/App.native.js
+++ b/react/features/app/components/App.native.js
@@ -93,8 +93,8 @@ export class App extends AbstractApp {
* @returns {void}
* @see https://facebook.github.io/react-native/docs/linking.html
*/
- componentWillMount() {
- super.componentWillMount();
+ componentDidMount() {
+ super.componentDidMount();
Linking.addEventListener('url', this._onLinkingURL);
}
diff --git a/react/features/base/app/components/BaseApp.js b/react/features/base/app/components/BaseApp.js
index 000ff56a2b..257686407e 100644
--- a/react/features/base/app/components/BaseApp.js
+++ b/react/features/base/app/components/BaseApp.js
@@ -59,7 +59,14 @@ export default class BaseApp extends Component<*, State> {
// $FlowFixMe
store: undefined
};
+ }
+ /**
+ * Initializes the app.
+ *
+ * @inheritdoc
+ */
+ componentDidMount() {
/**
* Make the mobile {@code BaseApp} wait until the {@code AsyncStorage}
* implementation of {@code Storage} initializes fully.
@@ -68,22 +75,15 @@ export default class BaseApp extends Component<*, State> {
* @see {@link #_initStorage}
* @type {Promise}
*/
- this._init
- = this._initStorage()
- .catch(() => { /* AbstractApp should always initialize! */ })
- .then(() =>
- this.setState({
- store: this._createStore()
- }));
- }
-
- /**
- * Initializes the app.
- *
- * @inheritdoc
- */
- componentWillMount() {
- this._init.then(() => this.state.store.dispatch(appWillMount(this)));
+ this._init = this._initStorage()
+ .catch(() => { /* BaseApp should always initialize! */ })
+ .then(() => new Promise(resolve => {
+ this.setState({
+ store: this._createStore()
+ }, resolve);
+ }))
+ .then(() => this.state.store.dispatch(appWillMount(this)))
+ .catch(() => { /* BaseApp should always initialize! */ });
}
/**
diff --git a/react/features/mobile/incoming-call/components/IncomingCallApp.js b/react/features/mobile/incoming-call/components/IncomingCallApp.js
index 637d7901b4..5b4fe6e813 100644
--- a/react/features/mobile/incoming-call/components/IncomingCallApp.js
+++ b/react/features/mobile/incoming-call/components/IncomingCallApp.js
@@ -43,8 +43,8 @@ export default class IncomingCallApp extends BaseApp<Props> {
*
* @returns {void}
*/
- componentWillMount() {
- super.componentWillMount();
+ componentDidMount() {
+ super.componentDidMount();
this._init.then(() => {
const { dispatch } = this.state.store;