Closed khuongsatou closed 2 years ago
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch react-native-dropdown-picker@5.3.0 for the project I'm working on.
react-native-dropdown-picker@5.3.0
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-dropdown-picker/index.d.ts b/node_modules/react-native-dropdown-picker/index.d.ts index 7b64898..0247335 100644 --- a/node_modules/react-native-dropdown-picker/index.d.ts +++ b/node_modules/react-native-dropdown-picker/index.d.ts @@ -256,6 +256,7 @@ declare module 'react-native-dropdown-picker' { rtl?: boolean; testID?: string; closeOnBackPressed?: boolean; + onPressItemCustom:(value?:any)=>void; } interface DropDownPickerSingleProps { diff --git a/node_modules/react-native-dropdown-picker/src/components/Picker.js b/node_modules/react-native-dropdown-picker/src/components/Picker.js index a154d88..1b9b435 100644 --- a/node_modules/react-native-dropdown-picker/src/components/Picker.js +++ b/node_modules/react-native-dropdown-picker/src/components/Picker.js @@ -155,7 +155,8 @@ function Picker({ theme = THEMES.DEFAULT, testID, closeOnBackPressed = false, - onSelectItem = (item) => {} + onSelectItem = (item) => {}, + onPressItemCustom=(item)=>{}, }) { const [necessaryItems, setNecessaryItems] = useState([]); const [searchText, setSearchText] = useState(''); @@ -1192,6 +1193,9 @@ function Picker({ * onPress item. */ const onPressItem = useCallback((item, customItem = false) => { + if(Boolean(onPressItemCustom)){ + onPressItemCustom(item) + } if (customItem !== false) { item.custom = false; setItems(state => [...state, item]);
This issue body was partially generated by patch-package.
Hi,
Why don't you use onSelectItem ?
onSelectItem
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
react-native-dropdown-picker@5.3.0
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.