enhance(view):调整虚拟列表滚动设置,避免卡顿。
This commit is contained in:
parent
6d4dd4de06
commit
65943e33b9
@ -25,7 +25,7 @@ export const ContinuationView: FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ebus?.addListener('navigate_offset', ({ filename }) => {
|
ebus?.addListener('navigate_offset', ({ filename }) => {
|
||||||
let index = indexOf(filename, pluck('filename', files));
|
let index = indexOf(filename, pluck('filename', files));
|
||||||
virtualListRef.current?.scrollToIndex({ index, align: 'start', behavior: 'smooth' });
|
virtualListRef.current?.scrollToIndex({ index, align: 'start' });
|
||||||
});
|
});
|
||||||
ebus?.addListener('reset_views', () => {
|
ebus?.addListener('reset_views', () => {
|
||||||
virtualListRef.current?.scrollTo({ top: 0 });
|
virtualListRef.current?.scrollTo({ top: 0 });
|
||||||
|
@ -27,8 +27,7 @@ export const FileList: FC = () => {
|
|||||||
let firstActivedIndex = indexOf(firstActived, pluck('filename', files));
|
let firstActivedIndex = indexOf(firstActived, pluck('filename', files));
|
||||||
listRef.current?.scrollToIndex({
|
listRef.current?.scrollToIndex({
|
||||||
index: firstActivedIndex,
|
index: firstActivedIndex,
|
||||||
align: 'center',
|
align: 'center'
|
||||||
behavior: 'auto'
|
|
||||||
});
|
});
|
||||||
}, [activeFiles]);
|
}, [activeFiles]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user