0

I am trying to use style url from mapbox studio. I am using react-map-gl as a wrapper for map-box-gl js.

<ReactMapGL
            {...viewport}
            ref={mapRef}
            mapStyle={"mapbox://styles/user__name/ckh1vbc850jll19mijutmf889"}
            mapboxApiAccessToken="pk.eyJ1IjoidW1hMTMwMiIsImEiOiJja2UweDFvbTI0MDlqMnF0djN6cGZkdmZ3In0.ZPWXqok_MC06MciSIvhxVg"
            onViewportChange={nextViewport => setViewport(nextViewport)}
            onHover={(e)=>setFeatures(e.features)}
        >
        </ReactMapGL>

It renders a blank screen.

ALl markers and poups are working fine, but it does't show the tiles.

1 Answers1

0

The closing " is missing in

mapStyle={"mapbox://styles/user__name/ckh1vbc850jll19mijutmf889}
Anatolii Suhanov
  • 2,524
  • 1
  • 12
  • 14
  • thanks for your time, but this is not the exactly error. I got typed by mistake in question. –  Nov 04 '20 at 16:30
  • What will happen if you change it to mapStyle={"mapbox://styles/mapbox/light-v8"} ? – Anatolii Suhanov Nov 04 '20 at 16:48
  • It renders fine. –  Nov 04 '20 at 17:22
  • I am also able to render OSM tile. But i got problem with this tile source. –  Nov 04 '20 at 17:23
  • ALl markers and poups are working fine, but it does't show the tiles. –  Nov 04 '20 at 17:24
  • You should replace user__name in mapbox://styles/user__name/ckh1vbc850jll19mijutmf889 with a real user name – Anatolii Suhanov Nov 04 '20 at 17:32
  • Ah, you must have replaced a real name with user__name for privacy reasons. What do you see when opening https://api.mapbox.com/styles/v1/your_user_name/ckh1vbc850jll19mijutmf889?access_token=your_access_token in the browser? – Anatolii Suhanov Nov 04 '20 at 20:35
  • I had replaced the user name, but i didn't put that url here for privacy reason. –  Nov 05 '20 at 02:48