mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 15:12:10 +08:00
修复歌曲详情页封面在旋转屏幕后切歌不更新的问题
This commit is contained in:
parent
cf7fd13dd5
commit
93e54c7afc
@ -11,6 +11,7 @@ import { BTN_WIDTH } from './MoreBtn/Btn'
|
|||||||
import { marginLeft } from './constant'
|
import { marginLeft } from './constant'
|
||||||
import Image from '@/components/common/Image'
|
import Image from '@/components/common/Image'
|
||||||
import { useStatusbarHeight } from '@/store/common/hook'
|
import { useStatusbarHeight } from '@/store/common/hook'
|
||||||
|
import commonState from '@/store/common/state'
|
||||||
|
|
||||||
|
|
||||||
export default memo(({ componentId }: { componentId: string }) => {
|
export default memo(({ componentId }: { componentId: string }) => {
|
||||||
@ -21,7 +22,9 @@ export default memo(({ componentId }: { componentId: string }) => {
|
|||||||
const [animated, setAnimated] = useState(false)
|
const [animated, setAnimated] = useState(false)
|
||||||
const [pic, setPic] = useState(musicInfo.pic)
|
const [pic, setPic] = useState(musicInfo.pic)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (animated) setPic(musicInfo.pic)
|
if (commonState.componentIds.playDetail) setAnimated(true)
|
||||||
|
else if (!animated) return
|
||||||
|
setPic(musicInfo.pic)
|
||||||
}, [musicInfo.pic, animated])
|
}, [musicInfo.pic, animated])
|
||||||
|
|
||||||
useNavigationComponentDidAppear(componentId, () => {
|
useNavigationComponentDidAppear(componentId, () => {
|
||||||
|
@ -9,6 +9,7 @@ import { useNavigationComponentDidAppear } from '@/navigation'
|
|||||||
import { HEADER_HEIGHT } from './components/Header'
|
import { HEADER_HEIGHT } from './components/Header'
|
||||||
import Image from '@/components/common/Image'
|
import Image from '@/components/common/Image'
|
||||||
import { useStatusbarHeight } from '@/store/common/hook'
|
import { useStatusbarHeight } from '@/store/common/hook'
|
||||||
|
import commonState from '@/store/common/state'
|
||||||
|
|
||||||
|
|
||||||
export default ({ componentId }: { componentId: string }) => {
|
export default ({ componentId }: { componentId: string }) => {
|
||||||
@ -19,7 +20,9 @@ export default ({ componentId }: { componentId: string }) => {
|
|||||||
const [animated, setAnimated] = useState(false)
|
const [animated, setAnimated] = useState(false)
|
||||||
const [pic, setPic] = useState(musicInfo.pic)
|
const [pic, setPic] = useState(musicInfo.pic)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (animated) setPic(musicInfo.pic)
|
if (commonState.componentIds.playDetail) setAnimated(true)
|
||||||
|
else if (!animated) return
|
||||||
|
setPic(musicInfo.pic)
|
||||||
}, [musicInfo.pic, animated])
|
}, [musicInfo.pic, animated])
|
||||||
|
|
||||||
useNavigationComponentDidAppear(componentId, () => {
|
useNavigationComponentDidAppear(componentId, () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user