react-konva
Advanced tools
Comparing version 18.2.2 to 18.2.3
@@ -29,5 +29,2 @@ import { Konva } from 'konva/lib/Global'; | ||
export function applyNodeProps(instance, props, oldProps = EMPTY_PROPS) { | ||
if (props === oldProps) { | ||
console.error('same props'); | ||
} | ||
// don't use zIndex in react-konva | ||
@@ -34,0 +31,0 @@ if (!zIndexWarningShowed && 'zIndex' in props) { |
@@ -33,5 +33,2 @@ "use strict"; | ||
function applyNodeProps(instance, props, oldProps = EMPTY_PROPS) { | ||
if (props === oldProps) { | ||
console.error('same props'); | ||
} | ||
// don't use zIndex in react-konva | ||
@@ -38,0 +35,0 @@ if (!zIndexWarningShowed && 'zIndex' in props) { |
@@ -5,3 +5,3 @@ { | ||
"description": "React binding to canvas element via Konva framework", | ||
"version": "18.2.2", | ||
"version": "18.2.3", | ||
"keywords": [ | ||
@@ -21,3 +21,3 @@ "react", | ||
"dependencies": { | ||
"its-fine": "^1.0.1", | ||
"its-fine": "^1.0.6", | ||
"react-reconciler": "~0.29.0", | ||
@@ -53,3 +53,3 @@ "scheduler": "^0.23.0" | ||
"chai": "4.3.6", | ||
"konva": "^8.3.12", | ||
"konva": "^8.3.13", | ||
"mocha-headless-chrome": "^4.0.0", | ||
@@ -60,4 +60,4 @@ "parcel": "^2.7.0", | ||
"react-dom": "^18.2.0", | ||
"sinon": "^14.0.0", | ||
"typescript": "^4.8.3", | ||
"sinon": "^14.0.1", | ||
"typescript": "^4.8.4", | ||
"use-image": "^1.1.0", | ||
@@ -64,0 +64,0 @@ "util": "^0.12.4" |
@@ -42,7 +42,7 @@ # React Konva | ||
state = { | ||
color: 'green' | ||
color: 'green', | ||
}; | ||
handleClick = () => { | ||
this.setState({ | ||
color: Konva.Util.getRandomColor() | ||
color: Konva.Util.getRandomColor(), | ||
}); | ||
@@ -104,3 +104,5 @@ }; | ||
render() { | ||
return <Circle ref={ref => (this.circle = ref)} radius={50} fill="black" />; | ||
return ( | ||
<Circle ref={(ref) => (this.circle = ref)} radius={50} fill="black" /> | ||
); | ||
} | ||
@@ -164,7 +166,7 @@ } | ||
// load minimal version of 'react-konva` | ||
import { Stage, Layer, Rect } from "react-konva/lib/ReactKonvaCore"; | ||
import { Stage, Layer, Rect } from 'react-konva/lib/ReactKonvaCore'; | ||
// minimal version has NO support for core shapes and filters | ||
// if you want import a shape into Konva namespace you can just do this: | ||
import "konva/lib/shapes/Rect"; | ||
import 'konva/lib/shapes/Rect'; | ||
``` | ||
@@ -175,10 +177,14 @@ | ||
### Usage with React Context | ||
**Note: this section may be not relevant, because this issue was fixed in `react-konva@18.2.2`. So context should work by default.** | ||
Due to a [known issue](https://github.com/facebook/react/issues/13336) with React, Contexts are not accessible by children of the react-konva `Stage` component. If you need to subscribe to a context from within the `Stage`, you need to "bridge" the context by creating a `Provider` as a child of the `Stage`. For more info, see [this discussion](https://github.com/konvajs/react-konva/issues/188#issuecomment-478302062) and this [react-redux demo](https://github.com/konvajs/react-konva/issues/311#issuecomment-454411007). Here is an example of bridging the context ([live demo](https://codesandbox.io/s/ykqw8r4r21)): | ||
```js | ||
import React, { Component } from "react"; | ||
import Konva from "konva"; | ||
import { render } from "react-dom"; | ||
import { Stage, Layer, Rect } from "react-konva"; | ||
import React, { Component } from 'react'; | ||
import Konva from 'konva'; | ||
import { render } from 'react-dom'; | ||
import { Stage, Layer, Rect } from 'react-konva'; | ||
const ThemeContext = React.createContext("red"); | ||
const ThemeContext = React.createContext('red'); | ||
@@ -195,3 +201,3 @@ const ThemedRect = () => { | ||
<ThemeContext.Consumer> | ||
{value => ( | ||
{(value) => ( | ||
<Stage width={window.innerWidth} height={window.innerHeight}> | ||
@@ -244,6 +250,3 @@ <ThemeContext.Provider value={value}> | ||
**Note: you can find a lot of demos and examples of using Konva there: | ||
[http://konvajs.github.io/](http://konvajs.github.io/). Really, just go there and take a look what Konva can do for you. You will be able to do the same with `react-konva` too.** | ||
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
58343
247
1132
Updatedits-fine@^1.0.6