nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

How to change raster layer visibility property at run time #1528

Closed ansarikhurshid786 closed 5 years ago

ansarikhurshid786 commented 5 years ago

I am new using react native mapbox gl. I can't find how to change raster layer visibility property at runtime?

ansarikhurshid786 commented 5 years ago

Show / Hide a layer programmatically? @agius @zugaldia can you help me ?

ansarikhurshid786 commented 5 years ago

My question is related to this issue https://github.com/agius/react-native-mapbox-gl/issues/789. I don't know how to show and hide layer.

pinpong commented 5 years ago

Did you tried to use a filter? Here is a good example https://github.com/agius/react-native-mapbox-gl/blob/master/example/src/components/EarthQuakes.js

ansarikhurshid786 commented 5 years ago

I have added sources and layers in custom style of map and layout visibility is none. I want dynamic toggle at run time. You can see question at stackoverflow https://stackoverflow.com/questions/55036420/how-to-show-hide-raster-layer-visibility-property-visible-none-at-run-time-in

ansarikhurshid786 commented 5 years ago

@pinpong I will try your given example and let you know.

ansarikhurshid786 commented 5 years ago

@pinpong filter is not helpful for me.

ansarikhurshid786 commented 5 years ago

I got solution. I put solution at https://stackoverflow.com/questions/55036420/how-to-show-hide-raster-layer-visibility-property-visible-none-at-run-time-in