feat: 增加了基础的设置相关内容
包括 子组件input、switch、alert、line、link、group 包括 实现 SettingStore 状态管理 (MobX) 支持持久化 包括 类型相关内容声明
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
SwitchThemeButton,
|
||||
useToastController,
|
||||
XStack,
|
||||
YStack
|
||||
YStack,
|
||||
} from '@my/ui'
|
||||
import { ChevronDown, ChevronUp } from '@tamagui/lucide-icons'
|
||||
import { useState } from 'react'
|
||||
@@ -21,9 +21,12 @@ export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) {
|
||||
const linkProps = useLink({
|
||||
href: `${linkTarget}/nate`,
|
||||
})
|
||||
const linkSettingProps = useLink({
|
||||
href: '/setting',
|
||||
})
|
||||
|
||||
return (
|
||||
<YStack flex={1} justify="center" items="center" gap="$8" p="$4" bg="$background">
|
||||
<YStack flex={1} justify="center" items="center" gap="$8" p="$4" bg="$background">
|
||||
<XStack
|
||||
position="absolute"
|
||||
width="100%"
|
||||
@@ -56,6 +59,7 @@ export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) {
|
||||
</YStack>
|
||||
|
||||
<Button {...linkProps}>Link to user</Button>
|
||||
<Button {...linkSettingProps}>Link to setting</Button>
|
||||
|
||||
<SheetDemo />
|
||||
</YStack>
|
||||
|
||||
67
packages/app/features/setting/screen.tsx
Normal file
67
packages/app/features/setting/screen.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import { View, Text } from 'react-native'
|
||||
import { Settings } from '@my/ui'
|
||||
import type { SettingsItemProps } from '@my/ui'
|
||||
|
||||
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} />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user