1- import { useState , useCallback , useEffect } from 'react' ;
2- import { ScrollView , Linking , ActivityIndicator } from 'react-native' ;
3- import { Ionicons } from '@expo/vector-icons' ;
41import {
5- Screen ,
6- PageHeader ,
7- ListItemGroup ,
8- ListItem ,
9- IdentityBadge ,
10- Text ,
2+ Avatar ,
113 Box ,
12- IconButton ,
13- TextInput ,
144 Button ,
5+ IconButton ,
6+ IdentityBadge ,
157 LinkButton ,
16- Avatar ,
8+ ListItem ,
9+ ListItemGroup ,
10+ PageHeader ,
11+ Screen ,
12+ Text ,
13+ TextInput ,
1714} from '@/components' ;
18- import { useSheet } from '@/lib/sheet' ;
15+ import { REPORT_BUG_URL , SOURCE_CODE_URL , TAB_BAR_HEIGHT } from '@/constants' ;
16+ import { useLegacyTheme } from '@/legacyTheme' ;
17+ import { confirm } from '@/lib/dialogs/alert' ;
1918import {
19+ identiconUrl ,
20+ publicKeyToString ,
21+ toBase64 ,
2022 useCurrentIdentity ,
2123 usePolycentric ,
2224 usePolycentricContext ,
2325 useUsername ,
24- publicKeyToString ,
25- identiconUrl ,
26- toBase64 ,
2726} from '@/lib/polycentric-hooks' ;
27+ import { useSheet } from '@/lib/sheet' ;
28+ import { Atoms , useTheme } from '@/theme' ;
29+ import { Ionicons } from '@expo/vector-icons' ;
2830import { types } from '@polycentric/react-native' ;
29- import { useTheme } from '@/theme' ;
30- import { TAB_BAR_HEIGHT , SOURCE_CODE_URL , REPORT_BUG_URL } from '@/constants' ;
31- import { confirm } from '@/lib/dialogs/alert' ;
31+ import { useCallback , useEffect , useState } from 'react' ;
32+ import { ActivityIndicator , Linking , ScrollView , View } from 'react-native' ;
33+
34+ function AppearanceSettingRow ( ) {
35+ const { theme, setActiveThemeName } = useTheme ( ) ;
36+ const { setLegacyThemeMode } = useLegacyTheme ( ) ;
37+
38+ const onPress = ( ) => {
39+ const next = theme . name === 'dark' ? 'light' : 'dark' ;
40+ setActiveThemeName ( next ) ;
41+ setLegacyThemeMode ( next ) ;
42+ } ;
43+
44+ return (
45+ < ListItem onPress = { onPress } >
46+ < View
47+ style = { [ Atoms . flex_row , Atoms . align_center , Atoms . gap_md , Atoms . pl_xs ] }
48+ >
49+ < Ionicons
50+ name = { theme . name === 'dark' ? 'moon' : 'sunny' }
51+ size = { 22 }
52+ style = { theme . atoms . icon_accent }
53+ />
54+ < Text variant = "body" style = { theme . atoms . text } >
55+ Theme
56+ </ Text >
57+ </ View >
58+ </ ListItem >
59+ ) ;
60+ }
3261
3362export default function Settings ( ) {
34- const { theme } = useTheme ( ) ;
63+ const { legacyTheme } = useLegacyTheme ( ) ;
3564 const { Sheet : IdentitySheet , present : presentIdentity } = useSheet ( ) ;
3665 const { Sheet : ServersSheet , present : presentServers } = useSheet ( ) ;
3766 const currentIdentity = useCurrentIdentity ( ) ;
@@ -44,7 +73,7 @@ export default function Settings() {
4473 < ScrollView
4574 showsVerticalScrollIndicator = { false }
4675 contentContainerStyle = { {
47- gap : theme . spacing . xl ,
76+ gap : legacyTheme . spacing . xl ,
4877 paddingBottom : TAB_BAR_HEIGHT + 16 ,
4978 } }
5079 >
@@ -57,6 +86,10 @@ export default function Settings() {
5786 </ >
5887 </ ListItemWrapper >
5988
89+ < ListItemGroup label = "Appearance" >
90+ < AppearanceSettingRow />
91+ </ ListItemGroup >
92+
6093 < ListItemGroup label = "Servers" >
6194 < ListItemWrapper onPress = { ( ) => presentServers ( ) } >
6295 < Text variant = "body" > Polycentric servers</ Text >
@@ -85,7 +118,7 @@ function IdentitySettingsContent({
85118} : {
86119 publicKey : types . PublicKey ;
87120} ) {
88- const { theme } = useTheme ( ) ;
121+ const { legacyTheme } = useLegacyTheme ( ) ;
89122 const client = usePolycentric ( ) ;
90123 const { identity } = useCurrentIdentity ( ) ;
91124 const username = useUsername ( publicKey ) ;
@@ -230,7 +263,7 @@ function IdentitySettingsContent({
230263 < Box
231264 style = { {
232265 height : 1 ,
233- backgroundColor : theme . colors . neutralSurfaceOpacity20 ,
266+ backgroundColor : legacyTheme . colors . neutralSurfaceOpacity20 ,
234267 } }
235268 />
236269
@@ -255,7 +288,7 @@ function ServersSheetContent() {
255288 const client = usePolycentric ( ) ;
256289 const { store } = usePolycentricContext ( ) ;
257290 const { identity } = useCurrentIdentity ( ) ;
258- const { theme } = useTheme ( ) ;
291+ const { legacyTheme } = useLegacyTheme ( ) ;
259292
260293 const [ servers , setServers ] = useState < string [ ] > ( [ ] ) ;
261294 const [ isEditing , setIsEditing ] = useState ( false ) ;
@@ -357,7 +390,7 @@ function ServersSheetContent() {
357390 < Ionicons
358391 name = "remove-circle-outline"
359392 size = { 22 }
360- color = { theme . colors . destructive }
393+ color = { legacyTheme . colors . destructive }
361394 />
362395 ) }
363396 onPress = { ( ) => handleRemoveServer ( server ) }
@@ -391,8 +424,8 @@ function ServersSheetContent() {
391424 size = { 28 }
392425 color = {
393426 newServerUrl . trim ( )
394- ? theme . colors . primary
395- : theme . colors . neutralSurface
427+ ? legacyTheme . colors . primary
428+ : legacyTheme . colors . neutralSurface
396429 }
397430 />
398431 ) }
@@ -412,7 +445,7 @@ function ListItemWrapper({
412445 children : React . ReactNode ;
413446 onPress : ( ) => void ;
414447} ) {
415- const { theme } = useTheme ( ) ;
448+ const { legacyTheme } = useLegacyTheme ( ) ;
416449
417450 return (
418451 < ListItem onPress = { onPress } >
@@ -426,7 +459,7 @@ function ListItemWrapper({
426459 < Ionicons
427460 name = "chevron-forward"
428461 size = { 18 }
429- color = { theme . colors . neutralSurface }
462+ color = { legacyTheme . colors . neutralSurface }
430463 />
431464 </ Box >
432465 </ ListItem >
0 commit comments