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

How do I add/remove and show/hide a layer at runtime? #789

Closed
RNMBuser opened this issue Nov 20, 2017 · 5 comments
Closed

How do I add/remove and show/hide a layer at runtime? #789

RNMBuser opened this issue Nov 20, 2017 · 5 comments

Comments

@RNMBuser
Copy link

Can this layer reference a source layer in the styleURL?
I tried to use the RasterLayer visibility, with no success.
I will appreciate an example!

@nitaliano
Copy link
Owner

@RNMBuser you can add/remove layers and sources by just removing them as children of your MapView. I'll look into RasterLayer visibility

@nitaliano
Copy link
Owner

@RNMBuser Fix is out in this PR #846 and it matches the style spec so in your styles you can do

{ visibility: 'visible' }

or

{ visibility: 'none' }

@nitaliano
Copy link
Owner

Closing this out since the fix has been merged into master

@ansarikhurshid786
Copy link

ansarikhurshid786 commented Mar 6, 2019

I am new in react native mapbox. I was using mapbox gl js.

I have done using mapbox gl js for website.
hide
oMap.setLayoutProperty("layerid", 'visibility', 'none');
show
oMap.setLayoutProperty("layerid", 'visibility', 'visible');

how can i do using react native mapbox gl?

@nitaliano

@ansarikhurshid786
Copy link

@nitaliano can you help me to change layer visibility at run time?

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

3 participants