diff --git a/src/OptionList.tsx b/src/OptionList.tsx index 31a08f1c6..ece78413b 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -108,9 +108,7 @@ const OptionList: React.RefForwardingComponent< return -1; }; - const [activeIndex, setActiveIndex] = React.useState(() => - getEnabledActiveIndex(0), - ); + const [activeIndex, setActiveIndex] = React.useState(() => getEnabledActiveIndex(0)); const setActive = (index: number) => { setActiveIndex(index); @@ -126,9 +124,7 @@ const OptionList: React.RefForwardingComponent< // Auto active first item when list length or searchValue changed React.useEffect(() => { - setActive( - defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1, - ); + setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1); }, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode @@ -171,10 +167,7 @@ const OptionList: React.RefForwardingComponent< } if (offset !== 0) { - const nextActiveIndex = getEnabledActiveIndex( - activeIndex + offset, - offset, - ); + const nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset); scrollIntoView(nextActiveIndex); setActive(nextActiveIndex); } @@ -226,12 +219,7 @@ const OptionList: React.RefForwardingComponent< const item = memoFlattenOptions[index]; const value = item && (item.data as OptionData).value; return item ? ( -