feat: 添加设置项配置,优化设置屏幕的渲染逻辑

This commit is contained in:
2025-08-29 15:03:00 +08:00
parent 3ff5d7fdc3
commit bfdd1be148
3 changed files with 52 additions and 59 deletions

View File

@@ -1,67 +1,11 @@
import { View, Text } from 'react-native'
import { View } from 'react-native'
import { Settings } from '@my/ui'
import type { SettingsItemProps } from '@my/ui'
import { settings } from '@my/config'
export function SettingsScreen() {
const appName = 'flexlark'
const version = 'dev 0.0.0'
const items: SettingsItemProps[] = [
{
id: 'notification',
label: '通知',
description: '通知内有关于通知的相关设置',
type: 'group',
options: {
children: [
{
id: 'enableNotification',
label: '是否通知',
description: '开启后将收到系统通知',
type: 'switch',
options: {},
},
{
id: 'notificationContent',
label: '通知内容',
description: '设置通知的内容',
type: 'input',
options: {},
},
],
},
},
{
id: 'about',
type: 'group',
label: '关于',
options: {
children: [
{
id: 'about-flexlark',
label: `关于灵动云雀`,
description: `我们是什么?`,
type: 'link',
options: {
url: 'https://flexlark.org/',
},
},
{
id: 'about-app',
label: `关于${appName}`,
description: `当前应用正在激烈开发中`,
type: 'alert',
options: {
message: `版本号:${version}`,
},
},
],
},
},
]
return (
<View>
<Settings items={items} />
<Settings items={settings} />
</View>
)
}

View File

@@ -1 +1,2 @@
export * from './tamagui.config'
export * from './settings'

View File

@@ -0,0 +1,48 @@
import { SettingsProps } from '@my/ui'
export const settings: SettingsProps['items'] = [
{
id: 'notification',
label: '通知',
description: '通知内有关于通知的相关设置',
type: 'group',
options: {
children: [
{
id: 'enableNotification',
label: '是否通知',
description: '开启后将收到系统通知',
type: 'switch',
options: {},
},
],
},
},
{
id: 'about',
type: 'group',
label: '关于',
options: {
children: [
{
id: 'about-flexlark',
label: `关于灵动云雀`,
description: `我们是什么?`,
type: 'link',
options: {
url: 'https://flexlark.org/',
},
},
{
id: 'about-app',
label: `关于灵动云雀`,
description: `当前应用正在激烈开发中`,
type: 'alert',
options: {
message: `版本号: bate v0.0.0`,
},
},
],
},
},
]