import { Options } from '@ulangi/react-native-navigation' ; import { ScreenName } from '@ulangi/ulangi-common/enums' ; import { ObservableScreen } from '@ulangi/ulangi-observable' ; import * as _ from 'lodash' ; import { observer } from 'mobx-react' ; import * as React from 'react' ; import { BackHandler } from 'react-native' ; import { Container } from '../../Container' ; import { ScreenFactory } from '../../factories/ScreenFactory' ; import { reflexStyles } from '../../styles/ReflexStyles' ; import { ReflexPausedScreen } from './ReflexPausedScreen' ; export interface ReflexPausedScreenPassedProps { readonly continue : ( ) => void ; readonly restart : ( ) => void ; readonly quit : ( ) => void ; } @ observer export class ReflexPausedScreenContainer extends Container < ReflexPausedScreenPassedProps > { public static options ( ) { return reflexStyles . getScreenStyle ( ) ; } protected observableLightBox = this . props . observableLightBox ; protected observableScreen = new ObservableScreen ( this . props . componentId , ScreenName . REFLEX_PAUSED_SCREEN , null ) ; private screenFactory = new ScreenFactory ( this . props , this . eventBus , this . observer ) ; private navigatorDelegate = this . screenFactory . createNavigatorDelegate ( ) ; public componentDidMount ( ) { BackHandler . addEventListener ( 'hardwareBackPress' , this . handleBackButton ) ; } public componentWillUnmount ( ) { BackHandler . removeEventListener ( 'hardwareBackPress' , this . handleBackButton ) ; } private handleBackButton = ( ) : boolean => { this . navigatorDelegate . dismissLightBox ( ) ; this . props . passedProps . continue ( ) ; return true ; } ; protected onThemeChanged ( ) { _ . noop ( ) ; } public render ( ) { return ( < ReflexPausedScreen themeStore = { this . props . rootStore . themeStore } observableLightBox = { this . props . observableLightBox } observableScreen = { this . observableScreen } continue = { this . props . passedProps . continue } restart = { this . props . passedProps . restart } quit = { this . props . passedProps . quit } / > ) ; } }