Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function BaseSelectionList<TItem extends ListItem>({
shouldStopPropagation = false,
shouldHeaderBeInsideList = false,
shouldScrollToFocusedIndex = true,
shouldScrollToFocusedIndexOnMount = true,
shouldDebounceScrolling = false,
shouldUpdateFocusedIndex = false,
shouldSingleExecuteRowSelect = false,
Expand Down Expand Up @@ -526,7 +527,7 @@ function BaseSelectionList<TItem extends ListItem>({
onEndReachedThreshold={onEndReachedThreshold}
style={style?.listStyle}
contentContainerStyle={styles.pb3}
initialScrollIndex={initialFocusedIndex}
initialScrollIndex={shouldScrollToFocusedIndexOnMount ? initialFocusedIndex : undefined}
onScrollBeginDrag={onScrollBeginDrag}
maintainVisibleContentPosition={{disabled: disableMaintainingScrollPosition}}
ListHeaderComponent={
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ type BaseSelectionListProps<TItem extends ListItem> = {
/** Whether to scroll to the focused item */
shouldScrollToFocusedIndex?: boolean;

/** Whether to scroll to the focused item on mount. When false, the list stays at the top to keep header content visible */
Comment thread
jasperhuangg marked this conversation as resolved.
shouldScrollToFocusedIndexOnMount?: boolean;

/** Whether keyboard shortcuts should be disabled */
disableKeyboardShortcuts?: boolean;

Expand Down
21 changes: 10 additions & 11 deletions src/pages/iou/request/step/IOURequestEditReportCommon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,18 @@ function IOURequestEditReportCommon({
}}
shouldSingleExecuteRowSelect
initiallyFocusedItemKey={selectedReportID}
shouldScrollToFocusedIndexOnMount={!createReportOption}
ListItem={InviteMemberListItem}
customListHeaderContent={createReportOption}
listFooterContent={
<>
{shouldShowRemoveFromReport && (
<MenuItem
onPress={removeFromReport}
title={translate('iou.removeFromReport')}
description={translate('iou.moveToPersonalSpace')}
icon={icons.Close}
/>
)}
{createReportOption}
</>
shouldShowRemoveFromReport ? (
<MenuItem
onPress={removeFromReport}
title={translate('iou.removeFromReport')}
description={translate('iou.moveToPersonalSpace')}
icon={icons.Close}
/>
) : undefined
}
listEmptyContent={createReportOption}
/>
Expand Down
Loading