Skip to content

Commit

Permalink
Merge pull request #607 from hossein-zare/dev-5.x
Browse files Browse the repository at this point in the history
v5.4.3
  • Loading branch information
hossein-zare authored Nov 12, 2022
2 parents 1edf8cc + 3316830 commit 0e58b89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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.4.2",
"version": "5.4.3",
"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
7 changes: 5 additions & 2 deletions src/components/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function Picker({
activityIndicatorColor = Colors.GREY,
props = {},
itemProps = {},
itemLabelProps = {},
badgeProps= {},
modalProps = {},
flatListProps = {},
Expand Down Expand Up @@ -1263,7 +1264,7 @@ function Picker({

// Not a reliable method for external value changes.
if (multiple) {
if (memoryRef.current.value.includes(item[_schema.value])) {
if (memoryRef.current.value?.includes(item[_schema.value])) {
const index = memoryRef.current.items.findIndex(x => x[_schema.value] === item[_schema.value]);

if (index > -1) {
Expand All @@ -1279,7 +1280,7 @@ function Picker({

setValue(state => {
if (multiple) {
let _state = state !== null ? [...state] : [];
let _state = state !== null && state !== undefined ? [...state] : [];

if (_state.includes(item[_schema.value])) {
// Remove the value
Expand Down Expand Up @@ -1446,6 +1447,7 @@ function Picker({
disabled={item?.[_schema.disabled] ?? false}
custom={item.custom ?? false}
props={itemProps}
labelProps={itemLabelProps}
isSelected={isSelected}
IconComponent={IconComponent}
TickIconComponent={_TickIconComponent}
Expand Down Expand Up @@ -1492,6 +1494,7 @@ function Picker({
_value,
multiple,
itemProps,
itemLabelProps,
categorySelectable,
onPressItem,
theme,
Expand Down
3 changes: 2 additions & 1 deletion src/components/RenderListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function RenderListItem({
selectable,
disabled,
props,
labelProps,
custom,
isSelected,
IconComponent,
Expand Down Expand Up @@ -164,7 +165,7 @@ function RenderListItem({
return (
<TouchableOpacity style={_listItemContainerStyle} onPress={__onPress} onLayout={onLayout} {...props} disabled={selectable === false || disabled} testID={item.testID}>
{IconComponent}
<Text style={_listItemLabelStyle}>
<Text style={_listItemLabelStyle} {...labelProps}>
{label}
</Text>
{_TickIconComponent}
Expand Down

0 comments on commit 0e58b89

Please sign in to comment.