mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 07:12:10 +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 component = useMemo(() => <Search />, [])
|
||||
useEffect(() => {
|
||||
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||
currentId = id
|
||||
if (id == 'nav_search') {
|
||||
requestAnimationFrame(() => {
|
||||
void InteractionManager.runAfterInteractions(() => {
|
||||
@ -29,6 +31,7 @@ const SearchPage = () => {
|
||||
}
|
||||
}
|
||||
const handleHide = () => {
|
||||
if (currentId != 'nav_setting') return
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
@ -53,7 +56,9 @@ const SongListPage = () => {
|
||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_songlist')
|
||||
const component = useMemo(() => <SongList />, [])
|
||||
useEffect(() => {
|
||||
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||
currentId = id
|
||||
if (id == 'nav_songlist') {
|
||||
requestAnimationFrame(() => {
|
||||
void InteractionManager.runAfterInteractions(() => {
|
||||
@ -63,6 +68,7 @@ const SongListPage = () => {
|
||||
}
|
||||
}
|
||||
const handleHide = () => {
|
||||
if (currentId != 'nav_setting') return
|
||||
setVisible(false)
|
||||
}
|
||||
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
||||
@ -83,7 +89,9 @@ const LeaderboardPage = () => {
|
||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_top')
|
||||
const component = useMemo(() => <Leaderboard />, [])
|
||||
useEffect(() => {
|
||||
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||
currentId = id
|
||||
if (id == 'nav_top') {
|
||||
requestAnimationFrame(() => {
|
||||
void InteractionManager.runAfterInteractions(() => {
|
||||
@ -93,6 +101,7 @@ const LeaderboardPage = () => {
|
||||
}
|
||||
}
|
||||
const handleHide = () => {
|
||||
if (currentId != 'nav_setting') return
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
@ -117,7 +126,9 @@ const MylistPage = () => {
|
||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_love')
|
||||
const component = useMemo(() => <Mylist />, [])
|
||||
useEffect(() => {
|
||||
let currentId: CommonState['navActiveId'] = commonState.navActiveId
|
||||
const handleNavIdUpdate = (id: CommonState['navActiveId']) => {
|
||||
currentId = id
|
||||
if (id == 'nav_love') {
|
||||
requestAnimationFrame(() => {
|
||||
void InteractionManager.runAfterInteractions(() => {
|
||||
@ -127,6 +138,7 @@ const MylistPage = () => {
|
||||
}
|
||||
}
|
||||
const handleHide = () => {
|
||||
if (currentId != 'nav_setting') return
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user