FIX: ensures swipe works with scroll (#23508)

- do not prevent the event (it was a violation anyways as the touchstart is passive)
- waits for at least 25px horizontal move before showing the remove action, it avoids showing the remove while scrolling and moving a little bit horizontally
This commit is contained in:
Joffrey JAFFEUX 2023-09-11 15:39:54 +02:00 committed by GitHub
parent b8d5f951f6
commit 898c75a05c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,8 +166,6 @@ export default class ChatChannelRow extends Component {
@bind
onSwipe(event) {
event.preventDefault();
const touchX = event.changedTouches[0].screenX;
const diff = this.initialX - touchX;
@ -193,8 +191,10 @@ export default class ChatChannelRow extends Component {
this.isCancelling = !this._towardsThreshold;
}
this.actionButton.style.width = diff + "px";
this.swipableRow.style.left = -(this.initialX - touchX) + "px";
if (diff > 25) {
this.actionButton.style.width = diff + "px";
this.swipableRow.style.left = -(this.initialX - touchX) + "px";
}
}
@bind