Adding Option To Allow Pushing Selected Items To The Top of Items - #241
Open
SamJbori wants to merge 5 commits into
Open
Adding Option To Allow Pushing Selected Items To The Top of Items#241SamJbori wants to merge 5 commits into
SamJbori wants to merge 5 commits into
Conversation
Added support to selectedToTop
Added support to selectedToTop
Added support to selectedToTop
Added support to selectedToTop
Added support to selectedToTop
carlos3g
added a commit
to carlos3g/element-dropdown
that referenced
this pull request
Apr 19, 2026
Bundles a v2.14 batch of community-requested features ported from the upstream PR backlog and a few additions that have no upstream PR but came up repeatedly in issues. All additive — the public API stays drop-in compatible. Search input - searchKeyboardType: KeyboardTypeOptions on the search field (closes upstream hoaphantn7604#320, supersedes hoaphantn7604#230, hoaphantn7604#231). - searchInputProps: TextInputProps passthrough for selectionColor, returnKeyType, autoCapitalize, autoFocus, secureTextEntry, etc. (covers issue hoaphantn7604#312). - searchField now accepts keyof T or (keyof T)[] — match across several fields without writing a custom matcher (reframes upstream hoaphantn7604#308). - persistSearch: keep the search text across opens / selections instead of clearing it (issue hoaphantn7604#283). List behaviour - onEndReached + onEndReachedThreshold first-class on both components, hooked into the underlying FlatList (closes upstream hoaphantn7604#226 / issue hoaphantn7604#329). - activeItemTextStyle: extra text style applied only to the selected row (closes upstream hoaphantn7604#269). - hideSelectedFromList: drops the currently-selected items from the rendered list (issue hoaphantn7604#321). MultiSelect-only - closeModalWhenSelectedItem: opt-in close-on-toggle, matching Dropdown's existing prop (closes upstream hoaphantn7604#310). Defaults to false to preserve current keep-selecting behaviour. - selectedToTop: pushes selected items to the top of the list (closes upstream hoaphantn7604#241). - eventClose stabilised in useCallback so the new memoised callbacks don't invalidate every render. Custom presentation - renderSelectedItem on Dropdown: replace the entire trigger body with custom JSX, receives \`visible\` (closes upstream hoaphantn7604#318 slice; supersedes hoaphantn7604#347, hoaphantn7604#273, hoaphantn7604#323). - renderModalHeader on both: render a sticky header above the list inside the modal, receives close() (covers issue hoaphantn7604#218). Fixes bundled with the feature work - Auto position now flips upward when the trigger sits in the bottom half of the screen, replacing the fixed < 150 pixel threshold with max(minSlack, H/2) (closes upstream hoaphantn7604#264). - The modal-level TouchableWithoutFeedback is now accessible={ false}, and the redundant inner wrap was removed, so iOS Accessibility Inspector and screen readers can drill into individual list rows (covers issues hoaphantn7604#297, hoaphantn7604#303).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While using the component with large list (5000+), it felt much easier if I can see the selected items first, epically if I am using
visibleSelectedItem={false}, so I added an optionalselectedToTopBoolean property that will trigger this behavior.simply it will filter the
datatwice and using thecheckSelected()methodI tested the speed and it's just fine
I hope you like it and approve, I've started programming few months ago and this is my first contribution, I hope it's of some value.