* RN-74 Added updated markdown code block view * Set default channelIsLoading prop to PostList * RN-74 Fixed uneven line numbers on Android * RN-74 Prevented double tapping on markdown code blocks
31 lines
755 B
JavaScript
31 lines
755 B
JavaScript
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
const doublePressDelay = 300;
|
|
|
|
let canPress = true;
|
|
export function preventDoubleTap(action, thisArg, ...args) {
|
|
if (canPress) {
|
|
canPress = false;
|
|
Reflect.apply(action, thisArg || null, [...args]);
|
|
|
|
setTimeout(() => {
|
|
canPress = true;
|
|
}, doublePressDelay);
|
|
}
|
|
}
|
|
|
|
export function wrapWithPreventDoubleTap(func) {
|
|
let canPressWrapped = true;
|
|
|
|
return (...args) => {
|
|
if (canPressWrapped) {
|
|
canPressWrapped = false;
|
|
func(...args);
|
|
|
|
setTimeout(() => {
|
|
canPressWrapped = true;
|
|
}, doublePressDelay);
|
|
}
|
|
};
|
|
}
|