Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modeOptions are not applied on initial Draw creation #20

Open
riazjahangir opened this issue Jan 25, 2021 · 0 comments
Open

modeOptions are not applied on initial Draw creation #20

riazjahangir opened this issue Jan 25, 2021 · 0 comments

Comments

@riazjahangir
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant