nitaliano / react-native-mapbox-gl

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

SymbolLayer : crash when no prop id (iOS / Android) #1146

Open matthieupinte opened 6 years ago

matthieupinte commented 6 years ago

Hi,

react: ^16.3.0-alpha.1
react-native: 0.53.3
@mapbox/react-native-mapbox-gl: ^6.1.0
@turf/helpers: ^6.1.1

I juste found by testing that my app crash when I don't set an id prop in SymbolLayer.

Example:

const styles = MapboxGL.StyleSheet.create({ marker: { iconImage: 'marker', iconAllowOverlap: true, iconSize: 1, }, })

export default ({ id, coordinates }) => coordinates ? ( <MapboxGL.ShapeSource id="xxx" shape={point([coordinates.longitude, coordinates.latitude])} images={{ assets: ['marker'] }}

</MapboxGL.ShapeSource> ) : null

const styles = MapboxGL.StyleSheet.create({ marker: { iconImage: 'marker', iconAllowOverlap: true, iconSize: 1, }, })

export default ({ id, coordinates }) => coordinates ? ( <MapboxGL.ShapeSource id="xxx" shape={point([coordinates.longitude, coordinates.latitude])} images={{ assets: ['marker'] }}

</MapboxGL.ShapeSource> ) : null

I'm reporting it, because in your documentation, it says that id is not required

Best regards,

nitaliano commented 6 years ago

Thanks, id is a required field for a layer, we'll update the prop types for it and regenerate the documentation.