import { Options } from '@ulangi/react-native-navigation' ; import { ScreenName , SetFormPickerType , Theme , } from '@ulangi/ulangi-common/enums' ; import { ObservableAddEditSetScreen , ObservableSetFormState , ObservableSetPickerState , ObservableTitleTopBar , ObservableTopBarButton , } from '@ulangi/ulangi-observable' ; import { observer } from 'mobx-react' ; import * as React from 'react' ; import * as uuid from 'uuid' ; import { Container , ContainerPassedProps } from '../../Container' ; import { Images } from '../../constants/Images' ; import { CreateFirstSetScreenIds } from '../../constants/ids/CreateFirstSetScreenIds' ; import { CreateFirstSetScreenFactory } from '../../factories/set/CreateFirstSetScreenFactory' ; import { CreateFirstSetScreen } from './CreateFirstSetScreen' ; import { CreateFirstSetScreenStyle } from './CreateFirstSetScreenContainer.style' ; @ observer export class CreateFirstSetScreenContainer extends Container { public static options ( props ) { return props . theme === Theme . LIGHT ? CreateFirstSetScreenStyle . SCREEN_FULL_LIGHT_STYLES : CreateFirstSetScreenStyle . SCREEN_FULL_DARK_STYLES ; } private screenFactory = new CreateFirstSetScreenFactory ( this . props , this . eventBus , this . observer ) ; protected observableScreen = new ObservableAddEditSetScreen ( new ObservableSetFormState ( uuid . v4 ( ) , '' , null , 'en' , false , new ObservableSetPickerState ( SetFormPickerType . LEARN , false , false ) , this . props . rootStore . remoteConfigStore ) , this . props . componentId , ScreenName . CREATE_FIRST_SET_SCREEN , new ObservableTitleTopBar ( '' , new ObservableTopBarButton ( CreateFirstSetScreenIds . LOG_OUT_BTN , null , { light : Images . ARROW_LEFT_WHITE_22X22 , dark : Images . ARROW_LEFT_WHITE_22X22 , } , ( ) : void => { this . screenDelegate . showConfirmLogout ( ) ; } ) , null ) ) ; private navigatorDelegate = this . screenFactory . createNavigatorDelegate ( ) ; private screenDelegate = this . screenFactory . createScreenDelegate ( this . observableScreen ) ; protected onThemeChanged ( theme ) { this . navigatorDelegate . mergeOptions ( theme === Theme . LIGHT ? CreateFirstSetScreenStyle . SCREEN_LIGHT_STYLES_ONLY : CreateFirstSetScreenStyle . SCREEN_DARK_STYLES_ONLY ) ; } public componentDidMount ( ) { this . screenDelegate . addBackButtonHandler ( this . screenDelegate . handleHardwareBackButton ) ; } public componentWillUnmount ( ) { this . screenDelegate . removeBackButtonHandler ( this . screenDelegate . handleHardwareBackButton ) ; } public render ( ) { return ( < CreateFirstSetScreen themeStore = { this . props . rootStore . themeStore } observableScreen = { this . observableScreen } screenDelegate = { this . screenDelegate } / > ) ; } }