diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index e8e71606..83d5b9e6 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -210,6 +210,8 @@ export const RoomInput = forwardRef( selectedFiles.map((f) => f.file) ); const uploadBoardHandlers = useRef(); + const longPressTimer = useRef | null>(null); + const isLongPress = useRef(false); const imagePackRooms: Room[] = useImagePackRooms(roomId, roomToParents); @@ -943,8 +945,35 @@ export const RoomInput = forwardRef( /> { + if (isLongPress.current) { + isLongPress.current = false; + return; + } + submit(); + }} onMouseDown={(e: MouseEvent) => e.preventDefault()} + onPointerDown={() => { + isLongPress.current = false; + if (mobileOrTablet() && delayedEventsSupported) { + longPressTimer.current = setTimeout(() => { + isLongPress.current = true; + setShowSchedulePicker(true); + }, 1000); + } + }} + onPointerUp={() => { + if (longPressTimer.current !== null) { + clearTimeout(longPressTimer.current); + longPressTimer.current = null; + } + }} + onPointerCancel={() => { + if (longPressTimer.current !== null) { + clearTimeout(longPressTimer.current); + longPressTimer.current = null; + } + }} variant={scheduledTime ? 'Primary' : 'SurfaceVariant'} size="300" radii="0" @@ -952,7 +981,7 @@ export const RoomInput = forwardRef( > - {delayedEventsSupported && ( + {delayedEventsSupported && !mobileOrTablet() && ( ) => { setScheduleMenuAnchor(evt.currentTarget.getBoundingClientRect());