import { ObservableDimensions } from '@ulangi/ulangi-observable' ; import { Dimensions , ScaledSize } from 'react-native' ; export function autoUpdateDimensionsState ( observableDimensions ) { const changeHandler = ( { window , screen , } ) : void => { observableDimensions . screenWidth = screen . width ; observableDimensions . screenHeight = screen . height ; observableDimensions . windowWidth = window . width ; observableDimensions . windowHeight = window . height ; } ; Dimensions . addEventListener ( 'change' , changeHandler ) ; return ( ) : void => { Dimensions . removeEventListener ( 'change' , changeHandler ) ; } ; }