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

draw.setFeatureProperty() not working #27

Closed
rob137 opened this issue Apr 16, 2019 · 3 comments · Fixed by #32
Closed

draw.setFeatureProperty() not working #27

rob137 opened this issue Apr 16, 2019 · 3 comments · Fixed by #32
Labels

Comments

@rob137
Copy link
Contributor

rob137 commented Apr 16, 2019

Thanks for sharing your work on this, it's been super useful.

I would like to change the styles of features, but it looks to me that I can't set the userProperties option. From the mapbox-gl-draw API reference:

If opts.userProperties is set to true the properties of a feature will also be available for styling.

I tried changing the styles of features by calling draw.setFeatureProperties() but nothing was happening - until I went into lib/index.js of this package and set userProperties: true on the MapBoxDraw instantiation.

Am I missing something here, or is a change needed?

@amaury1093
Copy link
Owner

Hey @rob137, sorry for the late reply!

Can you try <DrawControl userProperties={true}>?

https://github.com/amaurymartiny/react-mapbox-gl-draw/blob/fd1f0349ec57d70713c1b75cf3f3484b77f0b573/src/index.ts#L79-L85

I actually pass in all the props into the Draw constructor. If the above works, it'll just be a docs update.

@rob137
Copy link
Contributor Author

rob137 commented Jul 16, 2019

@amaurymartiny Worked like magic. Thanks! 🙇‍♂️

@amaury1093
Copy link
Owner

Release in [email protected] 🚀

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

Successfully merging a pull request may close this issue.

2 participants