nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 699 forks source link

Custom component in shape source? #1635

Open ErikTillberg opened 5 years ago

ErikTillberg commented 5 years ago

It seems that adding a marker with a shape source and symbol layer from an asset is fairly straightforward:

<MapboxGL.ShapeSource
        id="allNotes"
        images={{ assets }}
        shape={{
          type: 'FeatureCollection',
          features: notesFetched,
        }}
        cluster={false}
        onPress={this.notePressed}
      >
        <MapboxGL.SymbolLayer id="noteId" style={styles.msgIcon} /
</MapboxGL.ShapeSource>

However, what if I wanted to load a custom component as the marker instead of some asset, let's say for example, what I have accomplished with point annotations:

<MapboxGL.PointAnnotation
        key = "key"
        id="id"
        title="End Location"
        coordinate={loc}>
        <EntypoIcon name="location-pin" size={40} color="green" />
</MapboxGL.PointAnnotation>

Is there a way to replicate this with the shape source and symbol layer components?

cesar3030 commented 4 years ago

Also interested to know if it is possible 👍