From 54bf24b65abd32d37bef878e0ce592e102e84420 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 2 Sep 2025 12:05:52 +0200 Subject: [PATCH 1/9] fix: ActionSheetAwareScrollView not compatible with FlatList.maintainVisibleContentPosition --- .../ActionSheetAwareScrollView/index.ios.tsx | 28 +++++++++------ ...e.tsx => useActionSheetKeyboardSpacing.ts} | 36 +++++-------------- 2 files changed, 26 insertions(+), 38 deletions(-) rename src/components/ActionSheetAwareScrollView/{ActionSheetKeyboardSpace.tsx => useActionSheetKeyboardSpacing.ts} (90%) diff --git a/src/components/ActionSheetAwareScrollView/index.ios.tsx b/src/components/ActionSheetAwareScrollView/index.ios.tsx index 9c465b966daf..2d8b6d1a183c 100644 --- a/src/components/ActionSheetAwareScrollView/index.ios.tsx +++ b/src/components/ActionSheetAwareScrollView/index.ios.tsx @@ -2,13 +2,12 @@ import type {PropsWithChildren} from 'react'; import React, {forwardRef, useCallback} from 'react'; // eslint-disable-next-line no-restricted-imports import type {ScrollView, ScrollViewProps} from 'react-native'; -import Reanimated, {useAnimatedRef, useScrollViewOffset} from 'react-native-reanimated'; +import Reanimated, {useAnimatedRef, useAnimatedStyle} from 'react-native-reanimated'; import {Actions, ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewProvider} from './ActionSheetAwareScrollViewContext'; -import ActionSheetKeyboardSpace from './ActionSheetKeyboardSpace'; +import useActionSheetKeyboardSpacing from './useActionSheetKeyboardSpacing'; -const ActionSheetAwareScrollView = forwardRef>((props, ref) => { +const ActionSheetAwareScrollView = forwardRef>(({children, contentContainerStyle, ...props}, ref) => { const scrollViewAnimatedRef = useAnimatedRef(); - const position = useScrollViewOffset(scrollViewAnimatedRef); const onRef = useCallback( (assignedRef: Reanimated.ScrollView) => { @@ -24,14 +23,21 @@ const ActionSheetAwareScrollView = forwardRef ({ + paddingBottom: spacing.get(), + })); + return ( - - {props.children} - + + + {children} + + ); }); diff --git a/src/components/ActionSheetAwareScrollView/ActionSheetKeyboardSpace.tsx b/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts similarity index 90% rename from src/components/ActionSheetAwareScrollView/ActionSheetKeyboardSpace.tsx rename to src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts index cf96a0823b0f..fd8c2074cc99 100644 --- a/src/components/ActionSheetAwareScrollView/ActionSheetKeyboardSpace.tsx +++ b/src/components/ActionSheetAwareScrollView/useActionSheetKeyboardSpacing.ts @@ -1,10 +1,9 @@ -import React, {useContext, useEffect} from 'react'; -import type {ViewProps} from 'react-native'; +import {useContext, useEffect} from 'react'; import {useKeyboardHandler} from 'react-native-keyboard-controller'; -import Reanimated, {useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withSequence, withSpring, withTiming} from 'react-native-reanimated'; -import type {SharedValue} from 'react-native-reanimated'; +import type Reanimated from 'react-native-reanimated'; +import {useAnimatedReaction, useDerivedValue, useScrollViewOffset, useSharedValue, withSequence, withSpring, withTiming} from 'react-native-reanimated'; +import type {AnimatedRef} from 'react-native-reanimated'; import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings'; -import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {Actions, ActionSheetAwareScrollViewContext, States} from './ActionSheetAwareScrollViewContext'; @@ -60,18 +59,13 @@ const useAnimatedKeyboard = () => { return {state, height, heightWhenOpened}; }; -type ActionSheetKeyboardSpaceProps = ViewProps & { - /** scroll offset of the parent ScrollView */ - position?: SharedValue; -}; +function useActionSheetKeyboardSpacing(scrollViewAnimatedRef: AnimatedRef) { + const position = useScrollViewOffset(scrollViewAnimatedRef); -function ActionSheetKeyboardSpace(props: ActionSheetKeyboardSpaceProps) { - const styles = useThemeStyles(); const { unmodifiedPaddings: {top: paddingTop = 0, bottom: paddingBottom = 0}, } = useSafeAreaPaddings(); const keyboard = useAnimatedKeyboard(); - const {position} = props; // Similar to using `global` in worklet but it's just a local object const syncLocalWorkletState = useSharedValue(KeyboardState.UNKNOWN); @@ -102,7 +96,7 @@ function ActionSheetKeyboardSpace(props: ActionSheetKeyboardSpaceProps) { [], ); - const translateY = useDerivedValue(() => { + const spacing = useDerivedValue(() => { const {current, previous} = currentActionSheetState.get(); // We don't need to run any additional logic. it will always return 0 for idle state @@ -249,19 +243,7 @@ function ActionSheetKeyboardSpace(props: ActionSheetKeyboardSpaceProps) { } }, []); - const animatedStyle = useAnimatedStyle(() => ({ - paddingTop: translateY.get(), - })); - - return ( - - ); + return spacing; } -ActionSheetKeyboardSpace.displayName = 'ActionSheetKeyboardSpace'; - -export default ActionSheetKeyboardSpace; +export default useActionSheetKeyboardSpacing; From f5a2f48b6d1a436ae0dcca3342fec19beaf8a377 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Tue, 2 Sep 2025 16:49:57 +0200 Subject: [PATCH 2/9] fix: add containerStyle prop to renderScrollComponent --- .../ActionSheetAwareScrollView/index.ios.tsx | 12 ++++++------ .../ActionSheetAwareScrollView/index.tsx | 7 +++---- src/components/ActionSheetAwareScrollView/types.ts | 9 +++++++++ src/pages/home/report/ReportActionsList.tsx | 14 +++++++++++--- 4 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 src/components/ActionSheetAwareScrollView/types.ts diff --git a/src/components/ActionSheetAwareScrollView/index.ios.tsx b/src/components/ActionSheetAwareScrollView/index.ios.tsx index facfa34aafde..2cccc0662923 100644 --- a/src/components/ActionSheetAwareScrollView/index.ios.tsx +++ b/src/components/ActionSheetAwareScrollView/index.ios.tsx @@ -1,12 +1,12 @@ -import type {PropsWithChildren} from 'react'; import React, {forwardRef, useCallback} from 'react'; // eslint-disable-next-line no-restricted-imports -import type {ScrollView, ScrollViewProps} from 'react-native'; +import type {ScrollView} from 'react-native'; import Reanimated, {useAnimatedRef, useAnimatedStyle} from 'react-native-reanimated'; import {Actions, ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewProvider} from './ActionSheetAwareScrollViewContext'; +import type {ActionSheetAwareScrollViewProps, RenderActionSheetAwareScrollViewComponent} from './types'; import useActionSheetKeyboardSpacing from './useActionSheetKeyboardSpacing'; -const ActionSheetAwareScrollView = forwardRef>(({children, style, contentContainerStyle, ...props}, ref) => { +const ActionSheetAwareScrollView = forwardRef(({children, containerStyle, ...props}, ref) => { const scrollViewAnimatedRef = useAnimatedRef(); const onRef = useCallback( @@ -29,7 +29,7 @@ const ActionSheetAwareScrollView = forwardRef + { // eslint-disable-next-line react/jsx-props-no-spreading return ; -} +}; export {renderScrollComponent, ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewProvider, Actions}; diff --git a/src/components/ActionSheetAwareScrollView/index.tsx b/src/components/ActionSheetAwareScrollView/index.tsx index d22f991ce4cf..f2fc64cda8bd 100644 --- a/src/components/ActionSheetAwareScrollView/index.tsx +++ b/src/components/ActionSheetAwareScrollView/index.tsx @@ -1,13 +1,12 @@ // this whole file is just for other platforms // iOS version has everything implemented -import type {PropsWithChildren} from 'react'; import React, {forwardRef} from 'react'; -import type {ScrollViewProps} from 'react-native'; // eslint-disable-next-line no-restricted-imports import {ScrollView} from 'react-native'; import {Actions, ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewProvider} from './ActionSheetAwareScrollViewContext'; +import type {ActionSheetAwareScrollViewProps, RenderActionSheetAwareScrollViewComponent} from './types'; -const ActionSheetAwareScrollView = forwardRef>((props, ref) => ( +const ActionSheetAwareScrollView = forwardRef((props, ref) => ( & { + containerStyle?: StyleProp; +}; + +type RenderActionSheetAwareScrollViewComponent = ((props: ActionSheetAwareScrollViewProps) => React.ReactElement) | undefined; +export type {ActionSheetAwareScrollViewProps, RenderActionSheetAwareScrollViewComponent}; diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 935a179008a8..60d27111622f 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -1,10 +1,10 @@ import type {ListRenderItemInfo} from '@react-native/virtualized-lists/Lists/VirtualizedList'; import {useIsFocused, useRoute} from '@react-navigation/native'; import React, {memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'; -import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle} from 'react-native'; +import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; import {DeviceEventEmitter, InteractionManager, View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; -import {renderScrollComponent} from '@components/ActionSheetAwareScrollView'; +import {renderScrollComponent as renderActionSheetAwareScrollView} from '@components/ActionSheetAwareScrollView'; import FlatList from '@components/FlatList'; import InvertedFlatList from '@components/InvertedFlatList'; import {AUTOSCROLL_TO_TOP_THRESHOLD} from '@components/InvertedFlatList/BaseInvertedFlatList'; @@ -812,6 +812,15 @@ function ReportActionsList({ return baseStyles; }, [parentReportAction, styles.chatContentScrollView, styles.pb0, styles.pt4]); + const renderScrollComponent = useMemo(() => { + if (renderActionSheetAwareScrollView === undefined) { + return undefined; + } + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return ({...props}: ScrollViewProps) => renderActionSheetAwareScrollView!({...props, containerStyle: contentContainerStyle}); + }, [contentContainerStyle]); + return ( <> Date: Mon, 8 Sep 2025 15:27:46 +0200 Subject: [PATCH 3/9] fix: invalid imports --- src/pages/home/report/ReportActionsList.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 0de3d2fda131..5d861dda7d3a 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -5,8 +5,6 @@ import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, Scroll import { DeviceEventEmitter, InteractionManager, View } from 'react-native'; import type { OnyxEntry } from 'react-native-onyx'; import { renderScrollComponent as renderActionSheetAwareScrollView } from '@components/ActionSheetAwareScrollView'; -import FlatList from '@components/FlatList'; -import { renderScrollComponent } from '@components/ActionSheetAwareScrollView'; import InvertedFlatList from '@components/InvertedFlatList'; import { PersonalDetailsContext, usePersonalDetails } from '@components/OnyxListItemProvider'; import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView'; @@ -64,6 +62,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; +import { AUTOSCROLL_TO_TOP_THRESHOLD } from '@components/InvertedFlatList/BaseInvertedFlatList'; import FloatingMessageCounter from './FloatingMessageCounter'; import getInitialNumToRender from './getInitialNumReportActionsToRender'; import ListBoundaryLoader from './ListBoundaryLoader'; @@ -768,9 +767,6 @@ function ReportActionsList({ loadOlderChats(false); }, [loadOlderChats]); - // FlatList is used for transaction threads to keep the list scrolled at the top and display actions in chronological order. - // InvertedFlatList is used for regular reports, always scrolling to the bottom initially and showing the newest messages at the bottom. - const ListComponent = isTransactionThread(parentReportAction) ? FlatList : InvertedFlatList; const contentContainerStyle = useMemo(() => { const baseStyles: StyleProp = [styles.chatContentScrollView]; From e582f51804e0cb1202d2c0e7e716c54c11d44733 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 11 Sep 2025 08:53:36 +0200 Subject: [PATCH 4/9] chore: prettier --- src/pages/home/report/ReportActionsList.tsx | 75 ++++++++++----------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 687c6c3aed8b..44067c95b640 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -1,15 +1,15 @@ -import type { ListRenderItemInfo } from '@react-native/virtualized-lists/Lists/VirtualizedList'; -import { useIsFocused, useRoute } from '@react-navigation/native'; -import React, { memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; -import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollViewProps, StyleProp, ViewStyle } from 'react-native'; -import { DeviceEventEmitter, InteractionManager, View } from 'react-native'; -import type { OnyxEntry } from 'react-native-onyx'; -import { renderScrollComponent as renderActionSheetAwareScrollView } from '@components/ActionSheetAwareScrollView'; +import type {ListRenderItemInfo} from '@react-native/virtualized-lists/Lists/VirtualizedList'; +import {useIsFocused, useRoute} from '@react-navigation/native'; +import React, {memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'; +import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; +import {DeviceEventEmitter, InteractionManager, View} from 'react-native'; +import type {OnyxEntry} from 'react-native-onyx'; +import {renderScrollComponent as renderActionSheetAwareScrollView} from '@components/ActionSheetAwareScrollView'; import InvertedFlatList from '@components/InvertedFlatList'; -import { PersonalDetailsContext, usePersonalDetails } from '@components/OnyxListItemProvider'; +import {PersonalDetailsContext, usePersonalDetails} from '@components/OnyxListItemProvider'; import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; -import { AUTOSCROLL_TO_TOP_THRESHOLD } from '@hooks/useFlatListScrollKey'; +import {AUTOSCROLL_TO_TOP_THRESHOLD} from '@hooks/useFlatListScrollKey'; import useLocalize from '@hooks/useLocalize'; import useNetworkWithOfflineStatus from '@hooks/useNetworkWithOfflineStatus'; import useOnyx from '@hooks/useOnyx'; @@ -19,14 +19,14 @@ import useReportScrollManager from '@hooks/useReportScrollManager'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import { isSafari } from '@libs/Browser'; +import {isSafari} from '@libs/Browser'; import DateUtils from '@libs/DateUtils'; import FS from '@libs/Fullstory'; import durationHighlightItem from '@libs/Navigation/helpers/getDurationHighlightItem'; import isReportTopmostSplitNavigator from '@libs/Navigation/helpers/isReportTopmostSplitNavigator'; import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; -import type { PlatformStackRouteProp } from '@libs/Navigation/PlatformStackNavigation/types'; +import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import { getFirstVisibleReportActionID, getOriginalMessage, @@ -55,15 +55,14 @@ import { isUnread, } from '@libs/ReportUtils'; import Visibility from '@libs/Visibility'; -import type { ReportsSplitNavigatorParamList } from '@navigation/types'; +import type {ReportsSplitNavigatorParamList} from '@navigation/types'; import variables from '@styles/variables'; -import { getCurrentUserAccountID, openReport, readNewestAction, subscribeToNewActionEvent } from '@userActions/Report'; +import {getCurrentUserAccountID, openReport, readNewestAction, subscribeToNewActionEvent} from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; -import { AUTOSCROLL_TO_TOP_THRESHOLD } from '@components/InvertedFlatList/BaseInvertedFlatList'; import FloatingMessageCounter from './FloatingMessageCounter'; import getInitialNumToRender from './getInitialNumReportActionsToRender'; import ListBoundaryLoader from './ListBoundaryLoader'; @@ -134,7 +133,7 @@ function keyExtractor(item: OnyxTypes.ReportAction): string { return item.reportActionID; } -const onScrollToIndexFailed = () => { }; +const onScrollToIndexFailed = () => {}; function ReportActionsList({ report, @@ -155,12 +154,12 @@ function ReportActionsList({ const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const personalDetailsList = usePersonalDetails(); const styles = useThemeStyles(); - const { translate } = useLocalize(); - const { windowHeight } = useWindowDimensions(); - const { shouldUseNarrowLayout } = useResponsiveLayout(); + const {translate} = useLocalize(); + const {windowHeight} = useWindowDimensions(); + const {shouldUseNarrowLayout} = useResponsiveLayout(); - const { preferredLocale } = useLocalize(); - const { isOffline, lastOfflineAt, lastOnlineAt } = useNetworkWithOfflineStatus(); + const {preferredLocale} = useLocalize(); + const {isOffline, lastOfflineAt, lastOnlineAt} = useNetworkWithOfflineStatus(); const route = useRoute>(); const reportScrollManager = useReportScrollManager(); const userActiveSince = useRef(DateUtils.getDBTime()); @@ -168,18 +167,18 @@ function ReportActionsList({ const [isVisible, setIsVisible] = useState(Visibility.isVisible); const isFocused = useIsFocused(); - const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, { canBeMissing: false }); - const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, { canBeMissing: true }); - const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, { canBeMissing: true }); - const [accountID] = useOnyx(ONYXKEYS.SESSION, { selector: (session) => session?.accountID, canBeMissing: true }); + const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false}); + const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); + const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: true}); + const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID, canBeMissing: true}); const participantsContext = useContext(PersonalDetailsContext); const isReportArchived = useReportIsArchived(report?.reportID); - const [userWalletTierName] = useOnyx(ONYXKEYS.USER_WALLET, { selector: (wallet) => wallet?.tierName, canBeMissing: false }); - const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, { selector: (account) => account?.validated, canBeMissing: true }); - const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}`, { canBeMissing: true }); - const [emojiReactions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}`, { canBeMissing: true }); - const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID, { canBeMissing: true }); - const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, { canBeMissing: false }); + const [userWalletTierName] = useOnyx(ONYXKEYS.USER_WALLET, {selector: (wallet) => wallet?.tierName, canBeMissing: false}); + const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated, canBeMissing: true}); + const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}`, {canBeMissing: true}); + const [emojiReactions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}`, {canBeMissing: true}); + const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID, {canBeMissing: true}); + const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: false}); const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed; const [isScrollToBottomEnabled, setIsScrollToBottomEnabled] = useState(false); const [shouldScrollToEndAfterLayout, setShouldScrollToEndAfterLayout] = useState(false); @@ -202,7 +201,7 @@ function ReportActionsList({ const sortedVisibleReportActionsObjects: OnyxTypes.ReportActions = useMemo( () => sortedVisibleReportActions.reduce((actions, action) => { - Object.assign(actions, { [action.reportActionID]: action }); + Object.assign(actions, {[action.reportActionID]: action}); return actions; }, {}), [sortedVisibleReportActions], @@ -332,7 +331,7 @@ function ReportActionsList({ // Display the new message indicator when comment linking and not close to the newest message. const reportActionID = route?.params?.reportActionID; - const { isFloatingMessageCounterVisible, setIsFloatingMessageCounterVisible, trackVerticalScrolling, onViewableItemsChanged } = useReportUnreadMessageScrollTracking({ + const {isFloatingMessageCounterVisible, setIsFloatingMessageCounterVisible, trackVerticalScrolling, onViewableItemsChanged} = useReportUnreadMessageScrollTracking({ reportID: report.reportID, currentVerticalScrollingOffsetRef: scrollingVerticalOffset, readActionSkippedRef: readActionSkipped, @@ -376,7 +375,7 @@ function ReportActionsList({ if ((isVisible || isFromNotification) && scrollingVerticalOffset.current < CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD) { readNewestAction(report.reportID); if (isFromNotification) { - Navigation.setParams({ referrer: undefined }); + Navigation.setParams({referrer: undefined}); } } else { readActionSkipped.current = true; @@ -525,9 +524,9 @@ function ReportActionsList({ if (!hasNewestReportAction) { if (isSearchTopmostFullScreenRoute()) { if (Navigation.getReportRHPActiveRoute()) { - Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({ reportID: report.reportID })); + Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: report.reportID})); } else { - Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({ reportID: report.reportID })); + Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: report.reportID})); } } else { Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)); @@ -625,7 +624,7 @@ function ReportActionsList({ }, [isFocused, isVisible]); const renderItem = useCallback( - ({ item: reportAction, index }: ListRenderItemInfo) => { + ({item: reportAction, index}: ListRenderItemInfo) => { const originalReportID = getOriginalReportID(report.reportID, reportAction); const reportDraftMessages = draftMessage?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`]; const matchingDraftMessage = reportDraftMessages?.[reportAction.reportActionID]; @@ -787,7 +786,7 @@ function ReportActionsList({ } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return ({ ...props }: ScrollViewProps) => renderActionSheetAwareScrollView!({ ...props, containerStyle: contentContainerStyle }); + return ({...props}: ScrollViewProps) => renderActionSheetAwareScrollView!({...props, containerStyle: contentContainerStyle}); }, [contentContainerStyle]); return ( @@ -839,4 +838,4 @@ ReportActionsList.displayName = 'ReportActionsList'; export default memo(ReportActionsList); -export type { ReportActionsListProps }; +export type {ReportActionsListProps}; From cf61c39a996f71d26bcaff3d3e6aa1fb015b926c Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 11 Sep 2025 08:54:07 +0200 Subject: [PATCH 5/9] fix: naming of ActionSheetKeyboardSpacing state --- .../ActionSheetAwareScrollViewContext.tsx | 6 +++--- .../useActionSheetKeyboardSpacing.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ActionSheetAwareScrollView/ActionSheetAwareScrollViewContext.tsx b/src/components/ActionSheetAwareScrollView/ActionSheetAwareScrollViewContext.tsx index cd5b20bbf10e..56419ea39af0 100644 --- a/src/components/ActionSheetAwareScrollView/ActionSheetAwareScrollViewContext.tsx +++ b/src/components/ActionSheetAwareScrollView/ActionSheetAwareScrollViewContext.tsx @@ -67,7 +67,7 @@ const States = { POPOVER_CLOSED: 'popoverClosed', KEYBOARD_POPOVER_CLOSED: 'keyboardPopoverClosed', KEYBOARD_POPOVER_OPEN: 'keyboardPopoverOpen', - KEYBOARD_CLOSED_POPOVER: 'keyboardClosingPopover', + KEYBOARD_CLOSING_POPOVER: 'keyboardClosingPopover', POPOVER_MEASURED: 'popoverMeasured', MODAL_WITH_KEYBOARD_OPEN_DELETED: 'modalWithKeyboardOpenDeleted', } as const; @@ -97,13 +97,13 @@ const STATE_MACHINE: StateMachine, ValueOf Date: Thu, 11 Sep 2025 09:02:34 +0200 Subject: [PATCH 6/9] fix: remove prop spreading operator --- src/pages/home/report/ReportActionsList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 44067c95b640..eef267c138e6 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -786,7 +786,7 @@ function ReportActionsList({ } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return ({...props}: ScrollViewProps) => renderActionSheetAwareScrollView!({...props, containerStyle: contentContainerStyle}); + return (props: ScrollViewProps) => renderActionSheetAwareScrollView!({...props, containerStyle: contentContainerStyle}); }, [contentContainerStyle]); return ( From 914d4f960f0a748fcd061c9d7fcc6ff4ebf8e81c Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Thu, 11 Sep 2025 11:26:31 +0200 Subject: [PATCH 7/9] fix: animate ScrollView instead of wrapper view --- .../ActionSheetAwareScrollView/index.ios.tsx | 21 +++++++++---------- .../ActionSheetAwareScrollView/types.ts | 7 ++----- src/pages/home/report/ReportActionsList.tsx | 12 ++--------- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/components/ActionSheetAwareScrollView/index.ios.tsx b/src/components/ActionSheetAwareScrollView/index.ios.tsx index 2cccc0662923..6fead4946aea 100644 --- a/src/components/ActionSheetAwareScrollView/index.ios.tsx +++ b/src/components/ActionSheetAwareScrollView/index.ios.tsx @@ -6,7 +6,7 @@ import {Actions, ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewPr import type {ActionSheetAwareScrollViewProps, RenderActionSheetAwareScrollViewComponent} from './types'; import useActionSheetKeyboardSpacing from './useActionSheetKeyboardSpacing'; -const ActionSheetAwareScrollView = forwardRef(({children, containerStyle, ...props}, ref) => { +const ActionSheetAwareScrollView = forwardRef(({style, children, ...props}, ref) => { const scrollViewAnimatedRef = useAnimatedRef(); const onRef = useCallback( @@ -25,19 +25,18 @@ const ActionSheetAwareScrollView = forwardRef ({ - paddingBottom: spacing.get(), + paddingTop: spacing.get(), })); return ( - - - {children} - - + + {children} + ); }); diff --git a/src/components/ActionSheetAwareScrollView/types.ts b/src/components/ActionSheetAwareScrollView/types.ts index f90c86dd0ddd..9d7f7f765fef 100644 --- a/src/components/ActionSheetAwareScrollView/types.ts +++ b/src/components/ActionSheetAwareScrollView/types.ts @@ -1,9 +1,6 @@ import type {PropsWithChildren} from 'react'; -import type {ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; - -type ActionSheetAwareScrollViewProps = PropsWithChildren & { - containerStyle?: StyleProp; -}; +import type {ScrollViewProps} from 'react-native'; +type ActionSheetAwareScrollViewProps = PropsWithChildren; type RenderActionSheetAwareScrollViewComponent = ((props: ActionSheetAwareScrollViewProps) => React.ReactElement) | undefined; export type {ActionSheetAwareScrollViewProps, RenderActionSheetAwareScrollViewComponent}; diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index eef267c138e6..45df3e13194f 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -780,15 +780,6 @@ function ReportActionsList({ return baseStyles; }, [parentReportAction, styles.chatContentScrollView, styles.pb0, styles.pt4]); - const renderScrollComponent = useMemo(() => { - if (renderActionSheetAwareScrollView === undefined) { - return undefined; - } - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return (props: ScrollViewProps) => renderActionSheetAwareScrollView!({...props, containerStyle: contentContainerStyle}); - }, [contentContainerStyle]); - return ( <> Date: Thu, 11 Sep 2025 12:11:46 +0200 Subject: [PATCH 8/9] refactor: remove legacy contentContainerStyle code --- src/pages/home/report/ReportActionsList.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 45df3e13194f..840757e50b81 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -767,19 +767,6 @@ function ReportActionsList({ loadOlderChats(false); }, [loadOlderChats]); - const contentContainerStyle = useMemo(() => { - const baseStyles: StyleProp = [styles.chatContentScrollView]; - - if (isTransactionThread(parentReportAction)) { - // InvertedFlatList applies a scale: -1 transform, so top padding becomes bottom padding and vice versa. - // When using FlatList for transaction threads, we need to manually add top padding (pt4) and remove bottom padding (pb0) - // to maintain consistent spacing and visual appearance at the top of the list. - baseStyles.push(styles.pb0, styles.pt4); - } - - return baseStyles; - }, [parentReportAction, styles.chatContentScrollView, styles.pb0, styles.pt4]); - return ( <> Date: Thu, 11 Sep 2025 12:16:29 +0200 Subject: [PATCH 9/9] fix: remove unused imports --- src/pages/home/report/ReportActionsList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 840757e50b81..853fcefb7471 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -1,7 +1,7 @@ import type {ListRenderItemInfo} from '@react-native/virtualized-lists/Lists/VirtualizedList'; import {useIsFocused, useRoute} from '@react-navigation/native'; import React, {memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'; -import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollViewProps, StyleProp, ViewStyle} from 'react-native'; +import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent} from 'react-native'; import {DeviceEventEmitter, InteractionManager, View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {renderScrollComponent as renderActionSheetAwareScrollView} from '@components/ActionSheetAwareScrollView';