|
|
@@ -59,7 +59,14 @@ export default class BaseApp extends Component<*, State> {
|
|
59
|
59
|
// $FlowFixMe
|
|
60
|
60
|
store: undefined
|
|
61
|
61
|
};
|
|
|
62
|
+ }
|
|
62
|
63
|
|
|
|
64
|
+ /**
|
|
|
65
|
+ * Initializes the app.
|
|
|
66
|
+ *
|
|
|
67
|
+ * @inheritdoc
|
|
|
68
|
+ */
|
|
|
69
|
+ componentDidMount() {
|
|
63
|
70
|
/**
|
|
64
|
71
|
* Make the mobile {@code BaseApp} wait until the {@code AsyncStorage}
|
|
65
|
72
|
* implementation of {@code Storage} initializes fully.
|
|
|
@@ -68,22 +75,15 @@ export default class BaseApp extends Component<*, State> {
|
|
68
|
75
|
* @see {@link #_initStorage}
|
|
69
|
76
|
* @type {Promise}
|
|
70
|
77
|
*/
|
|
71
|
|
- this._init
|
|
72
|
|
- = this._initStorage()
|
|
73
|
|
- .catch(() => { /* AbstractApp should always initialize! */ })
|
|
74
|
|
- .then(() =>
|
|
75
|
|
- this.setState({
|
|
76
|
|
- store: this._createStore()
|
|
77
|
|
- }));
|
|
78
|
|
- }
|
|
79
|
|
-
|
|
80
|
|
- /**
|
|
81
|
|
- * Initializes the app.
|
|
82
|
|
- *
|
|
83
|
|
- * @inheritdoc
|
|
84
|
|
- */
|
|
85
|
|
- componentWillMount() {
|
|
86
|
|
- this._init.then(() => this.state.store.dispatch(appWillMount(this)));
|
|
|
78
|
+ this._init = this._initStorage()
|
|
|
79
|
+ .catch(() => { /* BaseApp should always initialize! */ })
|
|
|
80
|
+ .then(() => new Promise(resolve => {
|
|
|
81
|
+ this.setState({
|
|
|
82
|
+ store: this._createStore()
|
|
|
83
|
+ }, resolve);
|
|
|
84
|
+ }))
|
|
|
85
|
+ .then(() => this.state.store.dispatch(appWillMount(this)))
|
|
|
86
|
+ .catch(() => { /* BaseApp should always initialize! */ });
|
|
87
|
87
|
}
|
|
88
|
88
|
|
|
89
|
89
|
/**
|