问题描述
能与ReactJS的活动系统搭配使用吗?当通过Cordova运行到iOS或Android上时,似乎没有采取。如果没有,是否有另一种方式获得相同的结果。我的应用程序没有双击功能,所以我想消除这种延迟,如果可能...
Does fastclick work with ReactJS's event system? It doesn't seem to be taking when run through Cordova onto iOS or Android. If not, is there another way of getting the same results. My app has no double-tap functionality so I'd like to remove that delay across the board, if possible...
推荐答案
我在Webpack项目中得到了FastClick与React一起工作。几件事情似乎很有趣,但它大多是工作。 (更新:只有一个模拟隐藏复选框上的点击的切换开关是有限的 - 这将是一个问题,不管React)。以下是我的启用方式:
I got FastClick to work with React, in a Webpack project. A few things seem finicky but it mostly works. (Update: only a toggle switch that was simulating clicks on a hidden checkbox was finicky -- that would be a problem regardless of React). Here's how I turned it on:
npm install -S fastclick
在 main.jsx
:
import FastClick from 'fastclick';
window.addEventListener('load', () => {
FastClick.attach(document.body);
});
所以即使你不使用Webpack或Browserify,我猜你只要运行加载事件监听器,你会很好。
So even if you're not using Webpack or Browserify, I'm guessing as long as you can run the load event listener, you'll be fine.
这篇关于我可以快速点击在Cordova中运行的ReactJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!