MM-13151 Increase double tap delay for post action buttons (#2406)

* Use app state to disable a button when click to prevent double tap

* remove disable button state after 4000ms

* modify preventDoubleTap to have optional delayTime param

* remove local state use for button control

* remove unused method

* remove app state method to disable a button

* Update tap.js
This commit is contained in:
Orjiewuru Kingdom Isaac 2019-04-02 15:22:31 +01:00 committed by Harrison Healey
parent 77fe06794f
commit 102eeb93fe
2 changed files with 2 additions and 4 deletions

View file

@ -23,7 +23,7 @@ export default class ActionButton extends PureComponent {
handleActionPress = preventDoubleTap(() => {
const {actions, id, postId} = this.props;
actions.doPostAction(postId, id);
});
}, 4000);
render() {
const {name, theme} = this.props;

View file

@ -1,9 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
const doublePressDelay = 300;
export function preventDoubleTap(func) {
export function preventDoubleTap(func, doublePressDelay = 300) {
let canPressWrapped = true;
return (...args) => {