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
312 stars 133 forks source link

Added a patch to expose the layout props (still missing types) #184

Closed FFX3 closed 3 months ago

FFX3 commented 3 months ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

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

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-select-dropdown/src/SelectDropdown.js b/node_modules/react-native-select-dropdown/src/SelectDropdown.js
index 4dc9447..9a5ff2b 100644
--- a/node_modules/react-native-select-dropdown/src/SelectDropdown.js
+++ b/node_modules/react-native-select-dropdown/src/SelectDropdown.js
@@ -40,6 +40,8 @@ const SelectDropdown = (
     renderSearchInputLeftIcon /* function returns React component for search input icon */,
     renderSearchInputRightIcon /* function returns React component for search input icon */,
     onChangeSearchInputText /* function callback when the search input text changes, this will automatically disable the dropdown's interna search to be implemented manually outside the component  */,
+    getItemLayout,
+    onLayout,
   },
   ref,
 ) => {
@@ -162,6 +164,8 @@ const SelectDropdown = (
               keyExtractor={(item, index) => index.toString()}
               ref={dropDownFlatlistRef}
               renderItem={renderFlatlistItem}
+              getItemLayout={getItemLayout}
+              onLayout={onLayout}
               ListHeaderComponent={renderSearchView()}
               stickyHeaderIndices={search && [0]}
               keyboardShouldPersistTaps="always"

This issue body was partially generated by patch-package.

AdelRedaa97 commented 3 months ago

What was the problem ?

FFX3 commented 3 months ago

The component doesn't expose getItemLayout and onLayout.

looks like you just patched it.

https://github.com/AdelRedaa97/react-native-select-dropdown/issues/182