-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Workspace feeds] Add search bar if cards assignment list has 8+ cards #51955
Merged
mountiny
merged 9 commits into
Expensify:main
from
callstack-internal:VickyStash/feature/51906-card-list-search
Nov 8, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9a98fec
Add cards list search bar
VickyStash 5bac1ab
Merge branch 'refs/heads/main' into VickyStash/feature/51906-card-lis…
VickyStash aaabf8b
Merge branch 'refs/heads/main' into VickyStash/feature/51906-card-lis…
VickyStash 1da4eae
Fix keyboard overlapping on small devices
VickyStash a3e9c13
Minor fix
VickyStash b46bc0c
Rename CARD_LIST_THRESHOLD const
VickyStash 952c0f0
Update startTransactionDate -> transactionStartDate
VickyStash 8082a9a
Remove padding above the button
VickyStash a9bdbe2
Remove extra padding above the button on ios
VickyStash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,8 @@ function BaseSelectionList<TItem extends ListItem>( | |
textInputIconLeft, | ||
sectionTitleStyles, | ||
textInputAutoFocus = true, | ||
shouldShowTextInputAfterHeader = false, | ||
includeSafeAreaPaddingBottom = true, | ||
shouldTextInputInterceptSwipe = false, | ||
listHeaderContent, | ||
onEndReached = () => {}, | ||
|
@@ -500,6 +502,48 @@ function BaseSelectionList<TItem extends ListItem>( | |
return null; | ||
}; | ||
|
||
const renderInput = () => { | ||
return ( | ||
<View style={[styles.ph5, styles.pb3]}> | ||
<TextInput | ||
ref={(element) => { | ||
innerTextInputRef.current = element as RNTextInput; | ||
|
||
if (!textInputRef) { | ||
return; | ||
} | ||
|
||
if (typeof textInputRef === 'function') { | ||
textInputRef(element as RNTextInput); | ||
} else { | ||
// eslint-disable-next-line no-param-reassign | ||
textInputRef.current = element as RNTextInput; | ||
} | ||
}} | ||
onFocus={() => (isTextInputFocusedRef.current = true)} | ||
onBlur={() => (isTextInputFocusedRef.current = false)} | ||
label={textInputLabel} | ||
accessibilityLabel={textInputLabel} | ||
hint={textInputHint} | ||
role={CONST.ROLE.PRESENTATION} | ||
value={textInputValue} | ||
placeholder={textInputPlaceholder} | ||
maxLength={textInputMaxLength} | ||
onChangeText={onChangeText} | ||
inputMode={inputMode} | ||
selectTextOnFocus | ||
spellCheck={false} | ||
iconLeft={textInputIconLeft} | ||
onSubmitEditing={selectFocusedOption} | ||
blurOnSubmit={!!flattenedSections.allOptions.length} | ||
isLoading={isLoadingNewOptions} | ||
testID="selection-list-text-input" | ||
shouldInterceptSwipe={shouldTextInputInterceptSwipe} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const scrollToFocusedIndexOnFirstRender = useCallback( | ||
(nativeEvent: LayoutChangeEvent) => { | ||
if (shouldUseDynamicMaxToRenderPerBatch) { | ||
|
@@ -676,46 +720,8 @@ function BaseSelectionList<TItem extends ListItem>( | |
return ( | ||
<SafeAreaConsumer> | ||
{({safeAreaPaddingBottomStyle}) => ( | ||
<View style={[styles.flex1, (!isKeyboardShown || !!footerContent || showConfirmButton) && safeAreaPaddingBottomStyle, containerStyle]}> | ||
{shouldShowTextInput && ( | ||
<View style={[styles.ph5, styles.pb3]}> | ||
<TextInput | ||
ref={(element) => { | ||
innerTextInputRef.current = element as RNTextInput; | ||
|
||
if (!textInputRef) { | ||
return; | ||
} | ||
|
||
if (typeof textInputRef === 'function') { | ||
textInputRef(element as RNTextInput); | ||
} else { | ||
// eslint-disable-next-line no-param-reassign | ||
textInputRef.current = element as RNTextInput; | ||
} | ||
}} | ||
onFocus={() => (isTextInputFocusedRef.current = true)} | ||
onBlur={() => (isTextInputFocusedRef.current = false)} | ||
label={textInputLabel} | ||
accessibilityLabel={textInputLabel} | ||
hint={textInputHint} | ||
role={CONST.ROLE.PRESENTATION} | ||
value={textInputValue} | ||
placeholder={textInputPlaceholder} | ||
maxLength={textInputMaxLength} | ||
onChangeText={onChangeText} | ||
inputMode={inputMode} | ||
selectTextOnFocus | ||
spellCheck={false} | ||
iconLeft={textInputIconLeft} | ||
onSubmitEditing={selectFocusedOption} | ||
blurOnSubmit={!!flattenedSections.allOptions.length} | ||
isLoading={isLoadingNewOptions} | ||
testID="selection-list-text-input" | ||
shouldInterceptSwipe={shouldTextInputInterceptSwipe} | ||
/> | ||
</View> | ||
)} | ||
<View style={[styles.flex1, (!isKeyboardShown || !!footerContent || showConfirmButton) && includeSafeAreaPaddingBottom && safeAreaPaddingBottomStyle, containerStyle]}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dukenv0307 @VickyStash, let's be on the lookout for any bugs related to these. Changing the base components is like pandora box |
||
{shouldShowTextInput && !shouldShowTextInputAfterHeader && renderInput()} | ||
{/* If we are loading new options we will avoid showing any header message. This is mostly because one of the header messages says there are no options. */} | ||
{/* This is misleading because we might be in the process of loading fresh options from the server. */} | ||
{(!isLoadingNewOptions || headerMessage !== translate('common.noResultsFound') || (flattenedSections.allOptions.length === 0 && !showLoadingPlaceholder)) && | ||
|
@@ -759,7 +765,16 @@ function BaseSelectionList<TItem extends ListItem>( | |
testID="selection-list" | ||
onLayout={onSectionListLayout} | ||
style={[(!maxToRenderPerBatch || (shouldHideListOnInitialRender && isInitialSectionListRender)) && styles.opacity0, sectionListStyle]} | ||
ListHeaderComponent={listHeaderContent} | ||
ListHeaderComponent={ | ||
shouldShowTextInput && shouldShowTextInputAfterHeader ? ( | ||
<> | ||
{listHeaderContent} | ||
{renderInput()} | ||
</> | ||
) : ( | ||
listHeaderContent | ||
) | ||
} | ||
ListFooterComponent={listFooterContent ?? ShowMoreButtonInstance} | ||
onEndReached={onEndReached} | ||
onEndReachedThreshold={onEndReachedThreshold} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make a generic const for this, any list like this should turn into a searchable list if it has more than 8 elements