Skip to content

Commit 949f4f1

Browse files
committed
Add both map style support. From json and from mapbox url
1 parent 91b43e1 commit 949f4f1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

android/rctmgl/src/main/java/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,11 @@ public void waitForLayer(String layerID, FoundLayerCallback callback) {
422422
public void onMapReady(final MapboxMap mapboxMap) {
423423
mMap = mapboxMap;
424424

425-
//mMap.setStyle(new Style.Builder().fromUrl(mStyleURL));
426-
mMap.setStyle(new Style.Builder().fromJson(mStyleURL));
425+
//if the myStyleURL contains "mapbox" the library will get the style from internet, else myStyleURL is a json and the library will load it
426+
if(mStyleURL.substring(0,6).contains("mapbox"))
427+
mMap.setStyle(new Style.Builder().fromUrl(mStyleURL));
428+
else
429+
mMap.setStyle(new Style.Builder().fromJson(mStyleURL));
427430

428431
reflow();
429432

0 commit comments

Comments
 (0)