diff --git a/ReactNativeClient/lib/components/screens/welcome.js b/ReactNativeClient/lib/components/screens/welcome.js
index 07b7bf80a..0a8974a82 100644
--- a/ReactNativeClient/lib/components/screens/welcome.js
+++ b/ReactNativeClient/lib/components/screens/welcome.js
@@ -22,23 +22,15 @@ class WelcomeScreenComponent extends BaseScreenComponent {
}
render() {
- if (this.props.loading) {
- return (
-
- Loading...
-
- );
- } else {
- let message = this.props.folders.length ? _('Click on the (+) button to create a new note or notebook. Click on the side menu to access your existing notebooks.') : _('You currently have no notebook. Create one by clicking on (+) button.');
+ let message = this.props.folders.length ? _('Click on the (+) button to create a new note or notebook. Click on the side menu to access your existing notebooks.') : _('You currently have no notebook. Create one by clicking on (+) button.');
- return (
-
-
- {message}
-
-
- );
- }
+ return (
+
+
+ {message}
+
+
+ );
}
}
@@ -46,7 +38,6 @@ class WelcomeScreenComponent extends BaseScreenComponent {
const WelcomeScreen = connect(
(state) => {
return {
- loading: state.loading,
folders: state.folders,
};
}
diff --git a/ReactNativeClient/root.js b/ReactNativeClient/root.js
index 72c597dd0..73aaf4852 100644
--- a/ReactNativeClient/root.js
+++ b/ReactNativeClient/root.js
@@ -47,7 +47,6 @@ let defaultState = {
selectedItemType: 'note',
showSideMenu: false,
screens: {},
- loading: true,
historyCanGoBack: false,
notesOrder: [
{ by: 'updated_time', dir: 'DESC' },
@@ -56,6 +55,7 @@ let defaultState = {
syncReport: {},
searchQuery: '',
settings: {},
+ appState: 'starting',
};
const initialRoute = {
@@ -188,13 +188,6 @@ const reducer = (state = defaultState, action) => {
newState.historyCanGoBack = !!navHistory.length;
break;
- // Replace all the notes with the provided array
- case 'APPLICATION_LOADING_DONE':
-
- newState = Object.assign({}, state);
- newState.loading = false;
- break;
-
case 'SETTINGS_UPDATE_ALL':
newState = Object.assign({}, state);
@@ -348,6 +341,11 @@ const reducer = (state = defaultState, action) => {
newState = Object.assign({}, state);
newState.searchQuery = action.query.trim();
+ case 'SET_APP_STATE':
+
+ newState = Object.assign({}, state);
+ newState.appState = action.state;
+
}
} catch (error) {
error.message = 'In reducer: ' + error.message + ' Action: ' + JSON.stringify(action);
@@ -383,15 +381,9 @@ const generalMiddleware = store => next => async (action) => {
let store = createStore(reducer, applyMiddleware(generalMiddleware));
-let initializationState_ = 'waiting';
-
async function initialize(dispatch, backButtonHandler) {
- if (initializationState_ != 'waiting') return;
-
shimInit();
- initializationState_ = 'in_progress';
-
Setting.setConstant('env', __DEV__ ? 'dev' : 'prod');
Setting.setConstant('appId', 'net.cozic.joplin');
Setting.setConstant('appType', 'mobile');
@@ -476,10 +468,6 @@ async function initialize(dispatch, backButtonHandler) {
tags: tags,
});
- dispatch({
- type: 'APPLICATION_LOADING_DONE',
- });
-
let folderId = Setting.value('activeFolderId');
let folder = await Folder.load(folderId);
@@ -513,8 +501,6 @@ async function initialize(dispatch, backButtonHandler) {
reg.scheduleSync();
}
- initializationState_ = 'done';
-
reg.logger().info('Application initialized');
}
@@ -526,7 +512,19 @@ class AppComponent extends React.Component {
}
async componentDidMount() {
- await initialize(this.props.dispatch, this.backButtonHandler.bind(this));
+ if (this.props.appState == 'starting') {
+ this.props.dispatch({
+ type: 'SET_APP_STATE',
+ state: 'initializing',
+ });
+
+ await initialize(this.props.dispatch, this.backButtonHandler.bind(this));
+
+ this.props.dispatch({
+ type: 'SET_APP_STATE',
+ state: 'ready',
+ });
+ }
}
backButtonHandler() {
@@ -559,6 +557,8 @@ class AppComponent extends React.Component {
}
render() {
+ if (this.props.appState != 'ready') return null;
+
const sideMenuContent = ;
const appNavInit = {
@@ -588,6 +588,7 @@ const mapStateToProps = (state) => {
historyCanGoBack: state.historyCanGoBack,
showSideMenu: state.showSideMenu,
syncStarted: state.syncStarted,
+ appState: state.appState,
};
};