Open noque-lind opened 6 days ago
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.
react-native-select-dropdown@4.0.1
to make it generic.
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 f5c89c4..bc00448 100644 --- a/node_modules/react-native-select-dropdown/index.d.ts +++ b/node_modules/react-native-select-dropdown/index.d.ts @@ -2,27 +2,27 @@ import type * as React from 'react'; import {StyleProp, ViewStyle, TextStyle} from 'react-native'; declare module 'react-native-select-dropdown' { - export type SelectDropdownProps = { + export type SelectDropdownProps<T> = { /** * array of data that will be represented in dropdown, can be array of objects */ - data: Array<any>; + data: Array<T>; /** * function recieves selected item and its index in data array */ - onSelect: (selectedItem: any, index: number) => void; + onSelect: (selectedItem: T, index: number) => void; /** * function returns React component for the dropdown button */ - renderButton: (selectedItem: any, isOpened: boolean) => React.ReactNode; + renderButton: (selectedItem: T, isOpened: boolean) => React.ReactNode; /** * function returns React component for each dropdown item */ - renderItem: (selectedItem: any, index: number, isSelected: boolean) => React.ReactNode; + renderItem: (selectedItem: T, index: number, isSelected: boolean) => React.ReactNode; /** * default selected item in dropdown */ - defaultValue?: any; + defaultValue?: T; /** * default selected item index */ @@ -102,14 +102,14 @@ declare module 'react-native-select-dropdown' { /** * function returns React component for search input icon */ - renderSearchInputLeftIcon?: (selectedItem: any, index: number) => React.ReactNode; + renderSearchInputLeftIcon?: (selectedItem: T, index: number) => React.ReactNode; /** * function returns React component for search input icon */ - renderSearchInputRightIcon?: (selectedItem: any, index: number) => React.ReactNode; + renderSearchInputRightIcon?: (selectedItem: T, index: number) => React.ReactNode; }; - export default class SelectDropdown extends React.Component<SelectDropdownProps> { + export default class SelectDropdown<T> extends React.Component<SelectDropdownProps<T>> { /** * Remove selection & reset it */
This issue body was partially generated by patch-package.
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.to make it generic.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.