JustFly1984 / react-google-maps-api

React Google Maps API
MIT License
1.78k stars 437 forks source link

Drawing Manager Functional component doesn't return polygon paths #3033

Closed SimonasPetk closed 2 years ago

SimonasPetk commented 2 years ago

Explanation of the issue

I am trying to draw a polygon with a functional component of the drawing manager, however, it doesn't return any path coordinates once the polygon is complete.

Every other onComplete action works fine, onOverlayComplete returns an object of type: polygon.

Also, it seems that the class-based component works fine.

I can try to fix it, if you don't mind.

My Environment

os: linux (Zorin OS Lite)

node - V18.1.0

"@react-google-maps/api": "^2.11.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.0.0-beta.8",
"react-scripts": "^5.0.0",

How does it behave?

'DrawingManagerF' component doesn't return any values when onPolygonComplete

How should it behave correctly?

'DrawingManagerF' should behave the same as 'DrawingManager' class component and return drawing manager polygon values.

Basic implementation of incorrect behavior in codesandbox.com

https://codesandbox.io/s/determined-sinoussi-nokefu

SimonasPetk commented 2 years ago

Hi @JustFly1984, I have created a pull request (#3034 ) that fixes this issue, may you take a look at it? Thanks!

JustFly1984 commented 2 years ago

@SimonasPetk Thank you, please test 2.12.0

SimonasPetk commented 2 years ago

@JustFly1984 Looks fine to me.:)