mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-14 17:41:20 +00:00
fix list bug
This commit is contained in:
parent
0fe689300e
commit
a49d89b0d8
@ -65,7 +65,13 @@ const displayedItems = disablePagination ? items : items?.length < (displayedLim
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
justifyContent: 'center'
|
||||
}} ref={index === displayedLimit ? lastItemRef2 : index === list.length -displayedLimit - 1 ? lastItemRef : null}>
|
||||
}} ref={
|
||||
index === displayedLimit
|
||||
? lastItemRef2
|
||||
: index === (list.length - displayedLimit - 1 < displayedLimit ? displayedLimit - 1 : list.length - displayedLimit - 1 )
|
||||
? lastItemRef
|
||||
: null
|
||||
}>
|
||||
<ListItemWrapper
|
||||
defaultLoaderParams={defaultLoaderParams}
|
||||
item={item}
|
||||
@ -81,11 +87,12 @@ const displayedItems = disablePagination ? items : items?.length < (displayedLim
|
||||
<LazyLoad
|
||||
onLoadMore={async () => {
|
||||
await onLoadMore(displayedLimit);
|
||||
if(!disablePagination && (displayedItems?.length === displayedLimit * 3)){
|
||||
lastItemRef.current.scrollIntoView({ behavior: "auto", block: "end" });
|
||||
setTimeout(() => {
|
||||
window.scrollBy({ top: 50, behavior: "instant" }); // 'smooth' if needed
|
||||
}, 0);
|
||||
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@ -40,7 +40,8 @@ export const VerticalPaginatedList = ({
|
||||
|
||||
const displayedItems = disablePagination
|
||||
? items
|
||||
: items.slice(-(displayedLimit * 3));
|
||||
: items?.length < (displayedLimit * 3) ? items?.slice(0, displayedLimit * 3) : items.slice(- (displayedLimit * 3));
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -60,6 +61,7 @@ export const VerticalPaginatedList = ({
|
||||
)}
|
||||
|
||||
{displayedItems?.map((item, index, list) => {
|
||||
|
||||
return (
|
||||
<React.Fragment
|
||||
key={`${item?.name}-${item?.service}-${item?.identifier}`}
|
||||
@ -73,7 +75,7 @@ export const VerticalPaginatedList = ({
|
||||
ref={
|
||||
index === displayedLimit
|
||||
? lastItemRef2
|
||||
: index === list.length - displayedLimit - 1
|
||||
: index === (list.length - displayedLimit - 1 < displayedLimit ? displayedLimit - 1 : list.length - displayedLimit - 1 )
|
||||
? lastItemRef
|
||||
: null
|
||||
}
|
||||
@ -93,13 +95,16 @@ export const VerticalPaginatedList = ({
|
||||
<LazyLoad
|
||||
onLoadMore={async () => {
|
||||
await onLoadMore(displayedLimit);
|
||||
lastItemRef.current.scrollIntoView({
|
||||
behavior: "auto",
|
||||
block: "end",
|
||||
});
|
||||
setTimeout(() => {
|
||||
window.scrollBy({ top: 50, behavior: "instant" }); // 'smooth' if needed
|
||||
}, 0);
|
||||
if(!disablePagination && (displayedItems?.length === displayedLimit * 3)){
|
||||
lastItemRef.current.scrollIntoView({
|
||||
behavior: "auto",
|
||||
block: "end",
|
||||
});
|
||||
setTimeout(() => {
|
||||
window.scrollBy({ top: 50, behavior: "instant" }); // 'smooth' if needed
|
||||
}, 0);
|
||||
}
|
||||
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user