@@ -714,6 +714,8 @@ export function MobileOptionsInternal({ options }: { options: OptionMenuProps })
714714 const [ modal , setModal ] = useAtom ( modalAtom ) ;
715715 const touchStartY = useRef < number | null > ( null ) ;
716716 const [ touchYDiff , setTouchYDiff ] = useState ( 0 ) ;
717+ const date = new Date ( ) ;
718+ const startTime = useRef ( 0 ) ;
717719
718720 useEffect ( ( ) => {
719721 if ( modal ?. type === ModalType . MobileOptions ) setIsActive ( true ) ;
@@ -722,6 +724,7 @@ export function MobileOptionsInternal({ options }: { options: OptionMenuProps })
722724
723725 const handleTouchStart = ( e : React . TouchEvent ) => {
724726 touchStartY . current = e . touches [ 0 ] ?. clientY ?? null ;
727+ startTime . current = date . getTime ( ) ;
725728 } ;
726729
727730 const handleTouchMove = ( e : React . TouchEvent ) => {
@@ -736,7 +739,8 @@ export function MobileOptionsInternal({ options }: { options: OptionMenuProps })
736739 } ;
737740
738741 const handleTouchEnd = ( ) => {
739- if ( touchYDiff > 100 ) {
742+ const endTime = date . getTime ( ) ;
743+ if ( touchYDiff > 100 || ( endTime - startTime . current < 600 && touchYDiff > 20 ) ) {
740744 options . closeMenu ( ) ;
741745 setIsActive ( false ) ;
742746 } else {
@@ -746,12 +750,7 @@ export function MobileOptionsInternal({ options }: { options: OptionMenuProps })
746750 } ;
747751
748752 const dragHandleJSX = (
749- < div
750- className = { css . MessageMobileDragHandle }
751- onTouchStart = { handleTouchStart }
752- onTouchMove = { handleTouchMove }
753- onTouchEnd = { handleTouchEnd }
754- >
753+ < div className = { css . MessageMobileDragHandle } >
755754 < div className = { css . MessageMobileDragIndicator } />
756755 </ div >
757756 ) ;
@@ -765,9 +764,9 @@ export function MobileOptionsInternal({ options }: { options: OptionMenuProps })
765764 options . closeMenu ( ) ;
766765 setIsActive ( false ) ;
767766 } }
768- onTouchStart = { ( e : React . TouchEvent ) => e . stopPropagation ( ) }
769- onTouchMove = { ( e : React . TouchEvent ) => e . stopPropagation ( ) }
770- onTouchEnd = { ( e : React . TouchEvent ) => e . stopPropagation ( ) }
767+ onTouchStart = { handleTouchStart }
768+ onTouchMove = { handleTouchMove }
769+ onTouchEnd = { handleTouchEnd }
771770 >
772771 < Box
773772 className = { css . MessageMobileOptionsContainer }
0 commit comments