thijssmudde / react-leaflet-fullscreen-control

A fullscreen control for React Leaflet
https://myroutes.io
5 stars 2 forks source link

Compatibility with v2 of react-leaflet? #3

Open saadsaifse opened 4 years ago

saadsaifse commented 4 years ago

I tried using this plugin with react-leaflet@2.6.3 but the control does not show up on the map. Is this compatible with v2 yet? https://react-leaflet.js.org/docs/en/plugins says it is still unknown whether its compatible or not.

krisalyssa commented 4 years ago

@saadsaifse I just installed it in an app that uses react-leaflet@2.6.1 and the control is rendered and works. The usage is a little quirky -- you add fullscreenControl as a prop on the Map element, not as a child element like you would almost any other plugin:

import "react-leaflet-fullscreen-control"

<Map fullscreenControl />
saadsaifse commented 4 years ago

@CraigCottingham I tried using 2.6.1 as well but it did not work out for me. May be its my setup or something. I can try creating a standalone project to test this later today.

aldipower commented 4 years ago

Just using the original import "leaflet-fullscreen"; without this react wrapper works for me.

import "leaflet-fullscreen"
import "leaflet-fullscreen/dist/leaflet.fullscreen.css"

<Map fullscreenControl />
reillybeacom commented 4 years ago

Just using the original import "leaflet-fullscreen"; without this react wrapper works for me.

import "leaflet-fullscreen"
import "leaflet-fullscreen/dist/leaflet.fullscreen.css"

<Map fullscreenControl />

This works for me in Firefox but crashes the whole map on iPhone Safari.

davidjb commented 4 years ago

I came to using same solution as @aldipower -- works for me on all devices I've tested it on so far (including iOS Safari).