Skip to content

Commit 38c2edf

Browse files
committed
fix: scrollToIndex out of range: item length 0 but minimum is 1
1 parent ce674c7 commit 38c2edf

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

example/src/dropdown/Dropdown1.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const DropdownComponent = () => {
4040
inputSearchStyle={styles.inputSearchStyle}
4141
iconStyle={styles.iconStyle}
4242
data={data}
43+
autoScroll
4344
search
4445
maxHeight={300}
4546
minHeight={100}

src/components/Dropdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ const DropdownComponent: <T>(
254254
_.isEqual(defaultValue, _.get(e, valueField))
255255
);
256256
if (
257-
!_.isEmpty(listData.length) &&
257+
listData.length > 0 &&
258258
index > -1 &&
259259
index <= listData.length - 1
260260
) {

0 commit comments

Comments
 (0)