Skip to content

modeOptions are not applied on initial Draw creation #20

@riazjahangir

Description

@riazjahangir

I have defined a custom draw mode as described at https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md#available-custom-modes.

The custom mode makes use of modeOptions in its onSetup function, but these are not being passed via the modeOptions attribute of Draw as I would have expected.

Essentially I have:

<Draw
  mode="my_custom_mode"
  modeOptions={modeOptions}
  modes={(defaultModes) => ({
     ...defaultModes,
     my_custom_mode: MyCustomMode,
   })}
...

Looking at the source, it seems that modeOptions are only passed on component update, not on initial mount, so modeOptions cannot be used with the default mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions