11import { useState } from 'react' ;
2- import type { MutableRefObject } from 'react' ;
2+ import type { RefObject } from 'react' ;
33import type { NativeScrollEvent , NativeSyntheticEvent } from 'react-native' ;
44import { readNewestAction } from '@userActions/Report' ;
55import CONST from '@src/CONST' ;
@@ -9,10 +9,10 @@ type Args = {
99 reportID : string ;
1010
1111 /** The current offset of scrolling from either top or bottom of chat list */
12- currentVerticalScrollingOffsetRef : MutableRefObject < number > ;
12+ currentVerticalScrollingOffsetRef : RefObject < number > ;
1313
1414 /** Ref for whether read action was skipped */
15- readActionSkippedRef : MutableRefObject < boolean > ;
15+ readActionSkippedRef : RefObject < boolean > ;
1616
1717 /** The initial value for visibility of floating message button */
1818 floatingMessageVisibleInitialValue : boolean ;
@@ -39,8 +39,10 @@ export default function useReportUnreadMessageScrollTracking({
3939 * Show/hide the new floating message counter when user is scrolling back/forth in the history of messages.
4040 * Call any other callback that the component might need
4141 */
42- const trackVerticalScrolling = ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
43- onTrackScrolling ( event ) ;
42+ const trackVerticalScrolling = ( event : NativeSyntheticEvent < NativeScrollEvent > | undefined ) => {
43+ if ( event ) {
44+ onTrackScrolling ( event ) ;
45+ }
4446
4547 // display floating button if we're scrolled more than the offset
4648 if ( currentVerticalScrollingOffsetRef . current > CONST . REPORT . ACTIONS . SCROLL_VERTICAL_OFFSET_THRESHOLD && ! isFloatingMessageCounterVisible && hasUnreadMarkerReportAction ) {
0 commit comments