Skip to content

Commit

Permalink
fixing map init location
Browse files Browse the repository at this point in the history
  • Loading branch information
midhun-aot committed Aug 28, 2023
1 parent bc19f57 commit 17b17ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion map-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-parcelmap-bc",
"version": "1.0.4",
"version": "1.0.6",
"private": false,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
Expand Down
11 changes: 9 additions & 2 deletions map-package/src/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ const Map = (props) => {

useEffect(() => {
if (props.initLocation.length > 0 && props.initLocation !== null && props.initLocation !== undefined) {
setZoom(13);
setLocation(props.initLocation);

if(props.readOnly)
{
setShow(false);
}

const timer = setTimeout(() => {
setZoom(13);
setLocation(props.initLocation);
}, 1000); // 3000 milliseconds (3 seconds)

// Clean up the timer to avoid memory leaks
return () => clearTimeout(timer);
}
}, [props]);

Expand Down

0 comments on commit 17b17ee

Please sign in to comment.