react-konva
Advanced tools
Comparing version
@@ -10,2 +10,5 @@ /** | ||
import React from 'react'; | ||
if (React.version.indexOf('19') === -1) { | ||
throw new Error('react-konva version 19 is only compatible with React 19. Make sure to have the last version of react-konva and react or downgrade react-konva to version 18.'); | ||
} | ||
import Konva from 'konva/lib/Core.js'; | ||
@@ -62,5 +65,2 @@ import ReactFiberReconciler from 'react-reconciler'; | ||
return () => { | ||
if (!Konva.isBrowser) { | ||
return; | ||
} | ||
_setRef(null); | ||
@@ -67,0 +67,0 @@ KonvaRenderer.updateContainer(null, fiberRef.current, null); |
@@ -48,2 +48,5 @@ /** | ||
const react_1 = __importDefault(require("react")); | ||
if (react_1.default.version.indexOf('19') === -1) { | ||
throw new Error('react-konva version 19 is only compatible with React 19. Make sure to have the last version of react-konva and react or downgrade react-konva to version 18.'); | ||
} | ||
const Core_js_1 = __importDefault(require("konva/lib/Core.js")); | ||
@@ -100,5 +103,2 @@ const react_reconciler_1 = __importDefault(require("react-reconciler")); | ||
return () => { | ||
if (!Core_js_1.default.isBrowser) { | ||
return; | ||
} | ||
_setRef(null); | ||
@@ -105,0 +105,0 @@ exports.KonvaRenderer.updateContainer(null, fiberRef.current, null); |
@@ -5,3 +5,3 @@ { | ||
"description": "React binding to canvas element via Konva framework", | ||
"version": "19.0.2-1", | ||
"version": "19.0.2", | ||
"keywords": [ | ||
@@ -23,3 +23,4 @@ "react", | ||
"its-fine": "^1.2.5", | ||
"scheduler": "0.25.0" | ||
"scheduler": "0.25.0", | ||
"react-reconciler": "0.31.0" | ||
}, | ||
@@ -44,3 +45,2 @@ "targets": { | ||
"peerDependencies": { | ||
"react-reconciler": "~0.29.0 || ~0.31.0", | ||
"konva": "^8.0.1 || ^7.2.5 || ^9.0.0", | ||
@@ -75,3 +75,3 @@ "react": "^18.3.1 || ^19.0.0", | ||
"test": "NODE_ENV=test npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security && npm run test:typings", | ||
"test:build": "NODE_ENV=test parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps", | ||
"test:build": "rm -rf ./.parcel-cache && NODE_ENV=test parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps", | ||
"test:watch": "NODE_ENV=test rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html" | ||
@@ -78,0 +78,0 @@ }, |
@@ -167,3 +167,3 @@ # React Konva | ||
### Usage with Next.js | ||
## Usage with Next.js | ||
@@ -176,4 +176,16 @@ Note: `react-konva` is designed to work in the client-side. On the server side, it will render just empty div. So it doesn't make much sense to use react-konva for server-side rendering. In Next.js you may have issue like | ||
#### Use dynamic loading | ||
How to solver this issue? There are two approaches: | ||
### Approach 1: manually install canvas module | ||
You can install `canvas` module manually. | ||
```bash | ||
npm install canvas@next | ||
``` | ||
The solution will solve the issue, but it will have unnecessary dependency on `canvas` module which may increase build time a little bit. | ||
### Approach 2: Use dynamic import | ||
Next.js docs: https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading | ||
@@ -180,0 +192,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
67064
0.97%1
-50%328
3.8%+ Added