esoftplay 0.0.131-a → 0.0.131-b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/lib/theme.tsx +66 -71
- package/package.json +1 -1
package/modules/lib/theme.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// noPage
|
|
2
|
+
// withObject
|
|
2
3
|
import { esp } from 'esoftplay';
|
|
3
4
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
4
5
|
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
@@ -7,81 +8,75 @@ import useGlobalState from 'esoftplay/global';
|
|
|
7
8
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
8
9
|
const { colorPrimary, colorAccent } = LibStyle
|
|
9
10
|
|
|
10
|
-
const state = useGlobalState({
|
|
11
|
-
theme: 'light'
|
|
12
|
-
}, { persistKey: 'lib_theme' })
|
|
11
|
+
const state = useGlobalState({ theme: 'light' }, { persistKey: 'lib_theme' })
|
|
13
12
|
|
|
14
|
-
export default
|
|
15
|
-
|
|
16
|
-
static setTheme(themeName: string): void {
|
|
13
|
+
export default {
|
|
14
|
+
setTheme(themeName: string): void {
|
|
17
15
|
state.set({ theme: themeName })
|
|
18
16
|
LibNavigation.reset()
|
|
19
17
|
AsyncStorage.setItem('theme', themeName)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static colors(colors: string[]): string {
|
|
18
|
+
},
|
|
19
|
+
_barStyle(): string {
|
|
20
|
+
return this.colors(['dark', 'light'])
|
|
21
|
+
},
|
|
22
|
+
_colorPrimary(): string {
|
|
23
|
+
return this.colors([colorPrimary, colorPrimary])
|
|
24
|
+
},
|
|
25
|
+
_colorAccent(): string {
|
|
26
|
+
return this.colors([colorAccent, colorAccent])
|
|
27
|
+
},
|
|
28
|
+
_colorHeader(): string {
|
|
29
|
+
return this.colors(['#3E50B4', '#292B37'])
|
|
30
|
+
},
|
|
31
|
+
_colorHeaderText(): string {
|
|
32
|
+
return this.colors(['white', 'white'])
|
|
33
|
+
},
|
|
34
|
+
_colorButtonPrimary(): string {
|
|
35
|
+
return this.colors(['#3E50B4', '#3E50B4'])
|
|
36
|
+
},
|
|
37
|
+
_colorButtonTextPrimary(): string {
|
|
38
|
+
return this.colors(['white', 'white'])
|
|
39
|
+
},
|
|
40
|
+
_colorButtonSecondary(): string {
|
|
41
|
+
return this.colors(['#3E50B4', '#3E50B4'])
|
|
42
|
+
},
|
|
43
|
+
_colorButtonTextSecondary(): string {
|
|
44
|
+
return this.colors(['white', 'white'])
|
|
45
|
+
},
|
|
46
|
+
_colorButtonTertiary(): string {
|
|
47
|
+
return this.colors(['#3E50B4', '#3E50B4'])
|
|
48
|
+
},
|
|
49
|
+
_colorButtonTextTertiary(): string {
|
|
50
|
+
return this.colors(['white', 'white'])
|
|
51
|
+
},
|
|
52
|
+
_colorBackgroundPrimary(): string {
|
|
53
|
+
return this.colors(['white', '#202529'])
|
|
54
|
+
},
|
|
55
|
+
_colorBackgroundSecondary(): string {
|
|
56
|
+
return this.colors(['white', '#202529'])
|
|
57
|
+
},
|
|
58
|
+
_colorBackgroundTertiary(): string {
|
|
59
|
+
return this.colors(['white', '#202529'])
|
|
60
|
+
},
|
|
61
|
+
_colorBackgroundCardPrimary(): string {
|
|
62
|
+
return this.colors(['white', '#2B2F38'])
|
|
63
|
+
},
|
|
64
|
+
_colorBackgroundCardSecondary(): string {
|
|
65
|
+
return this.colors(['white', '#2B2F38'])
|
|
66
|
+
},
|
|
67
|
+
_colorBackgroundCardTertiary(): string {
|
|
68
|
+
return this.colors(['white', '#2B2F38'])
|
|
69
|
+
},
|
|
70
|
+
_colorTextPrimary(): string {
|
|
71
|
+
return this.colors(['#353535', 'white'])
|
|
72
|
+
},
|
|
73
|
+
_colorTextSecondary(): string {
|
|
74
|
+
return this.colors(['#666666', 'white'])
|
|
75
|
+
},
|
|
76
|
+
_colorTextTertiary(): string {
|
|
77
|
+
return this.colors(['#999999', 'white'])
|
|
78
|
+
},
|
|
79
|
+
colors(colors: string[]): string {
|
|
85
80
|
const _themeName = state.get().theme
|
|
86
81
|
const _themes: string[] = esp.config('theme');
|
|
87
82
|
const _themeIndex = _themes.indexOf(_themeName);
|