내 코드입니다 :왜곡 된지도 이미지는 여기
100 픽셀의 높이가 100 픽셀 폭 이상지도 스트레치를 만들기 위해 내 목표는 그래서 난이 CSS 스타일 썼다
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import fetch from 'node-fetch';
import PropTypes from 'prop-types';
import { Map, TileLayer } from 'react-leaflet';
export default class PageBackground extends Component{
constructor(props) {
super(props);
this.getLocation=this.getLocation.bind(this);
this.state={
position:[2,2]
};
}
componentWillMount() {
this.getLocation();
}
getLocation() {
fetch('http://freegeoip.net/json/')
.then((res)=>res.json())
.then((objec)=>{this.setState({position:[objec.latitude,objec.longitude]});console.log(this.state.position)})
.catch((err)=>{console.log("didn't connect to App",err);this.setState({position:['10','8']});})
}
render(){
return (
<Map center={this.state.position} zoom={13} >
<TileLayer
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'/>
</Map>
);
}
}
:
을
.leaflet-container {
height:100px;
width:100px;
}
이제 문제는 전단지가 왜곡 된 이미지를 반환한다는 것입니다. 내가 뭘 잘못하고있는 걸까요? 내 구성 요소에 import 'leaflet/dist/leaflet.css'
추가