forked from Ivasoft/mattermost-mobile
center highlighted post in permalink view (#6836)
This commit is contained in:
@@ -348,8 +348,13 @@ const PostList = ({
|
|||||||
scrolledToHighlighted.current = true;
|
scrolledToHighlighted.current = true;
|
||||||
// eslint-disable-next-line max-nested-callbacks
|
// eslint-disable-next-line max-nested-callbacks
|
||||||
const index = orderedPosts.findIndex((p) => typeof p !== 'string' && p.id === highlightedId);
|
const index = orderedPosts.findIndex((p) => typeof p !== 'string' && p.id === highlightedId);
|
||||||
if (index >= 0) {
|
if (index >= 0 && listRef.current) {
|
||||||
scrollToIndex(index, true);
|
listRef.current?.scrollToIndex({
|
||||||
|
animated: true,
|
||||||
|
index,
|
||||||
|
viewOffset: 0,
|
||||||
|
viewPosition: 0.5, // 0 is at bottom
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|||||||
Reference in New Issue
Block a user