Skip to content

Commit

Permalink
fix(Map): Fix center props errors. #134
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 19, 2021
1 parent d2ad745 commit deda472
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Map/useMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export default function useMap(props: UseMap = {}) {
let cent = center;
if (center && (center as BMap.Point).lng && (center as BMap.Point).lat) {
cent = new BMap.Point((center as BMap.Point).lng, (center as BMap.Point).lat);
map.centerAndZoom(cent!, zoom!);
} else if (typeof center === 'string') {
map.centerAndZoom(center, zoom!);
}
map.centerAndZoom(cent!, zoom!);
}
}, [center, map]);

Expand Down

0 comments on commit deda472

Please sign in to comment.