AdelRedaa97 / react-native-select-dropdown

react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
MIT License
322 stars 139 forks source link

Add support for flexible height #138

Closed ManiTWIndia closed 6 months ago

ManiTWIndia commented 1 year ago

The height of the dropdown row is fixed at 50. So longer options are getting truncated in the dropdown.

Screenshot 2023-04-19 at 1 40 36 PM

In our usecase, the row height should be 25 but for longer options, the height should be flexible. So we pass customized rowStlye prop as { height: null, minheight: 25 }. It works as expected.

Screenshot 2023-04-19 at 1 40 52 PM

But the top position is miscalculated when the dropdown position is on top as safeDropdownViewUnderKeyboard is calculated only using height value which is hardcoded as 50. The dropdown opens at a random position from the select button

Screenshot 2023-04-19 at 1 41 08 PM

To fix the above, modified the safeDropdownViewUnderKeyboard calculation to also check for minHeight when height is not passed. The issue is fixed as in below screenshot. Therefore proposing to use min height also to calculate for top position instead of just height.

Screenshot 2023-04-19 at 1 41 21 PM
ManiTWIndia commented 1 year ago

Hi @AdelRedaa97 Can you please review and merge the above

AdelRedaa97 commented 6 months ago

Added in v4.0 take a look at the changes made in v4.0 https://github.com/AdelRedaa97/react-native-select-dropdown?tab=readme-ov-file#-major-changes

Feel free to open the issue again if it still exists