zcreativelabs / react-simple-maps

Beautiful React SVG maps with d3-geo and topojson using a declarative api.
https://www.react-simple-maps.io/
MIT License
3.11k stars 426 forks source link

Module '"react-simple-maps"' has no exported member 'useZoomPanContext' #310

Open jbouhier opened 1 year ago

jbouhier commented 1 year ago

I'm using react-simple-maps + @types/react-simple-maps v3.0.0. useZoomPanContext and all the other hooks from the docs are missing from @types/react-simple-maps's type declarations.

How can I help to fix that @zimrick ?

richardfinegan commented 1 year ago

Wow, good timing, I am facing the exact same problem.

richardfinegan commented 1 year ago

@jbouhier Here, this worked for me:

// extraTypings.d.ts import * as ReactSimpleMaps from "react-simple-maps";

declare module "react-simple-maps" { export function useZoomPanContext(): {x: number; y: number; k: number; transformString: string;};
}

jbouhier commented 1 year ago

@richardfinegan I was looking for this workaround. Thank you!

jesuissuyaa commented 1 year ago

@jbouhier Were you able to use useZoomPanContext() in your app? When I call const ctx = useZoomPanContext(), the return value is undefined.