import React , { Component } from 'react' ; import type { Adapters } from 'src/plugins/inspector/public' ; import { MapDetails } from './map_details' ; import { Stats } from './types' ; interface Props { adapters : Adapters ; } interface State { stats : Stats ; style : string ; } class MapViewComponent extends Component < Props , State > { state : State = this . props . adapters . map . getMapState ( ) ; _onMapChange = ( ) => { this . setState ( this . props . adapters . map . getMapState ( ) ) ; } ; componentDidMount ( ) { this . props . adapters . map . on ( 'change' , this . _onMapChange ) ; } componentWillUnmount ( ) { this . props . adapters . map . removeListener ( 'change' , this . _onMapChange ) ; } render ( ) { return ( < MapDetails centerLon = { this . state . stats . center [ 0 ] } centerLat = { this . state . stats . center [ 1 ] } zoom = { this . state . stats . zoom } style = { this . state . style } / > ) ; } } export default MapViewComponent ;