Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work with React + TypeScript #116

Open
KonstantinBiryukov opened this issue Apr 22, 2022 · 1 comment
Open

work with React + TypeScript #116

KonstantinBiryukov opened this issue Apr 22, 2022 · 1 comment

Comments

@KonstantinBiryukov
Copy link

KonstantinBiryukov commented Apr 22, 2022

I am curious if it is supposed to work in React + TypeScript?
After the package is installed. I am trying to do import
import "leaflet.browser.print/dist/leaflet.browser.print"
Is there anything specific that has to be done to use this library with React + TS?

If I just install the package without any import and write
var browserControl = L.control.browserPrint({position: 'topLeft'}).addTo(instance), where instance is a Map object
it doesn't work. I have an error: Property 'browserPrint' does not exist on type 'typeof control'. TS2339

And if I suppress this error, I have TypeError: Cannot read properties of undefined (reading 'Mode')
How to extend this L.control class by the plugin and use it in React + TS?

@doktr
Copy link

doktr commented Aug 2, 2022

@KonstantinBiryukov
There is a good tutorial available for the angular module ngx-leaflet.
I guess that can be easily adapted for react

https://github.com/bluehalo/ngx-leaflet-tutorial-plugins/tree/master/Leaflet.BrowserPrint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants