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
320 stars 137 forks source link

Incorrect types when using renderCustomizedRowChild/renderCustomizedButtonChild #75

Closed Sascha1251 closed 1 year ago

Sascha1251 commented 2 years ago

When I use the renderCustomizedRowChild or renderCustomizedButtonChild function, according to the documentation, I don't need to define the rowTextForSelection/buttonTextAfterSelection. However, this is not represented in TypeScript and therefore I get the following error:

No overload matches this call. Overload 1 of 2, '(props: SelectDropdownProps | Readonly<SelectDropdownProps>): SelectDropdown', gave the following error. Type '{ data: MenuItemOptionValue[]; defaultValueByIndex: number; onSelect: (selectedItem: any) => void; dropdownStyle: { borderRadius: number; }; buttonStyle: { width: string; ... 5 more ...; paddingHorizontal: number; }; ... 4 more ...; renderCustomizedRowChild: (item: any, index: number) => Element; }' is missing the following properties from type 'Readonly<SelectDropdownProps>': buttonTextAfterSelection, rowTextForSelection Overload 2 of 2, '(props: SelectDropdownProps, context: any): SelectDropdown', gave the following error. Type '{ data: MenuItemOptionValue[]; defaultValueByIndex: number; onSelect: (selectedItem: any) => void; dropdownStyle: { borderRadius: number; }; buttonStyle: { width: string; ... 5 more ...; paddingHorizontal: number; }; ... 4 more ...; renderCustomizedRowChild: (item: any, index: number) => Element; }' is missing the following properties from type 'Readonly<SelectDropdownProps>': buttonTextAfterSelection, rowTextForSelectionts(2769)

Would it be possible to adjust the definition, so that it's possible to use renderCustomizedRowChild/renderCustomizedButtonChild without TypeScript errors?

pjadavies commented 1 year ago

@AdelRedaa97 @Sascha1251 I ran into this, too. I believe https://github.com/AdelRedaa97/react-native-select-dropdown/pull/109 fixes it.