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

doesnt work with SvelteKit #68

Open
gwendal5 opened this issue May 10, 2022 · 5 comments
Open

doesnt work with SvelteKit #68

gwendal5 opened this issue May 10, 2022 · 5 comments

Comments

@gwendal5
Copy link

gwendal5 commented May 10, 2022

Hi, I tried using your package with the example code but nothing shows up on the page.

My code is this:

<script>
    import { Map, Geocoder, Marker, controls } from "@beyonk/svelte-mapbox";

    const { GeolocateControl, NavigationControl, ScaleControl } = controls;

    let mapComponent;
    let lng = 69;
    let lat = 69;
    let zoom = 19;
    // Usage of methods like setCenter and flyto
    function onReady() {
        mapComponent.setCenter([lng, lat], zoom); // zoom is optional
        mapComponent.flyTo({ center: [lng, lat] }); // documentation (https://docs.mapbox.com/mapbox-gl-js/example/flyto)
    }

    // Define this to handle `eventname` events - see [GeoLocate Events](https://docs.mapbox.com/mapbox-gl-js/api/markers/#geolocatecontrol-events)
    function eventHandler(e) {
        const data = e.detail;
        // do something with `data`, it's the result returned from the mapbox event
    }
</script>

<Map
    accessToken="token"
    bind:this={mapComponent}
    on:recentre={(e) => console.log(e.detail.center.lat, e.detail.center.lng)}
    on:ready={onReady}
    options={{ scrollZoom: false }}
/>

@gwendal5
Copy link
Author

Does your package works with SvelteKit ?
I am using SvelteKit version 1.0.0-next.326

@gwendal5 gwendal5 changed the title package doesnt work doesnt work with SvelteKit May 10, 2022
@Rar9
Copy link

Rar9 commented Dec 9, 2022

Even the github demo is just rebooting in Firefox?

Please check and update

@robinsonkwame
Copy link

Please check and update

@gamecubate
Copy link

@gwendal5 the map component needs to be placed in a sized container, e.g.,

<div style="height:500px;">
  <Map ..../>
</div>

@marksteven
Copy link

make sure your .env file(separate file ) is there and written correct otherwise map not show

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

5 participants