react-konva-utils
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -13,3 +13,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactDOM from 'react-dom/client'; | ||
import { Group } from 'react-konva'; | ||
@@ -24,8 +24,6 @@ const needForceStyle = (el) => { | ||
const container = React.useRef(); | ||
const [div] = React.useState(() => document.createElement('div')); | ||
const root = React.useMemo(() => ReactDOM.createRoot(div), [div]); | ||
const shouldTransform = transform !== null && transform !== void 0 ? transform : true; | ||
const handleTransform = () => { | ||
const div = container.current; | ||
if (!div) { | ||
return; | ||
} | ||
if (shouldTransform && groupRef.current) { | ||
@@ -66,4 +64,2 @@ const tr = groupRef.current.getAbsoluteTransform(); | ||
} | ||
let div = document.createElement('div'); | ||
container.current = div; | ||
parent.appendChild(div); | ||
@@ -78,3 +74,2 @@ if (shouldTransform && needForceStyle(parent)) { | ||
group.off('absoluteTransformChange', handleTransform); | ||
ReactDOM.unmountComponentAtNode(div); | ||
(_a = div.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(div); | ||
@@ -87,5 +82,10 @@ }; | ||
React.useLayoutEffect(() => { | ||
ReactDOM.render(children, container.current); | ||
root.render(children); | ||
}); | ||
React.useEffect(() => { | ||
return () => { | ||
root.unmount(); | ||
}; | ||
}, []); | ||
return React.createElement(Group, Object.assign({ ref: groupRef }, groupProps)); | ||
}; |
{ | ||
"name": "react-konva-utils", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Useful components and hooks for react-konva", | ||
@@ -12,10 +12,11 @@ "author": "Anton Lavrenov", | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"react-konva": "^17.0.2-4", | ||
"use-image": "^1.0.7" | ||
"react-konva": "^18.0.0-0", | ||
"use-image": "^1.0.12" | ||
}, | ||
"peerDependencies": { | ||
"konva": "8.x", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
"konva": "^8.3.5", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
@@ -29,15 +30,15 @@ "types": "./es/index.d.ts", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.14", | ||
"@storybook/addon-actions": "^6.2.2", | ||
"@storybook/core-server": "^6.3.0", | ||
"@storybook/addon-essentials": "^6.2.2", | ||
"@storybook/addon-links": "^6.2.2", | ||
"@storybook/core": "^6.3.0", | ||
"@storybook/react": "^6.2.2", | ||
"@types/react": "^17.0.3", | ||
"babel-loader": "^8.2.2", | ||
"@babel/core": "^7.17.9", | ||
"@storybook/addon-actions": "^6.5.0-alpha.61", | ||
"@storybook/addon-essentials": "^6.5.0-alpha.61", | ||
"@storybook/addon-links": "^6.5.0-alpha.61", | ||
"@storybook/core": "^6.5.0-alpha.61", | ||
"@storybook/core-server": "^6.5.0-alpha.61", | ||
"@storybook/react": "^6.5.0-alpha.61", | ||
"@types/react": "^18.0.1", | ||
"babel-loader": "^8.2.4", | ||
"parcel-bundler": "^1.12.4", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"typescript": "^4.2.3" | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
@@ -44,0 +45,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12521
15
+ Added@types/react-reconciler@0.28.9(transitive)
+ Addedits-fine@1.2.5(transitive)
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedreact-konva@18.2.10(transitive)
+ Addedreact-reconciler@0.29.2(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removed@types/react-reconciler@0.26.7(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-dom@17.0.2(transitive)
- Removedreact-konva@17.0.2-6(transitive)
- Removedreact-reconciler@0.26.2(transitive)
- Removedscheduler@0.20.2(transitive)
Updatedreact-konva@^18.0.0-0
Updateduse-image@^1.0.12