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

Add Flatlist props to dropdown component #171

Open aliseyalvi opened 6 months ago

aliseyalvi commented 6 months ago

Hi! πŸ‘‹

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

Today I used patch-package to patch react-native-select-dropdown@3.4.0 for the project I'm working on. I need to pass the flatlist props to dropdown component. I had solved it using this way

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-select-dropdown/index.d.ts b/node_modules/react-native-select-dropdown/index.d.ts
index 2f7ab48..cb712ff 100644
--- a/node_modules/react-native-select-dropdown/index.d.ts
+++ b/node_modules/react-native-select-dropdown/index.d.ts
@@ -119,6 +119,10 @@ declare module 'react-native-select-dropdown' {
      * text color for search input placeholder
      */
     searchPlaceHolderColor?: string;
+    /**
+     * dropdown Flatlist component props
+     */
+    dropdownFlatlistProps?: any;
     /**
      * function callback when the search input text changes, this will automatically disable the dropdown's internal search to be implemented manually outside the component
      */
diff --git a/node_modules/react-native-select-dropdown/src/SelectDropdown.js b/node_modules/react-native-select-dropdown/src/SelectDropdown.js
index 18f66b0..9f45caa 100644
--- a/node_modules/react-native-select-dropdown/src/SelectDropdown.js
+++ b/node_modules/react-native-select-dropdown/src/SelectDropdown.js
@@ -54,6 +54,7 @@ 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  */,
+    dropdownFlatlistProps /* Flatlist props can be passed here to control dropdown flatlist  */,
   },
   ref,
 ) => {
@@ -187,6 +188,7 @@ const SelectDropdown = (
               onEndReached={() => onScrollEndReached && onScrollEndReached()}
               onEndReachedThreshold={0.5}
               showsVerticalScrollIndicator={showsVerticalScrollIndicator}
+              {...dropdownFlatlistProps}
             />
           </DropdownWindow>
         </DropdownModal>

This issue body was partially generated by patch-package.