Closed ansarikhurshid786 closed 5 years ago
Source is a "source" of data. The way how it is presented is controlled by Layer. You will need change properties of the layer, not source. If map style is loaded from URL, and not created dynamically, you can do smth like
<MapboxGL.MapView styleURL="http://localhost:3000/style">
<MapboxGL.RasterSource id={sourceId}>
<MapboxGL.RasterLayer id={layerId} style={{ visibility: isLayerVisible ? 'visible' : 'none' }} />
</MapboxGL.RasterSource>
</MapboxGL.MapView>
So you need to know source-id and layer-id
I just want to toggle layer visibility like in mapbox gl js. https://docs.mapbox.com/mapbox-gl-js/example/toggle-layers/
is it possible to change visibility value to none or visible?