This is a very straightforward question, and I'm sure the answer is as well, but I can't seem to figure it out. I want to be able to draw a simple shape, in this case, a circle. Here is what I did:
RenderSurface.jsx
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Surface } from '@progress/kendo-drawing';
import drawCircle from './DrawCircle';
class RenderSurface extends React.Component {
surface;
componentDidMount() {
drawCircle(this.createSurface());
}
createSurface = () => {
const element = ReactDOM.findDOMNode(this);
this.surface = Surface.create(element);
return this.surface;
}
render() {
return (<div id="surface" />);
}
}
export default RenderSurface;
DrawCircle.jsx
import { geometry } from '@progress/kendo-drawing';
const { Circle } = geometry;
export default function drawCircle(surface) {
const circle = new Circle([100, 100], 80, {
stroke: { color: "red", width: 1 },
color: "rgb(255, 0, 0)",
});
surface.draw(circle);
}
App.js
import '@progress/kendo-theme-default/dist/all.css';
import './App.scss';
import React from 'react';
import RenderSurface from './components/RenderSurface';
function App() {
return (
<div className="App">
<RenderSurface/>
</div>
);
}
export default App;
When I run this, I get the following error:
TypeError: _node_map__WEBPACK_IMPORTED_MODULE_4__.default[srcElement.nodeType] is not a constructor
I though it might have to do with bad import, but whatever I tried, it's always this error. What am I doing wrong?