mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 08:52:08 +08:00
优化&修复
This commit is contained in:
parent
9397708f3b
commit
302115e1e4
@ -72,7 +72,7 @@ export default memo(({ item, index, showSource, onPress, onLongPress, onShowMenu
|
||||
</View>
|
||||
{
|
||||
isShowInterval ? (
|
||||
<Text size={12} color={theme['c-300']} numberOfLines={1}>{item.interval}</Text>
|
||||
<Text size={12} color={theme['c-250']} numberOfLines={1}>{item.interval}</Text>
|
||||
) : null
|
||||
}
|
||||
</TouchableOpacity>
|
||||
@ -84,6 +84,8 @@ export default memo(({ item, index, showSource, onPress, onLongPress, onShowMenu
|
||||
}, (prevProps, nextProps) => {
|
||||
return !!(prevProps.item === nextProps.item &&
|
||||
prevProps.index === nextProps.index &&
|
||||
prevProps.isShowAlbumName === nextProps.isShowAlbumName &&
|
||||
prevProps.isShowInterval === nextProps.isShowInterval &&
|
||||
nextProps.selectedList.includes(nextProps.item) == prevProps.selectedList.includes(nextProps.item)
|
||||
)
|
||||
})
|
||||
|
@ -10,6 +10,10 @@ import { createStyle } from '@/utils/tools'
|
||||
import PagerView, { type PageScrollStateChangedNativeEvent, type PagerViewOnPageSelectedEvent } from 'react-native-pager-view'
|
||||
import { setNavActiveId } from '@/core/common'
|
||||
|
||||
const hideKeys = [
|
||||
'list.isShowAlbumName',
|
||||
'list.isShowInterval',
|
||||
] as Readonly<Array<keyof LX.AppSetting>>
|
||||
|
||||
const SearchPage = () => {
|
||||
const [visible, setVisible] = useState(commonState.navActiveId == 'nav_search')
|
||||
@ -27,14 +31,19 @@ const SearchPage = () => {
|
||||
const handleHide = () => {
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
if (keys.some(k => hideKeys.includes(k))) handleHide()
|
||||
}
|
||||
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.on('themeUpdated', handleHide)
|
||||
global.state_event.on('languageChanged', handleHide)
|
||||
global.state_event.on('configUpdated', handleConfigUpdated)
|
||||
|
||||
return () => {
|
||||
global.state_event.off('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.off('themeUpdated', handleHide)
|
||||
global.state_event.off('languageChanged', handleHide)
|
||||
global.state_event.off('configUpdated', handleConfigUpdated)
|
||||
}
|
||||
}, [])
|
||||
|
||||
@ -86,14 +95,19 @@ const LeaderboardPage = () => {
|
||||
const handleHide = () => {
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
if (keys.some(k => hideKeys.includes(k))) handleHide()
|
||||
}
|
||||
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.on('themeUpdated', handleHide)
|
||||
global.state_event.on('languageChanged', handleHide)
|
||||
global.state_event.on('configUpdated', handleConfigUpdated)
|
||||
|
||||
return () => {
|
||||
global.state_event.off('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.off('themeUpdated', handleHide)
|
||||
global.state_event.off('languageChanged', handleHide)
|
||||
global.state_event.on('configUpdated', handleConfigUpdated)
|
||||
}
|
||||
}, [])
|
||||
|
||||
@ -115,14 +129,19 @@ const MylistPage = () => {
|
||||
const handleHide = () => {
|
||||
setVisible(false)
|
||||
}
|
||||
const handleConfigUpdated = (keys: Array<keyof LX.AppSetting>) => {
|
||||
if (keys.some(k => hideKeys.includes(k))) handleHide()
|
||||
}
|
||||
global.state_event.on('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.on('themeUpdated', handleHide)
|
||||
global.state_event.on('languageChanged', handleHide)
|
||||
global.state_event.on('configUpdated', handleConfigUpdated)
|
||||
|
||||
return () => {
|
||||
global.state_event.off('navActiveIdUpdated', handleNavIdUpdate)
|
||||
global.state_event.off('themeUpdated', handleHide)
|
||||
global.state_event.off('languageChanged', handleHide)
|
||||
global.state_event.on('configUpdated', handleConfigUpdated)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
@ -64,7 +64,7 @@ export default memo(({ item, index, activeIndex, onPress, onShowMenu, onLongPres
|
||||
</View>
|
||||
{
|
||||
isShowInterval ? (
|
||||
<Text size={12} color={active ? theme['c-primary-alpha-200'] : theme['c-300']} numberOfLines={1}>{item.interval}</Text>
|
||||
<Text size={12} color={active ? theme['c-primary-alpha-400'] : theme['c-250']} numberOfLines={1}>{item.interval}</Text>
|
||||
) : null
|
||||
}
|
||||
</TouchableOpacity>
|
||||
@ -78,9 +78,9 @@ export default memo(({ item, index, activeIndex, onPress, onShowMenu, onLongPres
|
||||
}, (prevProps, nextProps) => {
|
||||
return !!(prevProps.item === nextProps.item &&
|
||||
prevProps.index === nextProps.index &&
|
||||
prevProps.isShowAlbumName === nextProps.isShowAlbumName &&
|
||||
prevProps.isShowInterval === nextProps.isShowInterval &&
|
||||
prevProps.activeIndex != nextProps.index &&
|
||||
prevProps.isShowAlbumName != nextProps.isShowAlbumName &&
|
||||
prevProps.isShowInterval != nextProps.isShowInterval &&
|
||||
nextProps.activeIndex != nextProps.index &&
|
||||
nextProps.selectedList.includes(nextProps.item) == prevProps.selectedList.includes(nextProps.item)
|
||||
)
|
||||
|
@ -12,7 +12,9 @@ export default memo(() => {
|
||||
const t = useI18n()
|
||||
const isShowAlbumName = useSettingValue('list.isShowAlbumName')
|
||||
const setShowAlbumName = (isShowAlbumName: boolean) => {
|
||||
updateSetting({ 'list.isShowAlbumName': isShowAlbumName })
|
||||
requestAnimationFrame(() => {
|
||||
updateSetting({ 'list.isShowAlbumName': isShowAlbumName })
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -12,7 +12,9 @@ export default memo(() => {
|
||||
const t = useI18n()
|
||||
const isShowInterval = useSettingValue('list.isShowInterval')
|
||||
const setShowInterval = (isShowInterval: boolean) => {
|
||||
updateSetting({ 'list.isShowInterval': isShowInterval })
|
||||
requestAnimationFrame(() => {
|
||||
updateSetting({ 'list.isShowInterval': isShowInterval })
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user