lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.73k stars 490 forks source link

Added support for itemKey property in RNPickerSelect component #586

Open athul-22 opened 4 weeks ago

athul-22 commented 4 weeks ago

Description

This PR enhances the RNPickerSelect component by adding support for the itemKey property. This allows for better handling of items with identical values but unique keys, providing a more robust selection mechanism. The changes include updates to the prop types, the constructor, and the getSelectedItem and componentDidUpdate methods to utilize itemKey correctly.

Changes Made

Related Issue

Motivation and Context

The itemKey property ensures that items with identical values can be uniquely identified and selected. This is particularly useful in scenarios where the same value might be associated with different keys, improving the flexibility and reliability of the component.

How Has This Been Tested?

Types of changes

Checklist

Additional Notes

Please review the changes and let me know if there are any adjustments needed. Thank you!