Search code examples
reactjsmapbox-gl

React mapbox gl draw how to change the value in controls


Hey i am trying to change the props I am adding to controls but I can't seem to access the type.

 <DrawControl onDrawCreate={onDrawCreate} onDrawUpdate={onDrawUpdate} displayControlsDefault ={false} controls = {}  />

    controls?: Partial<{
    point: boolean;
    line_string: boolean;
    polygon: boolean;
    trash: boolean;
    combine_features: boolean;
    uncombine_features: boolean;
}>;
default_mode?: string;
displayControlsDefault?: boolean;
keybindings?: boolean;
modes?: object;

How would I set the values for combine_features and uncombine_features in DrawControl... please help


Solution

  • I was able to find a solution -

    I just had to do

    <DrawControl onDrawCreate={onDrawCreate} onDrawUpdate={onDrawUpdate} displayControlsDefault = {false} controls ={{point: true, line_string: true, polygon: true, trash: true}} />

    Wasn't adding the double {{}} before