React Click events not firing on mobile

前端 未结 2 1677
深忆病人
深忆病人 2020-12-30 04:34

I\'ve been working with react for a couple of months now, but have just run into something a little weird.

Click events aren\'t being fired at all on mobile devices:

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 05:21

    There are a few issues in React's Github project which might be helpful.

    • onClick on mobile not fired
    • MobileSafariClickEventPlugin requires touch events to be initialized

    Looks like, you need to add a CSS cursor:'pointer' so that mobile phones (iOS devices specifically) fire native click event on the element.

提交回复
热议问题