修复播放详情页歌词的一个滚动错误

This commit is contained in:
lyswhut 2021-05-25 11:37:17 +08:00
parent 16f011f63f
commit 00239b669d
2 changed files with 5 additions and 7 deletions

View File

@ -1,3 +1,4 @@
### 修复
- 尝试修复软件启动时恢复上一次播放的歌曲可能导致软件崩溃的问题
- 修复播放详情页歌词的一个滚动错误

View File

@ -3,7 +3,6 @@ import { View, Text, StyleSheet, FlatList } from 'react-native'
import { useGetter, useDispatch } from '@/store'
import { useLayout } from '@/utils/hooks'
import { useLrcPlay, useLrcSet } from '@/plugins/lyric'
import { screenkeepAwake, screenUnkeepAwake } from '@/utils/utils'
const LrcLine = memo(({ text, line, activeLine }) => {
const theme = useGetter('common', 'theme')
@ -62,9 +61,9 @@ export default memo(() => {
}
const handleScrollToIndexFailed = (info) => {
console.log(info)
// console.log(info)
wait.then(() => {
scrollTimoutRef.current?.scrollToIndex({ index: info.index, animated: true })
scrollViewRef.current?.scrollToIndex({ index: info.index, animated: true })
})
}
@ -72,7 +71,7 @@ export default memo(() => {
setTimeout(() => {
isPauseScrollRef.current = false
handleScrollToActive()
}, 500)
}, 100)
return () => {
if (scrollTimoutRef.current) {
clearTimeout(scrollTimoutRef.current)
@ -91,9 +90,7 @@ export default memo(() => {
if (isFirstSetLrc.current) {
isFirstSetLrc.current = false
} else {
setTimeout(() => {
handleScrollToActive(0)
}, 100)
handleScrollToActive(0)
}
}, [handleScrollToActive, lyricLines])