Scroll to post
This commit is contained in:
@@ -197,14 +197,23 @@ function PostThreadLoaded({
|
|||||||
|
|
||||||
// wait for loading to finish
|
// wait for loading to finish
|
||||||
if (thread.type === 'post' && !!thread.parent) {
|
if (thread.type === 'post' && !!thread.parent) {
|
||||||
highlightedPostRef.current?.measure(
|
function onMeasure(pageY) {
|
||||||
(_x, _y, _width, _height, _pageX, pageY) => {
|
ref.current?.scrollToOffset({
|
||||||
ref.current?.scrollToOffset({
|
animated: false,
|
||||||
animated: false,
|
offset: pageY - (isDesktop ? 0 : 50),
|
||||||
offset: pageY - (isDesktop ? 0 : 50),
|
})
|
||||||
})
|
}
|
||||||
},
|
if (isNative) {
|
||||||
)
|
highlightedPostRef.current?.measure(
|
||||||
|
(_x, _y, _width, _height, _pageX, pageY) => {
|
||||||
|
onMeasure(pageY)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
const pageY =
|
||||||
|
highlightedPostRef.current.getBoundingClientRect().top + scrollY
|
||||||
|
onMeasure(pageY)
|
||||||
|
}
|
||||||
needsScrollAdjustment.current = false
|
needsScrollAdjustment.current = false
|
||||||
}
|
}
|
||||||
}, [thread, isDesktop])
|
}, [thread, isDesktop])
|
||||||
|
|||||||
Reference in New Issue
Block a user