I'm using react-konva in my webapp and on the desktop browser it works perfectly, but on the mobile browser the onClick
does not work.
<Text
key={index}
index={index}
x={position[0]}
y={position[1]}
fontSize={unit}
width={unit}
text={mark}
fill={fill}
fontFamily={'Helvetica'}
align={'center'}
onClick={ (event) => {
alert("Some text...")
}}
/>
Is there a way to get this to work on mobile or do I need to find a replacement for react-konva text?
You have to use a special mobile event: onTap
.
https://konvajs.github.io/docs/events/Mobile_Events.html
So in your case just use onClick
and onTap
together.
<Text
{...attrs}
onClick={this.handleClick}
onTap={this.handleClick}
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With