react-zoom-pan-pinch 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2053,7 +2053,20 @@ var useTransformEffect = function (callback) {
2053
2053
 
2054
2054
  function useTransformComponent(callback) {
2055
2055
  var libraryContext = useTransformContext();
2056
- return React.useMemo(function () { return callback(getState(libraryContext)); }, [libraryContext, callback]);
2056
+ var _a = React.useState(callback(getState(libraryContext))), transformRender = _a[0], setTransformRender = _a[1];
2057
+ React.useEffect(function () {
2058
+ var mounted = true;
2059
+ var unmount = libraryContext.onChange(function (ref) {
2060
+ if (mounted) {
2061
+ setTransformRender(callback(getState(ref.instance)));
2062
+ }
2063
+ });
2064
+ return function () {
2065
+ unmount();
2066
+ mounted = false;
2067
+ };
2068
+ }, [callback, libraryContext]);
2069
+ return transformRender;
2057
2070
  }
2058
2071
 
2059
2072
  exports.Context = Context;