From 4ea37b6c8eb7eb7a2ee4a7678face11a69c0d535 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Apr 2024 20:01:06 +0800 Subject: [PATCH] control hide list on initial render with a prop --- src/components/SelectionList/BaseSelectionList.tsx | 3 ++- src/components/SelectionList/types.ts | 3 +++ src/pages/NewChatConfirmPage.tsx | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 67de6b2b7718..8dd7577de779 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -70,6 +70,7 @@ function BaseSelectionList( isRowMultilineSupported = false, textInputRef, headerMessageStyle, + shouldHideListOnInitialRender = true, }: BaseSelectionListProps, ref: ForwardedRef, ) { @@ -572,7 +573,7 @@ function BaseSelectionList( viewabilityConfig={{viewAreaCoveragePercentThreshold: 95}} testID="selection-list" onLayout={onSectionListLayout} - style={(!maxToRenderPerBatch || isInitialSectionListRender) && styles.opacity0} + style={(!maxToRenderPerBatch || (shouldHideListOnInitialRender && isInitialSectionListRender)) && styles.opacity0} ListFooterComponent={ShowMoreButtonInstance} /> {children} diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 9e7e64896f4f..926aeace4e40 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -297,6 +297,9 @@ type BaseSelectionListProps = Partial & { /** Ref for textInput */ textInputRef?: MutableRefObject; + + /** Whether to hide the list on initial render */ + shouldHideListOnInitialRender?: boolean, }; type SelectionListHandle = { diff --git a/src/pages/NewChatConfirmPage.tsx b/src/pages/NewChatConfirmPage.tsx index e6214b160a99..dfb30bded769 100644 --- a/src/pages/NewChatConfirmPage.tsx +++ b/src/pages/NewChatConfirmPage.tsx @@ -135,6 +135,7 @@ function NewChatConfirmPage({newGroupDraft, allPersonalDetails}: NewChatConfirmP showConfirmButton={selectedOptions.length > 1} confirmButtonText={translate('newChatPage.startGroup')} onConfirm={createGroup} + shouldHideListOnInitialRender={false} /> );