mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-05 03:08:56 +08:00
修复打开歌单失败时会导致应用崩溃的问题
This commit is contained in:
parent
5f3a0b569a
commit
991feb953f
@ -14,7 +14,7 @@ const Header = memo(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ ...styles.container }}>
|
<View style={{ ...styles.container, backgroundColor: theme.primary }}>
|
||||||
<Text style={{ ...styles.text, color: theme.normal20 }}>{t('load_failed')}</Text>
|
<Text style={{ ...styles.text, color: theme.normal20 }}>{t('load_failed')}</Text>
|
||||||
<Button onPress={back} style={{ ...styles.controlBtn, backgroundColor: theme.secondary40 }}>
|
<Button onPress={back} style={{ ...styles.controlBtn, backgroundColor: theme.secondary40 }}>
|
||||||
<Text style={{ ...styles.controlBtnText, color: theme.secondary }}>{t('back')}</Text>
|
<Text style={{ ...styles.controlBtnText, color: theme.secondary }}>{t('back')}</Text>
|
||||||
@ -25,7 +25,11 @@ const Header = memo(() => {
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,6 @@ export default ({ animatePlayed }) => {
|
|||||||
const getListDetail = useDispatch('songList', 'getListDetail')
|
const getListDetail = useDispatch('songList', 'getListDetail')
|
||||||
|
|
||||||
const handleListLoadMore = useCallback(() => {
|
const handleListLoadMore = useCallback(() => {
|
||||||
// console.log(listDetailData)
|
|
||||||
if (listDetailData.isLoading || listDetailData.isEnd) return
|
if (listDetailData.isLoading || listDetailData.isEnd) return
|
||||||
getListDetail({ id: selectListInfoRef.current.id, page: listDetailData.page + 1 })
|
getListDetail({ id: selectListInfoRef.current.id, page: listDetailData.page + 1 })
|
||||||
}, [getListDetail, listDetailData])
|
}, [getListDetail, listDetailData])
|
||||||
@ -29,9 +28,8 @@ export default ({ animatePlayed }) => {
|
|||||||
}, [getListDetail])
|
}, [getListDetail])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
isGetListDetailFailed
|
<>
|
||||||
? <Failed />
|
<OnlineList
|
||||||
: <OnlineList
|
|
||||||
list={animatePlayed ? listDetailData.list : []}
|
list={animatePlayed ? listDetailData.list : []}
|
||||||
page={-1}
|
page={-1}
|
||||||
// isEnd={listDetailData.isEnd}
|
// isEnd={listDetailData.isEnd}
|
||||||
@ -41,5 +39,8 @@ export default ({ animatePlayed }) => {
|
|||||||
isLoading={listDetailData.isLoading}
|
isLoading={listDetailData.isLoading}
|
||||||
ListHeaderComponent={<ListDetailHeader />}
|
ListHeaderComponent={<ListDetailHeader />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{ isGetListDetailFailed ? <Failed /> : null }
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ export const TYPES = {
|
|||||||
setListEnd: null,
|
setListEnd: null,
|
||||||
setListDetailEnd: null,
|
setListDetailEnd: null,
|
||||||
setGetListDetailFailed: null,
|
setGetListDetailFailed: null,
|
||||||
|
clearListDetail: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(TYPES)) {
|
for (const key of Object.keys(TYPES)) {
|
||||||
@ -169,11 +170,14 @@ export const setVisibleListDetail = isShow => {
|
|||||||
payload: isShow,
|
payload: isShow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const setSelectListInfo = info => {
|
export const setSelectListInfo = info => (dispatch, getState) => {
|
||||||
return {
|
dispatch({
|
||||||
type: TYPES.setSelectListInfo,
|
type: TYPES.setSelectListInfo,
|
||||||
payload: info,
|
payload: info,
|
||||||
}
|
})
|
||||||
|
dispatch({
|
||||||
|
type: TYPES.clearListDetail,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
export const setGetListDetailFailed = isFailed => {
|
export const setGetListDetailFailed = isFailed => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user