layerIndex Property Throws Error/Not Adding Layers In Correct Order
See original GitHub issueDescribe the bug Using layerIndex property in layers does not appear to be working and throws an error.
To Reproduce Steps to reproduce the behavior
{loading ? null : (<Mapbox.RasterSource id="rasterSourceBasemap" tileSize={256} url={Url}>
<Mapbox.RasterLayer
id="basemap"
sourceID="rasterSourceBasemap"
style={{ rasterOpacity: 1 }}
layerIndex={1}
/>
</Mapbox.RasterSource>)}
{loading ? null : (<Mapbox.ShapeSource>
<Mapbox.SymbolLayer
id="guz"
style={{ visibility: (layers.guz.show ? "visible" : "none") }}
layerIndex={10}
/>
</Mapbox.ShapeSource>)}
Expected behavior The layers would show in the order of the defined layerIndex.
Screenshots I get the following error:
At times when the error is not present the layers don’t seem to respond to the actual layerIndex defined in each layer.
Versions (please complete the following information):
- Platfrom: iOS
- React Native Version 0.59
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
layerIndex Property Throws Error/Not Adding Layers ... - GitHub
Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot insert style layer at out-of-bounds index 50. I have 14 layers on my map,...
Read more >Error: The layer, <layer_name>, cannot be added to the map
Solution or Workaround · In Map Viewer Classic, in the Contents pane, browse to the layer, and click Remove. · When prompted, click...
Read more >Using layers with your Lambda function - AWS Documentation
Adding a layer to a function Open the Functions page of the Lambda console. Choose the function to configure. Under Choose a layer,...
Read more >Using z-index - CSS: Cascading Style Sheets - MDN Web Docs
The first article of this guide, Stacking without the z-index property, explains how stacking is arranged by default.
Read more >Layer—ArcGIS Pro | Documentation
Used to determine if a particular layer type supports a property on the layer object. Not all layers support the same set of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have exactly the same problem. There is no error without specifying an index, but there is no way to set the correct layer order
I tried #361 in my project with setting
layerIndex
instead ofaboveLayerId
. The layers in my map style (street names, etc.) are placed rather high up with the highest being aroundlayerIndex
40-42. I want my own layers to be placed above all the map’s own layers, so if I setlayerIndex
to 50 for my own layer, I get:Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot insert style layer at out-of-bounds index 50.
I have 14 layers on my map, so I have to use the 8 indexes between 42 and 50, and rely onaboveLayerId
layers in the sameShapeSource
.Does anyone know why it is not possible to use an index >= 50? @mfazekas
Versions (please complete the following information):
Platfrom: iOS React Native Version 0.59.9