分离布局

This commit is contained in:
lyswhut 2022-06-16 14:43:12 +08:00
parent b5c884c2fa
commit a9dd7ab939
6 changed files with 32 additions and 20 deletions

View File

@ -123,7 +123,7 @@
"setting_backup_part_import_setting": "Import settings",
"setting_backup_part_import_setting_desc": "Select the Settings file",
"setting_basic": "General",
"setting_basic__startup_auto_play": "Play music automatically after startup",
"setting_basic_startup_auto_play": "Play music automatically after startup",
"setting_basic_animation": "Random pop-up animation",
"setting_basic_lang": "Language",
"setting_basic_share_type": "Share",

View File

@ -124,7 +124,7 @@
"setting_backup_part_import_setting": "导入设置",
"setting_backup_part_import_setting_desc": "选择配置文件",
"setting_basic": "基本设置",
"setting_basic__startup_auto_play": "启动后自动播放音乐",
"setting_basic_startup_auto_play": "启动后自动播放音乐",
"setting_basic_animation": "弹出层随机动画",
"setting_basic_lang": "语言",
"setting_basic_share_type": "分享方式",

View File

@ -0,0 +1,27 @@
import React, { memo } from 'react'
import { View } from 'react-native'
import { useGetter, useDispatch } from '@/store'
import CheckBoxItem from '../components/CheckBoxItem'
import { useTranslation } from '@/plugins/i18n'
import { getIsSupportedAutoTheme } from '@/utils/tools'
const isSupportedAutoTheme = getIsSupportedAutoTheme()
export default memo(() => {
const { t } = useTranslation()
const isAutoTheme = useGetter('common', 'isAutoTheme')
const setIsAutoTheme = useDispatch('common', 'setIsAutoTheme')
return (
isSupportedAutoTheme
? (
<View style={{ marginTop: 5, marginBottom: 15 }}>
<CheckBoxItem check={isAutoTheme} label={t('setting_basic_theme_auto_theme')} onChange={setIsAutoTheme} />
</View>
)
: null
)
})

View File

@ -14,7 +14,7 @@ export default memo(() => {
return (
<View style={{ marginTop: 5, marginBottom: 15 }}>
<CheckBoxItem check={startupAutoPlay} label={t('setting_basic__startup_auto_play')} onChange={setStartupAutoPlay} />
<CheckBoxItem check={startupAutoPlay} label={t('setting_basic_startup_auto_play')} onChange={setStartupAutoPlay} />
</View>
)
})

View File

@ -4,10 +4,7 @@ import { StyleSheet, View, Text, ImageBackground, TouchableOpacity, InteractionM
import { useGetter, useDispatch } from '@/store'
import SubTitle from '../components/SubTitle'
import CheckBoxItem from '../components/CheckBoxItem'
import { useTranslation } from '@/plugins/i18n'
import { getIsSupportedAutoTheme } from '@/utils/tools'
const isSupportedAutoTheme = getIsSupportedAutoTheme()
const useActive = id => {
const activeThemeId = useGetter('common', 'activeThemeId')
@ -44,9 +41,6 @@ export default memo(() => {
})
}, [setTheme])
const isAutoTheme = useGetter('common', 'isAutoTheme')
const setIsAutoTheme = useDispatch('common', 'setIsAutoTheme')
return (
<SubTitle title={t('setting_basic_theme')}>
<View style={styles.list}>
@ -54,17 +48,6 @@ export default memo(() => {
themes.map(({ id, color, image }) => <ThemeItem key={id} color={color} image={image} id={id} setTheme={setThemeId} />)
}
</View>
{
isSupportedAutoTheme
? (
<View style={{ marginTop: 25, marginLeft: -25 }}>
<CheckBoxItem check={isAutoTheme} onChange={setIsAutoTheme} label={t('setting_basic_theme_auto_theme')} />
</View>
)
: null
}
</SubTitle>
)
})

View File

@ -6,6 +6,7 @@ import Source from './Source'
import SourceName from './SourceName'
import Language from './Language'
import ShareType from './ShareType'
import IsAutoTheme from './IsAutoTheme'
import IsStartupAutoPlay from './IsStartupAutoPlay'
import { useTranslation } from '@/plugins/i18n'
@ -16,6 +17,7 @@ export default memo(() => {
return (
<Section title={t('setting_basic')}>
<Theme />
<IsAutoTheme />
<IsStartupAutoPlay />
<Source />
<Language />