React-native-mapbox-gl: Annotation moving first then shape-source with line-layer follows, why ?

Created on 17 Apr 2018  路  3Comments  路  Source: nitaliano/react-native-mapbox-gl

I am drawing a poly-line with point annotations(arrows in my output)

When i move the map the annotations moves first then the line drawn by shapesource follows

I have created a sample picture of this (it was drawn to show my situation when moving the map)

arrow moviing

the below is the actual output -

violet

Why does this occur in my i want the annotations have to move along with the line and i am unable to use shape-source with symbol layer due to this issue already raised by my friend link below

https://github.com/mapbox/react-native-mapbox-gl/issues/1173

point annotation code below -

renderArrowAnnotations(lat, lon, index, angle) {
        return (
            <Mapbox.PointAnnotation
                key={index.toString()}
                id={index.toString()}
                coordinate={[lon, lat]}
                style={[styles.annotationStyle,
                { transform: [{ rotate: angle.toString() + 'deg' }] }]}
            >
                <Image source={Images.right_arrow} style={styles.arrowImageStyle} />
            </Mapbox.PointAnnotation>
        );
    }

And i have drawn line using line-layer and shape-source

line-layer code below -

<MapboxGL.ShapeSource id='line1' shape={line}>
       <MapboxGL.LineLayer style={layerStyles.route} id='linelayer1' />
</MapboxGL.ShapeSource>

Is there anyway to handle this issue ?

Most helpful comment

Yes, PointAnnotations will be officially deprecated in our next major release, they are already deprecated in our native Android SDK.

If you want control and incredible performance use Sources/Layers, there is a learning curve at first but your product will be better for it, so instead of a PointAnnotation use a SymbolLayer

All 3 comments

Same issue, PointAnnotation don't move at the same time with the map.

There is some good discussion here on PointAnnotation behaviour https://github.com/mapbox/react-native-mapbox-gl/issues/825#issuecomment-348265375

Yes, PointAnnotations will be officially deprecated in our next major release, they are already deprecated in our native Android SDK.

If you want control and incredible performance use Sources/Layers, there is a learning curve at first but your product will be better for it, so instead of a PointAnnotation use a SymbolLayer

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olofd picture olofd  路  3Comments

lernerbot picture lernerbot  路  3Comments

Maxence-Machu picture Maxence-Machu  路  3Comments

vyankat70war picture vyankat70war  路  3Comments

glennverschooren picture glennverschooren  路  4Comments