Lucifier129 / react-lite

An implementation of React v15.x that optimizes for small script size
MIT License
1.73k stars 100 forks source link

Hotfix/touchmove #115

Open seanpan opened 7 years ago

seanpan commented 7 years ago

不好意思直接开了PR方便描述,请看一下

touchstart和touchend都能正常工作,因为不在unbubbleEvents列表中,而touchmove则不然,见: src/event-system.js:81

直接在element上加ontouchtmove似乎是有问题的(在chrome设备模拟器中即可重现),不过不是太明白当时你写为unbubble的意图,来请教一下。

直接从unbubbleEvents列表中移除后目前case可pass,测试也没问题。后续我考虑补齐一些event-system相关的case。

请告诉我你的想法

Lucifier129 commented 7 years ago

把 touchmove 添加到 unbubbleEvents 是因为 react 里有个 issue,说不要把 touchmove 绑定到 document 节点,会导致用户在 touchmove 时频繁触发事件函数。

现在问题出现在 onTouchMove 无法生效吗?从代码上看,它只是直接绑定到元素上了。