mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 15:28:55 +08:00
修复自动切换主题时处于非设置界面仍然被销毁的问题(#390)
This commit is contained in:
parent
0b949f6497
commit
637d06f2b7
@ -19,7 +19,9 @@ const SearchPage = () => {
|
|||||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_search')
|
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_search')
|
||||||
const component = useMemo(() => <Search />, [])
|
const component = useMemo(() => <Search />, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||||
|
currentId = id
|
||||||
if (id == 'nav_search') {
|
if (id == 'nav_search') {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
void InteractionManager.runAfterInteractions(() => {
|
void InteractionManager.runAfterInteractions(() => {
|
||||||
@ -29,6 +31,7 @@ const SearchPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleHide = () => {
|
const handleHide = () => {
|
||||||
|
if (currentId != 'nav_setting') return
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||||
@ -53,7 +56,9 @@ const SongListPage = () => {
|
|||||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_songlist')
|
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_songlist')
|
||||||
const component = useMemo(() => <SongList />, [])
|
const component = useMemo(() => <SongList />, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||||
|
currentId = id
|
||||||
if (id == 'nav_songlist') {
|
if (id == 'nav_songlist') {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
void InteractionManager.runAfterInteractions(() => {
|
void InteractionManager.runAfterInteractions(() => {
|
||||||
@ -63,6 +68,7 @@ const SongListPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleHide = () => {
|
const handleHide = () => {
|
||||||
|
if (currentId != 'nav_setting') return
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
||||||
@ -83,7 +89,9 @@ const LeaderboardPage = () => {
|
|||||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_top')
|
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_top')
|
||||||
const component = useMemo(() => <Leaderboard />, [])
|
const component = useMemo(() => <Leaderboard />, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||||
|
currentId = id
|
||||||
if (id == 'nav_top') {
|
if (id == 'nav_top') {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
void InteractionManager.runAfterInteractions(() => {
|
void InteractionManager.runAfterInteractions(() => {
|
||||||
@ -93,6 +101,7 @@ const LeaderboardPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleHide = () => {
|
const handleHide = () => {
|
||||||
|
if (currentId != 'nav_setting') return
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||||
@ -117,7 +126,9 @@ const MylistPage = () => {
|
|||||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_love')
|
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_love')
|
||||||
const component = useMemo(() => <Mylist />, [])
|
const component = useMemo(() => <Mylist />, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||||
|
currentId = id
|
||||||
if (id == 'nav_love') {
|
if (id == 'nav_love') {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
void InteractionManager.runAfterInteractions(() => {
|
void InteractionManager.runAfterInteractions(() => {
|
||||||
@ -127,6 +138,7 @@ const MylistPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleHide = () => {
|
const handleHide = () => {
|
||||||
|
if (currentId != 'nav_setting') return
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user