react-component / select

React Select
https://select.react-component.now.sh/
MIT License
892 stars 452 forks source link

原本是下拉滚动加载数据,有这个导致当前选中1条的时候,滚动到底部加载了更多数据时,会滚动到选择的数据的位置 #982

Closed darknessjs closed 8 months ago

darknessjs commented 9 months ago

https://github.com/react-component/select/blob/b5fccbda6c03ada9aee36aa46cd135d0a696df2e/src/OptionList.tsx#L149

darknessjs commented 9 months ago

const [splitIndex, setSplitIndex] = React.useState(80); const testOptions = []; for (let i = 0; i < splitIndex; i++) { testOptions.push({ label: 'test' + i, value: 'test' + i, }) } testOptions.push({ value: 'loading', disabled: true, label: ( <LoadingRender key={${splitIndex}-loading} onLoad={() => { setSplitIndex(splitIndex + 20); }} /> ), });

组件渲染:(antd) <Select options={testOptions} virtual={true} />

yoyo837 commented 9 months ago

提供复现到antd那边提个issue吧

darknessjs commented 9 months ago

https://github.com/ant-design/ant-design/issues/45137 已提交,并附上了可重现地址

yoyo837 commented 8 months ago

Close by https://github.com/react-component/select/pull/986