import React from 'react';
import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
import GaoDeMap from '@/components/mapView/GaoDeMap';

class CreateMap extends React.Component {
  constructor(props) {
    super(props);
    this.mapManganerRef = React.createRef();
  }

  state = {
    loading: true,
    options: window.globalConfig.mapsettings,
    widgets: window.globalConfig.uiwidgets,
  };

  getView = view => {
    console.log(view);
  };

  componentDidMount() {
    console.log(this.mapManganerRef);
  }

  render() {
    return (
      <>
        <GaoDeMap
          {...this.state}
          getMapInfo={this.getView}
          ref={this.mapManganerRef}
        />
      </>
    );
  }
}

const mapStateToProps = state => ({});

const mapDispatchToProps = dispatch => ({
  updageMapView(mapView) {
    dispatch(actionCreators.updageMapView(mapView));
  },
});

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(CreateMap);