From bf4977906bd618b078c7f44722a6926bf8ece3c5 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 3 Sep 2023 16:16:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AD=8C=E8=AF=8D=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/screens/PlayDetail/Horizontal/Lyric.tsx | 5 +++-- src/screens/PlayDetail/Vertical/Lyric.tsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/screens/PlayDetail/Horizontal/Lyric.tsx b/src/screens/PlayDetail/Horizontal/Lyric.tsx index 654ae3c3..6e6b2942 100644 --- a/src/screens/PlayDetail/Horizontal/Lyric.tsx +++ b/src/screens/PlayDetail/Horizontal/Lyric.tsx @@ -108,8 +108,9 @@ export default () => { for (let line = 0; line < index; line++) { offset += listLayoutInfoRef.current.lineHeights[line] } + offset -= (listLayoutInfoRef.current.lineHeights[line] ?? 0) / 2 try { - scrollCancelRef.current = scrollTo(flatListRef.current, scrollInfoRef.current, offset - scrollInfoRef.current.layoutMeasurement.height * 0.36, 300, () => { + scrollCancelRef.current = scrollTo(flatListRef.current, scrollInfoRef.current, offset - scrollInfoRef.current.layoutMeasurement.height * 0.42, 300, () => { scrollCancelRef.current = null }) } catch {} @@ -122,7 +123,7 @@ export default () => { flatListRef.current.scrollToIndex({ index, animated: true, - viewPosition: 0.4, + viewPosition: 0.42, }) } catch {} } diff --git a/src/screens/PlayDetail/Vertical/Lyric.tsx b/src/screens/PlayDetail/Vertical/Lyric.tsx index 92d450a8..3c91a851 100644 --- a/src/screens/PlayDetail/Vertical/Lyric.tsx +++ b/src/screens/PlayDetail/Vertical/Lyric.tsx @@ -148,8 +148,9 @@ export default () => { for (let line = 0; line < index; line++) { offset += listLayoutInfoRef.current.lineHeights[line] } + offset += (listLayoutInfoRef.current.lineHeights[line] ?? 0) / 2 try { - scrollCancelRef.current = scrollTo(flatListRef.current, scrollInfoRef.current, offset - scrollInfoRef.current.layoutMeasurement.height * 0.36, 300, () => { + scrollCancelRef.current = scrollTo(flatListRef.current, scrollInfoRef.current, offset - scrollInfoRef.current.layoutMeasurement.height * 0.42, 300, () => { scrollCancelRef.current = null }) } catch {} @@ -162,7 +163,7 @@ export default () => { flatListRef.current.scrollToIndex({ index, animated: true, - viewPosition: 0.4, + viewPosition: 0.42, }) } catch {} }