diff --git a/src/App.tsx b/src/App.tsx index c485ddd6a..2b8d16a61 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -477,25 +477,6 @@ function createAppDrawerNavigator(props: BaseProps) { ); } -function createRootNavigator(app: App, initialState: InitialState) { - return ( - { - if (navigatorRef) { - app.notificationManager?.initialize(navigatorRef); - app.deepLinkingManager?.initialize(navigatorRef, app.centralServerProvider); - } - }} - onStateChange={persistNavigationState} - initialState={initialState}> - - - - - - ); -} - export interface Props {} interface State { switchTheme?: boolean; @@ -548,21 +529,17 @@ export default class App extends React.Component { // Location ------------------------------------------------ this.location = await LocationManager.getInstance(); this.location.startListening(); - // Check on hold notification - this.notificationManager.checkOnHoldNotification(); // Check migration const migrationManager = MigrationManager.getInstance(); migrationManager.setCentralServerProvider(this.centralServerProvider); await migrationManager.migrate(); // Check for app updates this.appVersion = await checkVersion(); - if (this.appVersion?.needsUpdate) { - this.setState({ showAppUpdateDialog: true }); - } // Set this.setState({ navigationState, - isNavigationStateLoaded: true + isNavigationStateLoaded: true, + showAppUpdateDialog: !!this.appVersion?.needsUpdate }); } @@ -584,9 +561,29 @@ export default class App extends React.Component { this.setState({ showAppUpdateDialog: false })} /> )} - {createRootNavigator(this, this.state.navigationState)} + {this.createRootNavigator()} ) ); } + + private createRootNavigator() { + return ( + { + if (navigatorRef) { + this.notificationManager?.initialize(navigatorRef); + this.notificationManager.checkOnHoldNotification(); + this.deepLinkingManager?.initialize(navigatorRef, this.centralServerProvider); + } + }} + onStateChange={persistNavigationState} + initialState={this.state.navigationState}> + + + + + + ); + } }