@mediacubeco/expo-template-fsd 2.1.3 → 2.1.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"name": "@mediacubeco/expo-template-fsd",
|
|
5
5
|
"description": "Application by Mediacube developers",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"react-native-web": "^0.21.0",
|
|
74
74
|
"react-native-worklets": "0.8.3",
|
|
75
75
|
"@mediacubeco/base": "2.1.0",
|
|
76
|
-
"@mediacubeco/base-react
|
|
77
|
-
"@mediacubeco/base-react": "2.1.0"
|
|
76
|
+
"@mediacubeco/base-react": "2.1.0",
|
|
77
|
+
"@mediacubeco/base-react-native": "2.1.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/react": "^19.2.0",
|
|
@@ -83,16 +83,16 @@
|
|
|
83
83
|
"husky": "^9.1.7",
|
|
84
84
|
"prettier": "^3.8.1",
|
|
85
85
|
"typescript": "^6.0.3",
|
|
86
|
-
"@mediacubeco/eslint-config-fsd": "2.1.0",
|
|
87
|
-
"@mediacubeco/eslint-config-react-native": "2.1.0",
|
|
88
86
|
"@mediacubeco/eslint-config": "2.1.0",
|
|
87
|
+
"@mediacubeco/eslint-config-react-native": "2.1.0",
|
|
89
88
|
"@mediacubeco/prettier-config": "2.1.0",
|
|
89
|
+
"@mediacubeco/eslint-config-fsd": "2.1.0",
|
|
90
90
|
"@mediacubeco/prettier-config-fsd": "2.1.0",
|
|
91
91
|
"@mediacubeco/eslint-config-react": "2.1.0",
|
|
92
92
|
"@mediacubeco/typescript-config": "2.1.0",
|
|
93
|
+
"@mediacubeco/typescript-config-fsd": "2.1.0",
|
|
93
94
|
"@mediacubeco/typescript-config-react": "2.1.0",
|
|
94
|
-
"@mediacubeco/typescript-config-react-native": "2.1.0"
|
|
95
|
-
"@mediacubeco/typescript-config-fsd": "2.1.0"
|
|
95
|
+
"@mediacubeco/typescript-config-react-native": "2.1.0"
|
|
96
96
|
},
|
|
97
97
|
"scripts": {
|
|
98
98
|
"postinstall": "npx husky && npx skills update",
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { Platform } from '@mediacubeco/base-react-native'
|
|
2
2
|
import * as SecureStore from 'expo-secure-store'
|
|
3
3
|
|
|
4
|
+
const localStorageFallback = {
|
|
5
|
+
state: {} as Record<string, string>,
|
|
6
|
+
getItem(key: string) {
|
|
7
|
+
return this.state[key]
|
|
8
|
+
},
|
|
9
|
+
setItem(key: string, value: string) {
|
|
10
|
+
this.state[key] = value
|
|
11
|
+
},
|
|
12
|
+
removeItem(key: string) {
|
|
13
|
+
delete this.state[key]
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const webStorage = typeof window !== 'undefined' ? localStorage : localStorageFallback
|
|
18
|
+
|
|
19
|
+
const storageModelWeb = {
|
|
20
|
+
getItem: (key: string) => Promise.resolve(webStorage.getItem(key)),
|
|
21
|
+
setItem: (key: string, value: string) => Promise.resolve(webStorage.setItem(key, value)),
|
|
22
|
+
removeItem: (key: string) => Promise.resolve(webStorage.removeItem(key)),
|
|
23
|
+
}
|
|
24
|
+
|
|
4
25
|
const storageModelNative = {
|
|
5
26
|
getItem: SecureStore.getItemAsync,
|
|
6
27
|
setItem: SecureStore.setItemAsync,
|
|
7
28
|
removeItem: SecureStore.deleteItemAsync,
|
|
8
29
|
}
|
|
9
30
|
|
|
10
|
-
const storageModelWeb = {
|
|
11
|
-
getItem: (key: string) => Promise.resolve(localStorage.getItem(key)),
|
|
12
|
-
setItem: (key: string, value: string) => Promise.resolve(localStorage.setItem(key, value)),
|
|
13
|
-
removeItem: (key: string) => Promise.resolve(localStorage.removeItem(key)),
|
|
14
|
-
}
|
|
15
|
-
|
|
16
31
|
const storageAsync = Platform.by({
|
|
17
32
|
web: storageModelWeb,
|
|
18
33
|
default: storageModelNative,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from '@mediacubeco/base-react-native'
|
|
1
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
3
|
import { Appearance, StatusBar, useColorScheme } from 'react-native'
|
|
3
4
|
import { themeStorage } from './utils'
|
|
@@ -21,15 +22,15 @@ const ThemeProvider = ({ children }: ThemeProviderProps) => {
|
|
|
21
22
|
}, [currentThemeMode])
|
|
22
23
|
|
|
23
24
|
const updateThemeModeSystem = useCallback((themeMode: ThemeMode) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if (Platform.isIos) {
|
|
26
|
+
if (!hasDarkMode) {
|
|
27
|
+
Appearance.setColorScheme('light')
|
|
28
|
+
} else if (themeMode === ThemeMode.System) {
|
|
29
|
+
Appearance.setColorScheme('unspecified')
|
|
30
|
+
} else {
|
|
31
|
+
Appearance.setColorScheme(themeMode)
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
|
-
// }
|
|
33
34
|
}, [])
|
|
34
35
|
|
|
35
36
|
useEffect(() => {
|