mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-05 05:18:56 +08:00
尝试修复有时候进入播放详情歌词界面时会导致应用UI被冻结的问题
This commit is contained in:
parent
c1a930f961
commit
1995a1dc44
@ -9,3 +9,4 @@
|
|||||||
- 修复打开kw歌单失败时会无限重试的问题
|
- 修复打开kw歌单失败时会无限重试的问题
|
||||||
- 尝试修复弹出菜单、列表位置不正确的问题
|
- 尝试修复弹出菜单、列表位置不正确的问题
|
||||||
- 修复打开kg源歌单链接失败的问题
|
- 修复打开kg源歌单链接失败的问题
|
||||||
|
- 尝试修复有时候进入播放详情歌词界面时会导致应用UI被冻结的问题
|
||||||
|
@ -18,7 +18,7 @@ const LrcLine = memo(({ text, line, activeLine }) => {
|
|||||||
prevProps.activeLine != nextProps.line &&
|
prevProps.activeLine != nextProps.line &&
|
||||||
nextProps.activeLine != nextProps.line
|
nextProps.activeLine != nextProps.line
|
||||||
})
|
})
|
||||||
const wait = new Promise(resolve => setTimeout(resolve, 500))
|
const wait = () => new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
|
||||||
export default memo(() => {
|
export default memo(() => {
|
||||||
const lyricLines = useLrcSet()
|
const lyricLines = useLrcSet()
|
||||||
@ -44,17 +44,17 @@ export default memo(() => {
|
|||||||
// const imgWidth = useMemo(() => layout.width * 0.75, [layout.width])
|
// const imgWidth = useMemo(() => layout.width * 0.75, [layout.width])
|
||||||
const handleScrollToActive = useCallback((index = lineRef.current) => {
|
const handleScrollToActive = useCallback((index = lineRef.current) => {
|
||||||
if (index < 0) return
|
if (index < 0) return
|
||||||
if (scrollViewRef.current && linesRef.current.length <= index + 1) {
|
if (scrollViewRef.current) {
|
||||||
try {
|
// try {
|
||||||
scrollViewRef.current.scrollToIndex({
|
scrollViewRef.current.scrollToIndex({
|
||||||
index: index,
|
index: index,
|
||||||
animated: true,
|
animated: true,
|
||||||
viewPosition: 0.4,
|
viewPosition: 0.4,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
toast('出了点意外...你可以去错误日志查看错误', 'long')
|
// toast('出了点意外...你可以去错误日志查看错误', 'long')
|
||||||
log.warn('Scroll failed: ', err.message)
|
// log.warn('Scroll failed: ', err.message)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -70,8 +70,8 @@ export default memo(() => {
|
|||||||
|
|
||||||
const handleScrollToIndexFailed = (info) => {
|
const handleScrollToIndexFailed = (info) => {
|
||||||
// console.log(info)
|
// console.log(info)
|
||||||
wait.then(() => {
|
wait().then(() => {
|
||||||
scrollViewRef.current?.scrollToIndex({ index: info.index, animated: true })
|
handleScrollToActive(info.index)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ export default memo(() => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
linesRef.current = lyricLines
|
linesRef.current = lyricLines
|
||||||
if (!scrollViewRef.current || !lyricLines.length) return
|
if (!scrollViewRef.current || !scrollViewRef.current.props.data.length) return
|
||||||
scrollViewRef.current.scrollToOffset({
|
scrollViewRef.current.scrollToOffset({
|
||||||
offset: 0,
|
offset: 0,
|
||||||
animated: false,
|
animated: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user