react-leaflet icon indicating copy to clipboard operation
react-leaflet copied to clipboard

Map rendering problem

Open fborghi opened this issue 6 years ago • 3 comments

"react-leaflet": "^2.6.3" "leaflet": "^1.6.0"

Hi everyone, hi have a problem with the map in my react project.

I insert the Map as described in the documentation and for a first moment it worked. Now this is the result: asd

I don't know what to do.

export const Container = styled.div`
  flex: 0 0 100%;
  max-width: 100%;
  height: 250px;
`

<Container>
        <Map
          style={{ width: '100%', height: '100%' }}
          scrollWheelZoom={false}
          center={centerPosition} zoom={9}>
          <TileLayer
            attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
            url='https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
          />
          {positions.length && <Polyline positions={positions} />}
          <Marker icon={myIcon} key='lastPosition' position={lastPosition}>
            <Popup>
              <span>Popup</span>
            </Popup>
          </Marker>
        </Map>
      </Container>

HELP.

fborghi avatar Mar 30 '20 06:03 fborghi

Hello, how did you solve it?

ingcrengifo avatar Apr 14 '20 14:04 ingcrengifo

I solved adding the leaflet.css file to my react component that uses the map.

fborghi avatar Apr 20 '20 07:04 fborghi

import "leaflet/dist/leaflet.css"

devrchancay avatar May 10 '20 04:05 devrchancay