Skip to content

MaxHeight style property #222

@ronzano

Description

@ronzano

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-select-dropdown@4.0.1 for the project I'm working on.

Dropdown maxHeight style is not supported.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-select-dropdown/src/hooks/useLayoutDropdown.js b/node_modules/react-native-select-dropdown/src/hooks/useLayoutDropdown.js
index 1fc01dc..1f5c76e 100644
--- a/node_modules/react-native-select-dropdown/src/hooks/useLayoutDropdown.js
+++ b/node_modules/react-native-select-dropdown/src/hooks/useLayoutDropdown.js
@@ -66,7 +66,7 @@ export const useLayoutDropdown = (data, dropdownStyle) => {
       ...{
         position: 'absolute',
         height: dropdownHEIGHT,
-        maxHeight: DROPDOWN_MAX_HEIGHT,
+        maxHeight: Math.min(DROPDOWN_MAX_HEIGHT, dropdownStyle?.maxHeight || DROPDOWN_MAX_HEIGHT),
       },
       ...getPositionIfKeyboardIsOpened(),
     };

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions