I am using react-konva, and found that the onClick event does not trigger when the Stage has its draggable property true.
import React from 'react'
import ReactDOM from 'react-dom'
import Konva from 'konva'
import { Layer, Rect, Stage } from 'react-konva'
import './App.css'
class App extends React.Component {
render() {
return (
<div ref='container'>
<Stage width={700} height={700} draggable={true} >
<Layer>
<Rect
x={100}
y={100}
width={200}
height={100}
stroke={'red'}
onClick={() => { console.log('Click on Rect') }}
/>
</Layer>
</Stage>
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById('root'));
The 'Click on Rect' message does not appear in the console (using Chrome 61.0.3163.100). If you set draggable={false} on the Stage, the message does show. Is this a known limitation of react-konva? Is there a workaround? It seems to happen with Group also ...