,
isMenuDisabled?: boolean,
shouldDisableOnLink?: boolean,
+ shouldDisableOnLongTap?: boolean,
) => {
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
const [contextMenuPosition, setContextMenuPosition] = useState(undefined);
@@ -67,7 +68,7 @@ export default (
// Support context menu on touch-devices
useEffect(() => {
- if (isMenuDisabled || !IS_TOUCH_ENV) {
+ if (isMenuDisabled || !IS_TOUCH_ENV || shouldDisableOnLongTap) {
return undefined;
}
@@ -129,7 +130,7 @@ export default (
element.removeEventListener('touchend', clearLongPressTimer, true);
element.removeEventListener('touchmove', clearLongPressTimer);
};
- }, [contextMenuPosition, isMenuDisabled, elementRef]);
+ }, [contextMenuPosition, isMenuDisabled, shouldDisableOnLongTap, elementRef]);
return {
isContextMenuOpen,
diff --git a/src/util/windowSize.ts b/src/util/windowSize.ts
index d8083886..ff07d97a 100644
--- a/src/util/windowSize.ts
+++ b/src/util/windowSize.ts
@@ -13,6 +13,7 @@ type IDimensions = {
const IS_LANDSCAPE = IS_SINGLE_COLUMN_LAYOUT && isLandscape();
+const initialHeight = window.innerHeight;
let windowSize = updateSizes();
let isRefreshDisabled = false;
@@ -69,6 +70,7 @@ function isLandscape() {
export default {
get: () => windowSize,
+ getIsKeyboardVisible: () => initialHeight > windowSize.height,
disableRefresh,
enableRefresh,
};