You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So how on earth do I set this property?
map.setPaintProperty('basemap', 'raster-opacity', 0.5)
No matter where I add it, I get console error: this is not a function
Expected Behavior
It should make the map 50% see-through without affecting its container or any of my R3F 3D components.
The MapRef is just a react ref containing the mapbox-gl Map object, so as long as it's defined when you reference it then it will behave according to their api docs.
The MapRef object exposes Map methods (Mapbox | Maplibre) that are safe to call without breaking the React bindings. For example, setStyle() is hidden from the ref object, because the style is supposed to be changed by updating the mapStyle prop. Calling the method directly may cause the the React prop to mismatch with the underlying state, and lead to unexpected behaviors.
You can still access the hidden members via getMap()
Description
So how on earth do I set this property?
map.setPaintProperty('basemap', 'raster-opacity', 0.5)
No matter where I add it, I get console error: this is not a function
Expected Behavior
It should make the map 50% see-through without affecting its container or any of my R3F 3D components.
Steps to Reproduce
Environment
Logs
Uncaught TypeError: mapRef.current.setPaintProperty is not a function
The text was updated successfully, but these errors were encountered: