center highlighted post in permalink view (#6836)
This commit is contained in:
parent
6f36098f5f
commit
00039cb21b
1 changed files with 7 additions and 2 deletions
|
|
@ -348,8 +348,13 @@ const PostList = ({
|
|||
scrolledToHighlighted.current = true;
|
||||
// eslint-disable-next-line max-nested-callbacks
|
||||
const index = orderedPosts.findIndex((p) => typeof p !== 'string' && p.id === highlightedId);
|
||||
if (index >= 0) {
|
||||
scrollToIndex(index, true);
|
||||
if (index >= 0 && listRef.current) {
|
||||
listRef.current?.scrollToIndex({
|
||||
animated: true,
|
||||
index,
|
||||
viewOffset: 0,
|
||||
viewPosition: 0.5, // 0 is at bottom
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
|
|
|||
Loading…
Reference in a new issue