Skip to content

Commit

Permalink
control hide list on initial render with a prop
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Apr 3, 2024
1 parent dc672dc commit 4ea37b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function BaseSelectionList<TItem extends ListItem>(
isRowMultilineSupported = false,
textInputRef,
headerMessageStyle,
shouldHideListOnInitialRender = true,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -572,7 +573,7 @@ function BaseSelectionList<TItem extends ListItem>(
viewabilityConfig={{viewAreaCoveragePercentThreshold: 95}}
testID="selection-list"
onLayout={onSectionListLayout}
style={(!maxToRenderPerBatch || isInitialSectionListRender) && styles.opacity0}
style={(!maxToRenderPerBatch || (shouldHideListOnInitialRender && isInitialSectionListRender)) && styles.opacity0}
ListFooterComponent={ShowMoreButtonInstance}
/>
{children}
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 @@ -297,6 +297,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Ref for textInput */
textInputRef?: MutableRefObject<TextInput | null>;

/** Whether to hide the list on initial render */
shouldHideListOnInitialRender?: boolean,
};

type SelectionListHandle = {
Expand Down
1 change: 1 addition & 0 deletions src/pages/NewChatConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function NewChatConfirmPage({newGroupDraft, allPersonalDetails}: NewChatConfirmP
showConfirmButton={selectedOptions.length > 1}
confirmButtonText={translate('newChatPage.startGroup')}
onConfirm={createGroup}
shouldHideListOnInitialRender={false}
/>
</ScreenWrapper>
);
Expand Down

0 comments on commit 4ea37b6

Please sign in to comment.