Skip to content

Commit

Permalink
Merge pull request #55027 from callstack-internal/zirgulis/increase-s…
Browse files Browse the repository at this point in the history
…earch-screen-render-time

render 5 initial items in search screen on mobile
  • Loading branch information
marcochavezf authored Jan 10, 2025
2 parents 6529181 + 0026700 commit 8abec8e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo
scrollEventThrottle={1}
shouldKeepFocusedItemAtTopOfViewableArea={type === CONST.SEARCH.DATA_TYPES.CHAT}
isScreenFocused={isSearchScreenFocused}
initialNumToRender={shouldUseNarrowLayout ? 5 : undefined}
/>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldScrollToFocusedIndex = true,
onContentSizeChange,
listItemTitleStyles,
initialNumToRender = 12,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -831,7 +832,7 @@ function BaseSelectionList<TItem extends ListItem>(
indicatorStyle="white"
keyboardShouldPersistTaps="always"
showsVerticalScrollIndicator={showScrollIndicator}
initialNumToRender={12}
initialNumToRender={initialNumToRender}
maxToRenderPerBatch={maxToRenderPerBatch}
windowSize={windowSize}
updateCellsBatchingPeriod={updateCellsBatchingPeriod}
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 @@ -633,6 +633,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Called when scrollable content view of the ScrollView changes */
onContentSizeChange?: (w: number, h: number) => void;

/** Initial number of items to render */
initialNumToRender?: number;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down

0 comments on commit 8abec8e

Please sign in to comment.