mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
尝试修复某些情况下进播放详情歌词界面时报错的问题
This commit is contained in:
parent
bddbd9480e
commit
e7d65da8d8
@ -6,3 +6,7 @@
|
||||
### 优化
|
||||
|
||||
- 优化应用布局对手机系统字体大小的适配
|
||||
|
||||
### 修复
|
||||
|
||||
- 尝试修复某些情况下进播放详情歌词界面时报错的问题
|
||||
|
@ -28,6 +28,7 @@ const lrcTools = {
|
||||
onSetLyric(lines) {
|
||||
this.currentLines = lines
|
||||
for (const hook of this.setLyricHooks) hook(lines)
|
||||
for (const hook of this.playHooks) hook(-1, '')
|
||||
},
|
||||
addPlayHook(callback) {
|
||||
this.playHooks.push(callback)
|
||||
|
@ -3,6 +3,8 @@ 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 { log } from '@/utils/log'
|
||||
import { toast } from '@/utils/tools'
|
||||
|
||||
const LrcLine = memo(({ text, line, activeLine }) => {
|
||||
const theme = useGetter('common', 'theme')
|
||||
@ -41,12 +43,18 @@ export default memo(() => {
|
||||
|
||||
// const imgWidth = useMemo(() => layout.width * 0.75, [layout.width])
|
||||
const handleScrollToActive = useCallback((index = lineRef.current) => {
|
||||
if (index < 0) return
|
||||
if (scrollViewRef.current) {
|
||||
try {
|
||||
scrollViewRef.current.scrollToIndex({
|
||||
index,
|
||||
index: index,
|
||||
animated: true,
|
||||
viewPosition: 0.4,
|
||||
})
|
||||
} catch (err) {
|
||||
toast('出了点意外...你可以去错误日志查看错误', 'long')
|
||||
log.warn('Scroll failed: ', err.message)
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user