Skip to content

Commit

Permalink
Merge pull request #311 from hossein-zare/dev-5.x
Browse files Browse the repository at this point in the history
v5.1.12
  • Loading branch information
hossein-zare authored May 12, 2021
2 parents 2056ad9 + 8469af0 commit b096bea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ declare module "react-native-dropdown-picker" {
multiple?: boolean;
multipleText?: string;
mode?: ModeType;
key?: string;
itemKey?: string;
maxHeight?: number;
renderBadgeItem?: (props: RenderBadgeItemPropsInterface) => JSX.Element;
renderListItem?: (props: RenderListItemPropsInterface) => JSX.Element;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-dropdown-picker",
"version": "5.1.11",
"version": "5.1.12",
"description": "A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.",
"keywords": [
"picker",
Expand Down
16 changes: 8 additions & 8 deletions src/components/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function Picker({
multiple = false,
multipleText = null,
mode = MODE.DEFAULT,
key = null,
itemKey = null,
maxHeight = 200,
renderBadgeItem = null,
renderListItem = null,
Expand Down Expand Up @@ -873,18 +873,18 @@ function Picker({
* The badge key.
* @returns {string}
*/
const _key = useMemo(() => {
if (key === null)
const _itemKey = useMemo(() => {
if (itemKey === null)
return _schema.value;

return key;
}, [key, _schema]);
return itemKey;
}, [itemKey, _schema]);

/**
* The key extractor.
* @returns {string}
*/
const keyExtractor = useCallback((item) => `${item[_key]}`, [_key]);
const keyExtractor = useCallback((item) => `${item[_itemKey]}`, [_itemKey]);

/**
* The badge separator style.
Expand Down Expand Up @@ -1482,7 +1482,7 @@ function Picker({
<ScrollView nestedScrollEnabled={true} {...scrollViewProps}>
{_items.map((item, index) => {
return (
<Fragment key={item[_key]}>
<Fragment key={item[_itemKey]}>
{index > 0 && ItemSeparatorComponent()}
{__renderListItem({item})}
</Fragment>
Expand All @@ -1491,7 +1491,7 @@ function Picker({
{_items.length === 0 && _ListEmptyComponent()}
</ScrollView>
);
}, [renderListItem, __renderListItem, _key, scrollViewProps, _ListEmptyComponent]);
}, [renderListItem, __renderListItem, _itemKey, scrollViewProps, _ListEmptyComponent]);

/**
* The dropdown modal component.
Expand Down

0 comments on commit b096bea

Please sign in to comment.