{"license":"MIT","name":"react-konva","description":"React binding to canvas element via Konva framework","version":"16.8.0-2","keywords":["react","canvas","jsx","konva"],"bugs":{"url":"https://github.com/konvajs/react-konva/issues"},"main":"lib/ReactKonva.js","repository":{"type":"git","url":"git+ssh://git@github.com/konvajs/react-konva.git"},"dependencies":{"react-reconciler":"^0.19.0","scheduler":"^0.13.0"},"peerDependencies":{"react":"16.8.0","react-dom":"16.8.0","konva":"^2.6.0"},"devDependencies":{"chai":"^4.2.0","enzyme":"^3.8.0","enzyme-adapter-react-16":"^1.9.1","konva":"^2.6.0","nwb":"^0.23.0","react":"16.8.0","react-dom":"16.8.0","sinon":"^7.2.3","use-image":"^0.5.0"},"scripts":{"build":"nwb build-react-component","clean":"nwb clean-module && nwb clean-demo","start":"nwb serve-react-demo","test":"nwb test-react","test:coverage":"nwb test-react --coverage","test:watch":"nwb test-react --server","preversion":"npm test","version":"npm run build","postversion":""},"typings":"react-konva.d.ts","readme":"# React Konva\n\n[![Build Status](https://travis-ci.org/konvajs/react-konva.svg?branch=master)](https://travis-ci.org/konvajs/react-konva) [![Greenkeeper badge](https://badges.greenkeeper.io/konvajs/react-konva.svg)](https://greenkeeper.io/)\n\n![ReactKonva Logo](https://cloud.githubusercontent.com/assets/1443320/12193428/3bda2fcc-b623-11e5-8319-b1ccfc95eaec.png)\n\nReact Konva is a JavaScript library for drawing complex canvas graphics using\n[React](http://facebook.github.io/react/).\n\nIt provides declarative and reactive bindings to the\n[Konva Framework](http://konvajs.github.io/).\n\n# [OPEN DEMO](https://codesandbox.io/s/5m3nwp787x)\n\nAn attempt to make [React](http://facebook.github.io/react/) work with the HTML5\ncanvas library. The goal is to have similar declarative markup as normal React\nand to have similar data-flow model.\n\nCurrently you can use all `Konva` components as React components and all `Konva`\nevents are supported on them in same way as normal browser events are supported.\n\n## Installation\n\n```bash\nnpm install react-konva konva --save\n```\n\n## [Tutorials and Documentation](https://konvajs.github.io/docs/react/)\n\n## Example\n\n```javascript\nimport React, { Component } from 'react';\nimport { render } from 'react-dom';\nimport { Stage, Layer, Rect, Text } from 'react-konva';\nimport Konva from 'konva';\n\nclass ColoredRect extends React.Component {\n  state = {\n    color: 'green'\n  };\n  handleClick = () => {\n    this.setState({\n      color: Konva.Util.getRandomColor()\n    });\n  };\n  render() {\n    return (\n      <Rect\n        x={20}\n        y={20}\n        width={50}\n        height={50}\n        fill={this.state.color}\n        shadowBlur={5}\n        onClick={this.handleClick}\n      />\n    );\n  }\n}\n\nclass App extends Component {\n  render() {\n    return (\n      <Stage width={window.innerWidth} height={window.innerHeight}>\n        <Layer>\n          <Text text=\"Try click on rect\" />\n          <ColoredRect />\n        </Layer>\n      </Stage>\n    );\n  }\n}\n\nrender(<App />, document.getElementById('root'));\n```\n\nTo get more info about `Konva` you can read\n[Konva Overview](http://konvajs.github.io/docs/overview.html).\n\n**Actually you don't need to learn `react-konva`. Just learn `Konva` framework, you will understand how to use `react-konva`**\n\n## Comparisons\n\n### react-konva vs react-canvas\n\n[react-canvas](https://github.com/Flipboard/react-canvas) is a completely\ndifferent react plugin. It allows you to draw DOM-like objects (images, texts)\non canvas element in very performant way. It is NOT about drawing graphics, but\nreact-konva is exactly for drawing complex graphics on `<canvas>` element from\nReact.\n\n### react-konva vs react-art\n\n[react-art](https://github.com/reactjs/react-art) allows you to draw graphics on\na page. It also supports SVG for output. But it has no support of events of\nshapes.\n\n### react-konva vs vanilla canvas\n\nVanilla canvas is faster because when you use `react-konva` you have two layers of abstractions. Konva framework is on top of canvas and React is on top of Konva.\nDepending on the use case this approach can be slow.\nThe purpose of `react-konva` is to reduce the complexity of the application and use well-known declarative way for drawing on canvas.\n\n## [CHANGELOG](https://github.com/konvajs/react-konva/releases)\n\n\n**Note: you can find a lot of demos and examples of using Konva there:\n[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.**\n\n### Getting reference to Konva objects\n\nTo get reference of `Konva` instance of a node you can use `ref` property.\n\n```javascript\nclass MyShape extends React.Component {\n  componentDidMount() {\n    // log Konva.Circle instance\n    console.log(this.circle);\n  }\n  render() {\n    return <Circle ref={ref => (this.circle = ref)} radius={50} fill=\"black\" />;\n  }\n}\n```\n","readmeFilename":"README.md","gitHead":"722c48bd5d5441213dcc5d55d1b3095fb5eb99b8","homepage":"https://github.com/konvajs/react-konva#readme","_id":"react-konva@16.8.0-2","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"lavrton","email":"lavrton@gmail.com"},"dist":{"integrity":"sha512-2eZFFkoOVn3gAPUAskqnoBu+yHNTy7AGRxU1zRHkvNMRq//gnu5w4pP+mXrpYJyOkns/9bBDN116ZPAVfD65wQ==","shasum":"320d8183f2c25fb2ac26b740d795426873c006f4","tarball":"http://registry-npm.ywwl.com/react-konva/download/react-konva-16.8.0-2.tgz","fileCount":11,"unpackedSize":35695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWwzRCRA9TVsSAnZWagAAZ1QP/i+ZJdpbL+ogWASDHz+q\njXrHMrpyYTdtIXp9eMSo+AzUWnEkaRePjoD8hMhP/miZc+Ri46Q+Ftd+sv/o\nOzm9UZxPaeSl8EpXpD7sK6IkQexLNaVni2t4bDvEGqxVcqGPJCmsN4S6Gzk9\nXUQuxr3JE03AlOYhADhlzgVVkhfVovtGru2tILp//f4vyQxlqHAes28hq9/U\ndgexwyoz4jlaSpHhIo2h+g7PtHYRVct4lHAfZ0OKz+/pWWarfy4rn4oj8cPD\nrU1RkWg8Tm2fc2aO8Tcj4jOveRV6Cv+Ff9lBAGuVIDceUErE/BVPhzgr6CQ+\nggmtSmfrFtkpQSkDOPg8mHGqYqtya/WJMowmYMa2JLDE7LgsTqLkYqTNdRXZ\njPTYOH5INfd6fkm1W7vQLJ1R0AYd5iZhad2pfuSuDWuuDsY+QlRxjfLN3joq\nuXcIi2rPhK0m6S0Pgl8yWPmZCyaJsA8Add8A6iFlQiVa7PxnS6CnpdY8ozU/\nbev/AN/7s5Lv56U8hmz/u4I2lUqrzdBy1LRBioYVRmuA+pSzdnWZvKe3+roE\nSOXwHcB2zIUYjrAupYa/4d6s0GLjcR0eGZcd3Az2zBShXztclIk0MmL4/GQO\n0XXyfiW2V/XZS+XCZRev4bxFpvqy49zBRMr0coM55LgIp9Itr/qo0HGO+trl\nFrW0\r\n=qGy2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDm2cjKz/Wc1r+WyUv63lZaLp0kP0rgPvyjfXGxOhvR5AIgctoPgDvA7cCNuLe8lqwQQ8bN1Xm0ddNEr75a/O5VNc0="}],"size":10528,"noattachment":false,"key":"/react-konva/-/react-konva-16.8.0-2.tgz"},"maintainers":[{"name":"lavrton","email":"lavrton@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-konva_16.8.0-2_1549470928635_0.07837201224012791"},"_hasShrinkwrap":false,"publish_time":1549470928747,"_cnpm_publish_time":1549470928747,"dist-tags":{"beta":"19.0.0-1","latest":"19.3.2","legacy":"18.2.16","next":"19.2.0-3"}}