Skip to content

Determine auto dropdown position by half of the screen height#264

Open
rockychan wants to merge 1 commit intohoaphantn7604:masterfrom
rockychan:enchance-auto-dropdown-postition-auto
Open

Determine auto dropdown position by half of the screen height#264
rockychan wants to merge 1 commit intohoaphantn7604:masterfrom
rockychan:enchance-auto-dropdown-postition-auto

Conversation

@rockychan
Copy link
Copy Markdown

Issue:
The bottom space is small to show a reasonable size of dropdown when dropdownPosition is auto and it shows at bottom after calculation. Because of bottom space of value 100 and 150 (search = true) are determined as enough to show the dropdown in bottom.

Solution:
Determine bottom space by half of the device height

@qaezrun
Copy link
Copy Markdown

qaezrun commented May 3, 2024

Sorry not really related to your matter @rockychan, i just want to know if you have any idea about my problem. dropdown position auto works fine when you focus on input search and your dropdown is near bottom which might get covered by the keyboard it automatically goes up right above the keyboard. the problem is how about when dropdown is just right above the keyboard and does not trigger the setting of position to top? dropdown gets covered by the keyboard.

i have multiple dropdown inside scrollview, so sometimes dropdown is near bottom or just right enough above the keyboard that wont trigger the changing of position.

i also tried setting manually dropdown position to top whenever keyboard is open but dropdown loses the automatic functionality where in if user focus on search input it goes right above the keyboard.

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants