import { Options } from '@ulangi/react-native-navigation' ; import { ScreenName , Theme } from '@ulangi/ulangi-common/enums' ; import { ObservablePreloadScreen } from '@ulangi/ulangi-observable' ; import { observer } from 'mobx-react' ; import * as React from 'react' ; import { Container , ContainerPassedProps } from '../../Container' ; import { PreloadScreenFactory } from '../../factories/preload/PreloadScreenFactory' ; import { PreloadScreen } from './PreloadScreen' ; import { PreloadScreenStyle } from './PreloadScreenContainer.style' ; @ observer export class PreloadScreenContainer extends Container { public static options ( props ) { return props . theme === Theme . LIGHT ? PreloadScreenStyle . SCREEN_FULL_LIGHT_STYLES : PreloadScreenStyle . SCREEN_FULL_DARK_STYLES ; } private screenFactory = new PreloadScreenFactory ( this . props , this . eventBus , this . observer ) ; protected observableScreen = new ObservablePreloadScreen ( '' , this . props . componentId , ScreenName . PRELOAD_SCREEN ) ; private navigatorDelegate = this . screenFactory . createNavigatorDelegate ( ) ; private screenDelegate = this . screenFactory . createScreenDelegate ( this . observableScreen ) ; public componentDidMount ( ) { this . screenDelegate . autoUpdateMessage ( ) ; this . screenDelegate . preload ( ) ; } public onThemeChanged ( theme ) { this . navigatorDelegate . mergeOptions ( theme === Theme . LIGHT ? PreloadScreenStyle . SCREEN_LIGHT_STYLES_ONLY : PreloadScreenStyle . SCREEN_DARK_STYLES_ONLY ) ; } public render ( ) { return ( < PreloadScreen themeStore = { this . props . rootStore . themeStore } observableScreen = { this . observableScreen } shouldRenderMessage = { false } / > ) ; } }