I use react-mapbox-gl 5.1 and react-mapbox-gl-draw 2.0.4
const data = {
features: data.map((layer) => {
const { coordinates, geo_type } = layer
return {
geometry: {
coordinates, // [32.4123131, 123131.2322]
type: MAP_TYPE[geo_type], // Point | LineString | Polygon
},
properties: layer,
type: 'Feature',
}
}),
type: 'FeatureCollection',
}
<Map ref={ref}>
<DrawControl
onDrawUpdate={onDrawUpdate}
onDrawCreate={onDrawCreate}
controls={{
point: true,
line_string: true,
polygon: true,
trash: true,
combine_features: false,
uncombine_features: false,
}}
/>
<GeoJSONLayer data={data} {...geojsonStyles} />
</Map>
When I add elements through <DrawControl />
, they are active and can be draggable
But all items added from data not active