Android: PointAnnotation renders underneath other layers
See original GitHub issueWhen PointAnnotation is rendered in the same space as another layer (such as LineLayer, or RasterLayer) it shows underneath the other layer. This is almost never what you would want.
It would be ideal if we could select where the PointAnnotation renders using something similar to aboveLayerID and belowLayerID, but as a default case I think it should render on top of all the other layers (I can’t think of many cases where you wouldn’t want this anyway).
Repro
<MapboxGL.MapView style={{ flex: 1 }}>
<MapboxGL.Camera
bounds={{
ne: [2, 2],
sw: [-2, -2],
}}
/>
<MapboxGL.ShapeSource
id="line-source"
shape={
{
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [[1, 1], [-1, -0.7]],
},
}
}
/>
<MapboxGL.LineLayer
id="line-layer"
sourceID="line-source"
/>
<MapboxGL.PointAnnotation
id="point"
coordinate={[0, 0]}
/>
</MapboxGL.MapView>
Changing the order of the elements in code appears to have no effect.
Interestingly if you put content in the PointAnnotation it renders on top with iOS and under in android.
<MapboxGL.PointAnnotation
id="point"
coordinate={[-0.1, 0]}
>
<Text>test</Text>
</MapboxGL.PointAnnotation>
By pushing it under one of the builtin layers on android this behaviour can be changed eg:
<MapboxGL.LineLayer
id="line-layer"
sourceID="line-source"
style={{ lineWidth: 8, lineColor: 'white' }}
belowLayerID={Platform.OS === 'android' ? 'mapbox-android-symbol-layer-1' : undefined}
/>
Versions:
- Platform: Both
- Device: iPhone 11 13.4, Pixel 2 8.1
- Emulator/ Simulator: have tried on both emulator and physical
- react-native-mapbox-gl Version 8.0.0-rc1
- React Native Version 0.62
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:17 (3 by maintainers)
Top Results From Across the Web
Android: PointAnnotation renders underneath other layers #806
When PointAnnotation is rendered in the same space as another layer (such as LineLayer, or RasterLayer) it shows underneath the other layer.
Read more >pointannotation is not working in android - Stack Overflow
I don't have issue real device and emulator. It is behave same in both. In Android it is going under other layers, that...
Read more >rnmapbox/Lobby - Gitter
next question, it looks like PointAnnotation renders under other layers (this ... On android the layer id might-be: mapbox-android-symbol-layer-0 or ...
Read more >PointAnnotationManager - Mapbox docs
PointAnnotation Manager. The pointAnnotation manager allows to add pointAnnotations to a map. class PointAnnotationManager(mapView: View, delegateProvider: ...
Read more >Style Layers | Maplibre gl native ios | MapTiler
Use a background style layer to configure a color or pattern to show below all other map content. If the style's other layers...
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
any update of this?
+1 will try and use SymbolLayer for now, but would be nice if PointAnnotation could be rendered above LineLayer on android