@zezosoft/zezo-ott-react-native-ui-kit 1.1.5 → 1.1.7
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/lib/module/components/Content/Card/Sliders/Styles/Three.js +5 -4
- package/lib/module/components/Content/Card/Sliders/Styles/Three.js.map +1 -1
- package/lib/module/components/Headers/Four.js +1 -1
- package/lib/module/components/Headers/Three.js +2 -1
- package/lib/module/components/Headers/Three.js.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/Three.d.ts.map +1 -1
- package/package.json +2 -14
- package/src/Styles/globalStyles.ts +0 -70
- package/src/assets/animations/135037-payment-processing-error.json +0 -1347
- package/src/assets/animations/7227-vui-animation.json +0 -3377
- package/src/assets/animations/Failed.json +0 -2103
- package/src/assets/animations/Pending.json +0 -522
- package/src/assets/animations/Successful.json +0 -2289
- package/src/assets/animations/heart.json +0 -788
- package/src/assets/animations/succesfull-payment.json +0 -2379
- package/src/assets/animations/voice-icon.json +0 -542
- package/src/assets/img/back.png +0 -0
- package/src/assets/img/bottom-panel.png +0 -0
- package/src/assets/img/camera.png +0 -0
- package/src/assets/img/camera2.png +0 -0
- package/src/assets/img/home.png +0 -0
- package/src/assets/img/lock.png +0 -0
- package/src/assets/img/play.png +0 -0
- package/src/assets/img/profile.jpg +0 -0
- package/src/assets/img/qr-code.png +0 -0
- package/src/assets/img/shadow.png +0 -0
- package/src/assets/img/shadow2.png +0 -0
- package/src/assets/img/user.png +0 -0
- package/src/assets/svg/Account.svg +0 -4
- package/src/assets/svg/Favourite.svg +0 -14
- package/src/assets/svg/Upcoming.svg +0 -4
- package/src/assets/svg/content-error.svg +0 -28
- package/src/assets/svg/download.svg +0 -3
- package/src/assets/svg/eye-off.svg +0 -10
- package/src/assets/svg/favorites.svg +0 -3
- package/src/assets/svg/h.svg +0 -4
- package/src/assets/svg/home.svg +0 -5
- package/src/assets/svg/home1.svg +0 -3
- package/src/assets/svg/menu-bar.svg +0 -4
- package/src/assets/svg/my-space.svg +0 -14
- package/src/assets/svg/play-icon-with-bg.svg +0 -5
- package/src/assets/svg/profile.svg +0 -4
- package/src/assets/svg/search.svg +0 -5
- package/src/assets/svg/search1.svg +0 -4
- package/src/assets/svg/server-error.svg +0 -139
- package/src/components/Account/Account.tsx +0 -367
- package/src/components/Account/index.ts +0 -1
- package/src/components/Alert/AlertDialog.tsx +0 -247
- package/src/components/Alert/UAAlert.tsx +0 -170
- package/src/components/Alert/index.ts +0 -2
- package/src/components/Auth/AuthProvider/AuthProvider.tsx +0 -419
- package/src/components/Auth/One/ForgotPassword/ForgotPassword.tsx +0 -324
- package/src/components/Auth/One/Login/LoginWithEmail.tsx +0 -455
- package/src/components/Auth/One/Login/LoginWithPhone.tsx +0 -306
- package/src/components/Auth/One/OTP/OTP.tsx +0 -465
- package/src/components/Auth/One/QrLogin/QrLogin.tsx +0 -602
- package/src/components/Auth/One/QrLogin/components/QrViewArea.tsx +0 -423
- package/src/components/Auth/One/SignUp/SignUp.tsx +0 -479
- package/src/components/Auth/One/SplashScreen/SplashScreen.tsx +0 -249
- package/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.tsx +0 -103
- package/src/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -77
- package/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -174
- package/src/components/Auth/One/index.ts +0 -24
- package/src/components/Auth/Two/AuthHeader/AuthHeader.tsx +0 -108
- package/src/components/Auth/Two/ForgotPassword/ForgotPassword.tsx +0 -335
- package/src/components/Auth/Two/Login/AuthLoginShell.tsx +0 -173
- package/src/components/Auth/Two/Login/LoginWithEmail.tsx +0 -279
- package/src/components/Auth/Two/Login/LoginWithPhone.tsx +0 -188
- package/src/components/Auth/Two/OTP/OTP.tsx +0 -465
- package/src/components/Auth/Two/QrLogin/QrLogin.tsx +0 -602
- package/src/components/Auth/Two/QrLogin/components/QrViewArea.tsx +0 -423
- package/src/components/Auth/Two/SignUp/SignUp.tsx +0 -472
- package/src/components/Auth/Two/SplashScreen/SplashScreen.tsx +0 -248
- package/src/components/Auth/Two/SplashScreen/components/SplashImage/SplashImage.tsx +0 -92
- package/src/components/Auth/Two/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -77
- package/src/components/Auth/Two/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -178
- package/src/components/Auth/Two/index.ts +0 -28
- package/src/components/Auth/index.ts +0 -11
- package/src/components/BackgroundLayout/BackgroundLayout.tsx +0 -174
- package/src/components/BackgroundLayout/BackgroundLayoutOne.tsx +0 -56
- package/src/components/BlogView/BlogView.tsx +0 -276
- package/src/components/BlogView/index.ts +0 -8
- package/src/components/BlurView/BlurView.tsx +0 -199
- package/src/components/BlurView/index.ts +0 -7
- package/src/components/BottomSheet/BottomSheet.tsx +0 -200
- package/src/components/BottomSheet/BottomSheetOne.tsx +0 -220
- package/src/components/BottomSheet/index.ts +0 -4
- package/src/components/Button/BackBtn.tsx +0 -168
- package/src/components/Button/MenuBtn.tsx +0 -229
- package/src/components/Button/PrimaryBtn.tsx +0 -134
- package/src/components/Button/SecondaryBtn.tsx +0 -132
- package/src/components/Button/TextButton.tsx +0 -145
- package/src/components/Button/index.ts +0 -18
- package/src/components/Content/Card/Category/Category.tsx +0 -436
- package/src/components/Content/Card/Category/CategroyTwo.tsx +0 -429
- package/src/components/Content/Card/NowWatching/NowWatching.tsx +0 -624
- package/src/components/Content/Card/Sliders/Styles/One.tsx +0 -490
- package/src/components/Content/Card/Sliders/Styles/Three.tsx +0 -935
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +0 -391
- package/src/components/Content/Card/Sliders/index.ts +0 -17
- package/src/components/Content/Card/Styles/Five.tsx +0 -385
- package/src/components/Content/Card/Styles/Four.tsx +0 -379
- package/src/components/Content/Card/Styles/One.tsx +0 -386
- package/src/components/Content/Card/Styles/RotateInOut.tsx +0 -413
- package/src/components/Content/Card/Styles/Six.tsx +0 -392
- package/src/components/Content/Card/Styles/Three.tsx +0 -314
- package/src/components/Content/Card/Styles/TopTen.tsx +0 -412
- package/src/components/Content/Card/Styles/Two.tsx +0 -416
- package/src/components/Content/Card/components/AdsPoster.tsx +0 -202
- package/src/components/Content/Card/components/CardPoster.tsx +0 -377
- package/src/components/Content/Card/components/NavigateToMore.tsx +0 -97
- package/src/components/Content/Card/components/RentOrBuyIcon.tsx +0 -129
- package/src/components/Content/Card/components/ShowAllButton.tsx +0 -92
- package/src/components/Content/Card/components/ThumbnailCard.tsx +0 -234
- package/src/components/Content/Card/components/index.ts +0 -1
- package/src/components/Content/Card/index.ts +0 -30
- package/src/components/Content/Content.tsx +0 -315
- package/src/components/Content/Sections.tsx +0 -238
- package/src/components/Content/types.ts +0 -176
- package/src/components/ContentView/MoreContentList.tsx +0 -327
- package/src/components/ContentView/One/ContentViewOne.tsx +0 -243
- package/src/components/ContentView/One/components/AboutSection.tsx +0 -216
- package/src/components/ContentView/One/components/CastCard.tsx +0 -265
- package/src/components/ContentView/One/components/EpisodeCard.tsx +0 -535
- package/src/components/ContentView/One/components/GenreTags.tsx +0 -132
- package/src/components/ContentView/One/components/HeroBanner.tsx +0 -357
- package/src/components/ContentView/One/components/MiniInfo.tsx +0 -356
- package/src/components/ContentView/One/components/PlayButton.tsx +0 -56
- package/src/components/ContentView/One/components/Title.tsx +0 -149
- package/src/components/ContentView/One/components/TrailerButton.tsx +0 -76
- package/src/components/ContentView/Two/ContentViewTwo.tsx +0 -343
- package/src/components/ContentView/Two/components/AboutSection.tsx +0 -216
- package/src/components/ContentView/Two/components/Details.tsx +0 -193
- package/src/components/ContentView/Two/components/EpisodeCard.tsx +0 -602
- package/src/components/ContentView/Two/components/GenreTags.tsx +0 -123
- package/src/components/ContentView/Two/components/HeroBanner.tsx +0 -402
- package/src/components/ContentView/Two/components/LikeShareActions.tsx +0 -125
- package/src/components/ContentView/Two/components/MoreLikeThisContentList .tsx +0 -305
- package/src/components/ContentView/Two/components/PlayOrTrailer.tsx +0 -133
- package/src/components/ContentView/Two/components/SectionTabs.tsx +0 -177
- package/src/components/ContentView/Two/components/Title.tsx +0 -226
- package/src/components/ContentView/Two/components/index.ts +0 -15
- package/src/components/ContentView/index.ts +0 -13
- package/src/components/Fallbacks/NoContentFallback.tsx +0 -176
- package/src/components/Fallbacks/NotFoundFallback.tsx +0 -94
- package/src/components/Fallbacks/index.ts +0 -2
- package/src/components/Headers/AppHeader.tsx +0 -150
- package/src/components/Headers/Four.tsx +0 -83
- package/src/components/Headers/One.tsx +0 -115
- package/src/components/Headers/Three.tsx +0 -135
- package/src/components/Headers/Two.tsx +0 -100
- package/src/components/Headers/index.ts +0 -18
- package/src/components/Input/Input.ts +0 -20
- package/src/components/Input/InputOne.tsx +0 -259
- package/src/components/Input/InputThree.tsx +0 -212
- package/src/components/Input/InputTwo.tsx +0 -212
- package/src/components/Input/PhoneNumberInput.tsx +0 -431
- package/src/components/Input/PhoneNumberInputTwo.tsx +0 -418
- package/src/components/Keyboard/HideKeyboard.tsx +0 -88
- package/src/components/Loader/Loader.tsx +0 -44
- package/src/components/Logo/Logo.tsx +0 -145
- package/src/components/NewRelease/NewReleaseSheet.tsx +0 -250
- package/src/components/NewRelease/index.ts +0 -1
- package/src/components/Reels/ReelsSeries/MediaControls/BottomControls.tsx +0 -221
- package/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.tsx +0 -314
- package/src/components/Reels/ReelsSeries/MediaControls/MiddleControls.tsx +0 -196
- package/src/components/Reels/ReelsSeries/MediaControls/RightControls.tsx +0 -95
- package/src/components/Reels/ReelsSeries/MediaControls/TopControls.tsx +0 -163
- package/src/components/Reels/ReelsSeries/Model/DetailsModal.tsx +0 -210
- package/src/components/Reels/ReelsSeries/Model/SettingModal.tsx +0 -146
- package/src/components/Reels/ReelsSeries/Model/UnlockModal.tsx +0 -154
- package/src/components/Reels/ReelsSeries/ReelsSeries.tsx +0 -264
- package/src/components/Reels/ReelsSeries/ReelsSeriesItem.tsx +0 -494
- package/src/components/Reels/ReelsSeries/components/AnimatedThreeLines.tsx +0 -184
- package/src/components/Reels/ReelsSeries/components/Episodes.tsx +0 -154
- package/src/components/Reels/ReelsSeries/components/GradientOverlay.tsx +0 -41
- package/src/components/Reels/ReelsSeries/components/Like.tsx +0 -40
- package/src/components/Reels/ReelsSeries/components/RotatingLoader.tsx +0 -79
- package/src/components/Reels/ReelsSeries/components/Synopsis.tsx +0 -332
- package/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.tsx +0 -187
- package/src/components/Reels/ReelsSeries/components/VideoControls/SpeedControl.tsx +0 -80
- package/src/components/Reels/ReelsSeries/components/VideoControls/index.ts +0 -2
- package/src/components/Reels/ReelsSeries/types.ts +0 -54
- package/src/components/Reels/ReelsSeries/useReelsWatchProgress.ts +0 -85
- package/src/components/Reels/ReelsSeries/utils/quality.ts +0 -48
- package/src/components/Reels/index.ts +0 -9
- package/src/components/Reels/utils/Controls/gestureUtils.ts +0 -42
- package/src/components/Reels/utils/Controls/index.ts +0 -4
- package/src/components/Reels/utils/Controls/overlayUtils.ts +0 -35
- package/src/components/Reels/utils/Controls/videoControlsConstants.ts +0 -25
- package/src/components/Reels/utils/Controls/videoRef.ts +0 -4
- package/src/components/Reels/utils/index.ts +0 -1
- package/src/components/Reels/utils/timeoutUtils.ts +0 -29
- package/src/components/Search/One.tsx +0 -256
- package/src/components/Search/components/RecentSearchesSection.tsx +0 -181
- package/src/components/Search/components/SearchCard.tsx +0 -275
- package/src/components/Search/index.ts +0 -16
- package/src/components/Settings/AppSettings.tsx +0 -428
- package/src/components/Settings/index.ts +0 -1
- package/src/components/Subscription/SubOne.tsx +0 -874
- package/src/components/Subscription/index.ts +0 -12
- package/src/components/TabBar/One.tsx +0 -148
- package/src/components/TabBar/Three.tsx +0 -169
- package/src/components/TabBar/Two.tsx +0 -189
- package/src/components/TabBar/index.ts +0 -20
- package/src/components/Text/Text.tsx +0 -85
- package/src/components/Text/index.ts +0 -5
- package/src/components/User/DeviceSessions/DeviceSessions.tsx +0 -468
- package/src/components/User/ProfileUpdate/ProfileUpdate.tsx +0 -278
- package/src/components/User/PurchaseHistory/PurchaseHistory.tsx +0 -494
- package/src/components/User/WatchHistory/WatchHistory.tsx +0 -227
- package/src/components/User/WatchLater/WatchLater.tsx +0 -397
- package/src/components/User/components/UserAvatar.tsx +0 -120
- package/src/components/User/components/UserSection.tsx +0 -228
- package/src/components/User/index.ts +0 -18
- package/src/components/View/View.tsx +0 -37
- package/src/components/View/index.ts +0 -5
- package/src/components/common/AppStatusBar.tsx +0 -57
- package/src/components/index.ts +0 -29
- package/src/components/layout/SafeAreaWrapper.tsx +0 -45
- package/src/components/layout/index.ts +0 -1
- package/src/constants/dummySections.ts +0 -98
- package/src/hooks/Images/index.ts +0 -2
- package/src/hooks/Images/useImageLoader.ts +0 -206
- package/src/hooks/Images/useImageValidation.ts +0 -36
- package/src/hooks/index.ts +0 -17
- package/src/hooks/useAdTracking.ts +0 -349
- package/src/hooks/useCards.ts +0 -228
- package/src/hooks/useDebounce.ts +0 -35
- package/src/hooks/useKeyboard.ts +0 -43
- package/src/hooks/useNavigationMode.ts +0 -46
- package/src/hooks/usePaginatedSection.ts +0 -101
- package/src/hooks/usePrevious.ts +0 -28
- package/src/hooks/useSafeCallback.ts +0 -43
- package/src/hooks/useSkeletonItems.ts +0 -30
- package/src/hooks/useSplashCache.ts +0 -186
- package/src/hooks/useThemeColors.ts +0 -51
- package/src/index.tsx +0 -8
- package/src/store/RecentSearchesStore.ts +0 -78
- package/src/store/splashStore.ts +0 -91
- package/src/store/themeStore.ts +0 -43
- package/src/theme/ThemeProvider.tsx +0 -112
- package/src/theme/hook/index.ts +0 -1
- package/src/theme/hook/useInternalTheme.ts +0 -98
- package/src/theme/index.ts +0 -7
- package/src/theme/themes.ts +0 -336
- package/src/theme/utils/validateColor.ts +0 -127
- package/src/types/content/content-view.types.ts +0 -206
- package/src/types/hook/index.ts +0 -5
- package/src/types/hook/usePaginatedSetion.ts +0 -19
- package/src/types/index.ts +0 -7
- package/src/types/sections/index.ts +0 -84
- package/src/utils/Display.ts +0 -14
- package/src/utils/Formater.ts +0 -14
- package/src/utils/PlatformSelector.ts +0 -29
- package/src/utils/SizeMatters.ts +0 -7
- package/src/utils/Spacing.ts +0 -27
- package/src/utils/colorUtils.ts +0 -70
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh
|
|
3
|
-
* @lastModified Fri 17 Oct 2025 at 09:55 PM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useEffect, useRef, useState } from 'react';
|
|
7
|
-
import RNFS from 'react-native-fs';
|
|
8
|
-
import CryptoJS from 'crypto-js';
|
|
9
|
-
import { MMKV } from 'react-native-mmkv';
|
|
10
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
11
|
-
import { useSplashStore } from '../store/splashStore';
|
|
12
|
-
|
|
13
|
-
const mmkvStorage = new MMKV();
|
|
14
|
-
const activeDownloadTasks = new Map<string, Promise<string | null>>();
|
|
15
|
-
const DEFAULT_EXTENSION = 'bin';
|
|
16
|
-
const CACHE_FILE_PREFIX = 'splash_';
|
|
17
|
-
|
|
18
|
-
const isNetworkOnline = async () => {
|
|
19
|
-
const state = await NetInfo.fetch();
|
|
20
|
-
return !!state.isConnected;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const getUrlExtension = (url: string): string => {
|
|
24
|
-
try {
|
|
25
|
-
if (!url || typeof url !== 'string') return DEFAULT_EXTENSION;
|
|
26
|
-
const cleanUrl = url.split('?')[0];
|
|
27
|
-
const dot = cleanUrl?.lastIndexOf('.') ?? -1;
|
|
28
|
-
if (dot === -1) return DEFAULT_EXTENSION;
|
|
29
|
-
|
|
30
|
-
const ext = cleanUrl?.substring(dot + 1).toLowerCase() ?? DEFAULT_EXTENSION;
|
|
31
|
-
if (!/^[a-z0-9]+$/i.test(ext)) return DEFAULT_EXTENSION;
|
|
32
|
-
return ext;
|
|
33
|
-
} catch {
|
|
34
|
-
return DEFAULT_EXTENSION;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const buildCachePath = (url: string, cacheKey: string, extension: string) => {
|
|
39
|
-
const ext = extension.replace(/^\./, '') || DEFAULT_EXTENSION;
|
|
40
|
-
const hash = CryptoJS.MD5(`${url}|${cacheKey}|${ext}`).toString();
|
|
41
|
-
return `${RNFS.CachesDirectoryPath}/${CACHE_FILE_PREFIX}${hash}.${ext}`;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const downloadAndCacheFile = async (
|
|
45
|
-
url: string,
|
|
46
|
-
extension: string,
|
|
47
|
-
cacheKey: string,
|
|
48
|
-
force: boolean
|
|
49
|
-
): Promise<string | null> => {
|
|
50
|
-
if (!url?.trim()) return null;
|
|
51
|
-
|
|
52
|
-
const localFile = buildCachePath(url, cacheKey, extension);
|
|
53
|
-
|
|
54
|
-
if (activeDownloadTasks.has(localFile)) {
|
|
55
|
-
return activeDownloadTasks.get(localFile)!;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const task = (async () => {
|
|
59
|
-
let oldFile: string | null = null;
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const savedPath = mmkvStorage.getString(cacheKey);
|
|
63
|
-
oldFile = savedPath && savedPath !== localFile ? savedPath : null;
|
|
64
|
-
|
|
65
|
-
if (!force && savedPath === localFile) {
|
|
66
|
-
const exists = await RNFS.exists(localFile);
|
|
67
|
-
if (exists) return localFile;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!(await isNetworkOnline())) {
|
|
71
|
-
return oldFile && (await RNFS.exists(oldFile)) ? oldFile : null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const result = await RNFS.downloadFile({
|
|
75
|
-
fromUrl: url,
|
|
76
|
-
toFile: localFile,
|
|
77
|
-
cacheable: true,
|
|
78
|
-
readTimeout: 15000,
|
|
79
|
-
connectionTimeout: 10000,
|
|
80
|
-
}).promise.catch(() => null);
|
|
81
|
-
|
|
82
|
-
if (!result || result.statusCode !== 200) {
|
|
83
|
-
const code = result?.statusCode ?? 'unknown';
|
|
84
|
-
throw new Error(`RNFS download failed (status: ${code})`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
mmkvStorage.set(cacheKey, localFile);
|
|
88
|
-
|
|
89
|
-
if (oldFile && (await RNFS.exists(oldFile))) {
|
|
90
|
-
await RNFS.unlink(oldFile).catch(() => {});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return localFile;
|
|
94
|
-
} catch (err) {
|
|
95
|
-
console.warn('[SplashCache] download failed:', url, err);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (oldFile && (await RNFS.exists(oldFile))) {
|
|
99
|
-
return oldFile;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return null;
|
|
103
|
-
})().finally(() => {
|
|
104
|
-
activeDownloadTasks.delete(localFile);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
activeDownloadTasks.set(localFile, task);
|
|
108
|
-
return task;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
type SplashCacheOptions = {
|
|
112
|
-
logoUrl?: string;
|
|
113
|
-
backgroundUrl?: string;
|
|
114
|
-
forceDownload?: boolean;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export const useSplashCache = ({
|
|
118
|
-
logoUrl,
|
|
119
|
-
backgroundUrl,
|
|
120
|
-
forceDownload = false,
|
|
121
|
-
}: SplashCacheOptions) => {
|
|
122
|
-
const [loadState, setLoadState] = useState({
|
|
123
|
-
isReady: false,
|
|
124
|
-
error: null as Error | null,
|
|
125
|
-
});
|
|
126
|
-
const setLogoPath = useSplashStore((s) => s.setLogoPath);
|
|
127
|
-
const setBackdropPath = useSplashStore((s) => s.setBackdropPath);
|
|
128
|
-
const isMountedRef = useRef(true);
|
|
129
|
-
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
isMountedRef.current = true;
|
|
132
|
-
|
|
133
|
-
const syncAssets = async () => {
|
|
134
|
-
try {
|
|
135
|
-
const [logoLocalPath, backdropLocalPath] = await Promise.all([
|
|
136
|
-
logoUrl
|
|
137
|
-
? downloadAndCacheFile(
|
|
138
|
-
logoUrl,
|
|
139
|
-
getUrlExtension(logoUrl),
|
|
140
|
-
'splash_logo',
|
|
141
|
-
forceDownload
|
|
142
|
-
)
|
|
143
|
-
: Promise.resolve(null),
|
|
144
|
-
backgroundUrl
|
|
145
|
-
? downloadAndCacheFile(
|
|
146
|
-
backgroundUrl,
|
|
147
|
-
getUrlExtension(backgroundUrl),
|
|
148
|
-
'splash_background',
|
|
149
|
-
forceDownload
|
|
150
|
-
)
|
|
151
|
-
: Promise.resolve(null),
|
|
152
|
-
]);
|
|
153
|
-
|
|
154
|
-
if (!isMountedRef.current) return;
|
|
155
|
-
|
|
156
|
-
if (logoLocalPath) setLogoPath?.(logoLocalPath);
|
|
157
|
-
if (backdropLocalPath) setBackdropPath?.(backdropLocalPath);
|
|
158
|
-
|
|
159
|
-
setLoadState({ isReady: true, error: null });
|
|
160
|
-
} catch (err) {
|
|
161
|
-
if (!isMountedRef.current) return;
|
|
162
|
-
const error =
|
|
163
|
-
err instanceof Error ? err : new Error('Splash cache failed');
|
|
164
|
-
setLoadState({ isReady: true, error });
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
syncAssets();
|
|
169
|
-
|
|
170
|
-
return () => {
|
|
171
|
-
isMountedRef.current = false;
|
|
172
|
-
};
|
|
173
|
-
}, [logoUrl, backgroundUrl, forceDownload, setLogoPath, setBackdropPath]);
|
|
174
|
-
|
|
175
|
-
const logoLocalPath = useSplashStore((s) => s.logo.localPath);
|
|
176
|
-
const backdropLocalPath = useSplashStore((s) => s.backdrop.localPath);
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
state: loadState,
|
|
180
|
-
isLoading: !loadState.isReady,
|
|
181
|
-
data: {
|
|
182
|
-
logoPath: logoLocalPath,
|
|
183
|
-
backgroundPath: backdropLocalPath,
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Optimized for performance
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useMemo } from 'react';
|
|
7
|
-
import type { ITheme } from '../theme/themes';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Hook to extract and memoize theme colors
|
|
11
|
-
* Reduces repeated color extraction patterns
|
|
12
|
-
*/
|
|
13
|
-
export function useThemeColors(theme: ITheme) {
|
|
14
|
-
const colors = theme.colors;
|
|
15
|
-
return useMemo(
|
|
16
|
-
() => ({
|
|
17
|
-
textPrimary: colors.textPrimary,
|
|
18
|
-
textSecondary: colors.textSecondary,
|
|
19
|
-
background: colors.background,
|
|
20
|
-
surface: colors.surface,
|
|
21
|
-
surfaceVariant: colors.surfaceVariant,
|
|
22
|
-
primary: colors.primary,
|
|
23
|
-
error: colors.error,
|
|
24
|
-
errorContainer: colors.errorContainer,
|
|
25
|
-
skeletonBaseColor: colors.skeletonBaseColor,
|
|
26
|
-
skeletonHighlightColor: colors.skeletonHighlightColor,
|
|
27
|
-
border: colors.border,
|
|
28
|
-
onBackground: colors.onBackground,
|
|
29
|
-
onPrimary: colors.onPrimary,
|
|
30
|
-
onSurface: colors.onSurface,
|
|
31
|
-
outline: colors.outline,
|
|
32
|
-
}),
|
|
33
|
-
[
|
|
34
|
-
colors.textPrimary,
|
|
35
|
-
colors.textSecondary,
|
|
36
|
-
colors.background,
|
|
37
|
-
colors.surface,
|
|
38
|
-
colors.surfaceVariant,
|
|
39
|
-
colors.primary,
|
|
40
|
-
colors.error,
|
|
41
|
-
colors.errorContainer,
|
|
42
|
-
colors.skeletonBaseColor,
|
|
43
|
-
colors.skeletonHighlightColor,
|
|
44
|
-
colors.border,
|
|
45
|
-
colors.onBackground,
|
|
46
|
-
colors.onPrimary,
|
|
47
|
-
colors.onSurface,
|
|
48
|
-
colors.outline,
|
|
49
|
-
]
|
|
50
|
-
);
|
|
51
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Thu 04 Jul 2025 at 07:30 PM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
-
import { MMKV } from 'react-native-mmkv';
|
|
9
|
-
|
|
10
|
-
const mmkv = new MMKV();
|
|
11
|
-
|
|
12
|
-
// Define store state type
|
|
13
|
-
type RecentSearchesState = {
|
|
14
|
-
recentSearches: string[];
|
|
15
|
-
pillMaxCount: number;
|
|
16
|
-
isLoading: boolean;
|
|
17
|
-
addSearchTerm: (term: string, limit?: number) => void;
|
|
18
|
-
removeSearchTerm: (term: string) => void;
|
|
19
|
-
clearSearches: () => void;
|
|
20
|
-
setPillMaxCount: (count: number) => void;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const useRecentSearchesStore = create<RecentSearchesState>()(
|
|
24
|
-
persist(
|
|
25
|
-
(set, get) => ({
|
|
26
|
-
recentSearches: [],
|
|
27
|
-
pillMaxCount: 20,
|
|
28
|
-
isLoading: true,
|
|
29
|
-
|
|
30
|
-
addSearchTerm: (term, limit) => {
|
|
31
|
-
const trimmed = term.trim();
|
|
32
|
-
if (!trimmed) return;
|
|
33
|
-
|
|
34
|
-
const maxCount = limit ?? get().pillMaxCount;
|
|
35
|
-
const current = get().recentSearches;
|
|
36
|
-
const updated = [
|
|
37
|
-
trimmed,
|
|
38
|
-
...current.filter((t) => t !== trimmed),
|
|
39
|
-
].slice(0, maxCount);
|
|
40
|
-
set({ recentSearches: updated });
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
removeSearchTerm: (term) =>
|
|
44
|
-
set((state) => ({
|
|
45
|
-
recentSearches: state.recentSearches.filter((t) => t !== term),
|
|
46
|
-
})),
|
|
47
|
-
|
|
48
|
-
clearSearches: () => set({ recentSearches: [] }),
|
|
49
|
-
|
|
50
|
-
setPillMaxCount: (count) => set({ pillMaxCount: count }),
|
|
51
|
-
}),
|
|
52
|
-
{
|
|
53
|
-
name: 'recent-searches-storage',
|
|
54
|
-
storage: createJSONStorage(() => ({
|
|
55
|
-
getItem: (name) => mmkv.getString(name) ?? null,
|
|
56
|
-
setItem: (name, value) => mmkv.set(name, value),
|
|
57
|
-
removeItem: (name) => mmkv.delete(name),
|
|
58
|
-
})),
|
|
59
|
-
partialize: (state) => ({
|
|
60
|
-
recentSearches: state.recentSearches,
|
|
61
|
-
pillMaxCount: state.pillMaxCount,
|
|
62
|
-
}),
|
|
63
|
-
onRehydrateStorage: () => (state) => {
|
|
64
|
-
const hasData =
|
|
65
|
-
(state?.recentSearches?.length ?? 0) > 0 ||
|
|
66
|
-
(state?.pillMaxCount ?? 20) !== 20;
|
|
67
|
-
|
|
68
|
-
if (hasData) {
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
useRecentSearchesStore.setState({ isLoading: false });
|
|
71
|
-
}, 50);
|
|
72
|
-
} else {
|
|
73
|
-
useRecentSearchesStore.setState({ isLoading: false });
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
);
|
package/src/store/splashStore.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Thu 12 Jun 2025 at 07:57 PM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
-
import { MMKV } from 'react-native-mmkv';
|
|
9
|
-
|
|
10
|
-
const mmkv = new MMKV();
|
|
11
|
-
|
|
12
|
-
interface ImageState {
|
|
13
|
-
localPath: string | null;
|
|
14
|
-
lastUpdated: number | null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type SplashState = {
|
|
18
|
-
logo: ImageState;
|
|
19
|
-
backdrop: ImageState;
|
|
20
|
-
setLogoPath: (path: string | null) => void;
|
|
21
|
-
clearLogoPath: () => void;
|
|
22
|
-
setBackdropPath: (path: string | null) => void;
|
|
23
|
-
clearBackdropPath: () => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const useSplashStore = create<SplashState>()(
|
|
27
|
-
persist(
|
|
28
|
-
(set) => ({
|
|
29
|
-
logo: {
|
|
30
|
-
localPath: null,
|
|
31
|
-
lastUpdated: null,
|
|
32
|
-
},
|
|
33
|
-
backdrop: {
|
|
34
|
-
localPath: null,
|
|
35
|
-
lastUpdated: null,
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
setLogoPath: (path) =>
|
|
39
|
-
set((state) => ({
|
|
40
|
-
logo: {
|
|
41
|
-
...state.logo,
|
|
42
|
-
localPath: path,
|
|
43
|
-
lastUpdated: Date.now(),
|
|
44
|
-
},
|
|
45
|
-
})),
|
|
46
|
-
|
|
47
|
-
clearLogoPath: () =>
|
|
48
|
-
set(() => ({
|
|
49
|
-
logo: {
|
|
50
|
-
localPath: null,
|
|
51
|
-
lastUpdated: null,
|
|
52
|
-
},
|
|
53
|
-
})),
|
|
54
|
-
|
|
55
|
-
setBackdropPath: (path) =>
|
|
56
|
-
set((state) => ({
|
|
57
|
-
backdrop: {
|
|
58
|
-
...state.backdrop,
|
|
59
|
-
localPath: path,
|
|
60
|
-
lastUpdated: Date.now(),
|
|
61
|
-
},
|
|
62
|
-
})),
|
|
63
|
-
|
|
64
|
-
clearBackdropPath: () =>
|
|
65
|
-
set(() => ({
|
|
66
|
-
backdrop: {
|
|
67
|
-
localPath: null,
|
|
68
|
-
lastUpdated: null,
|
|
69
|
-
},
|
|
70
|
-
})),
|
|
71
|
-
}),
|
|
72
|
-
{
|
|
73
|
-
name: 'splash-storage',
|
|
74
|
-
storage: createJSONStorage(() => ({
|
|
75
|
-
getItem: (name) => mmkv.getString(name) || null,
|
|
76
|
-
setItem: (name, value) => mmkv.set(name, value),
|
|
77
|
-
removeItem: (name) => mmkv.delete(name),
|
|
78
|
-
})),
|
|
79
|
-
partialize: (state) => ({
|
|
80
|
-
logo: {
|
|
81
|
-
localPath: state.logo.localPath,
|
|
82
|
-
lastUpdated: state.logo.lastUpdated,
|
|
83
|
-
},
|
|
84
|
-
backdrop: {
|
|
85
|
-
localPath: state.backdrop.localPath,
|
|
86
|
-
lastUpdated: state.backdrop.lastUpdated,
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
);
|
package/src/store/themeStore.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Thu 12 Jun 2025 at 07:57 PM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
-
import { MMKV } from 'react-native-mmkv';
|
|
9
|
-
|
|
10
|
-
const storage = new MMKV();
|
|
11
|
-
|
|
12
|
-
interface ThemeState {
|
|
13
|
-
isDarkMode: boolean;
|
|
14
|
-
themeMode: 'dark' | 'light' | 'system';
|
|
15
|
-
setIsDarkMode: (value: boolean) => void;
|
|
16
|
-
setTheme: (mode: 'dark' | 'light' | 'system') => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const useInternalThemeStore = create(
|
|
20
|
-
persist<ThemeState>(
|
|
21
|
-
(set, _get) => ({
|
|
22
|
-
isDarkMode: false,
|
|
23
|
-
themeMode: 'system',
|
|
24
|
-
|
|
25
|
-
setIsDarkMode: (value: boolean) => {
|
|
26
|
-
const mode = value ? 'dark' : 'light';
|
|
27
|
-
set({ isDarkMode: value, themeMode: mode });
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
setTheme: (mode: 'dark' | 'light' | 'system') => {
|
|
31
|
-
set({ themeMode: mode, isDarkMode: mode === 'dark' });
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
{
|
|
35
|
-
name: 'theme-storage',
|
|
36
|
-
storage: createJSONStorage(() => ({
|
|
37
|
-
getItem: (key: string) => storage.getString(key) ?? null,
|
|
38
|
-
setItem: (key: string, value: string) => storage.set(key, value),
|
|
39
|
-
removeItem: (key: string) => storage.delete(key),
|
|
40
|
-
})),
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
);
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Wed 22 Oct 2025 at 11:29 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, {
|
|
7
|
-
createContext,
|
|
8
|
-
useContext,
|
|
9
|
-
useEffect,
|
|
10
|
-
useMemo,
|
|
11
|
-
type ReactNode,
|
|
12
|
-
} from 'react';
|
|
13
|
-
import 'react-native-gesture-handler';
|
|
14
|
-
import 'react-native-reanimated';
|
|
15
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
16
|
-
import {
|
|
17
|
-
SafeAreaProvider,
|
|
18
|
-
initialWindowMetrics,
|
|
19
|
-
} from 'react-native-safe-area-context';
|
|
20
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
21
|
-
import { AppStatusBar } from '../components/common/AppStatusBar';
|
|
22
|
-
import { useInternalTheme } from './hook/useInternalTheme';
|
|
23
|
-
import { type ITheme, type ThemeOverride } from './themes';
|
|
24
|
-
import SystemNavigationBar from 'react-native-system-navigation-bar';
|
|
25
|
-
import Color from 'color';
|
|
26
|
-
type ThemeContextType = {
|
|
27
|
-
theme: {
|
|
28
|
-
dark: ITheme['colors'];
|
|
29
|
-
light: ITheme['colors'];
|
|
30
|
-
};
|
|
31
|
-
isDarkMode: boolean;
|
|
32
|
-
setTheme: (mode: 'light' | 'dark' | 'system') => void;
|
|
33
|
-
finalTheme: ITheme;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const ThemeContext = createContext<ThemeContextType | null>(null);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Custom hook to access ZezoUI theme context.
|
|
40
|
-
*/
|
|
41
|
-
export const useTheme = (): ThemeContextType => {
|
|
42
|
-
const ctx = useContext(ThemeContext);
|
|
43
|
-
if (!ctx) {
|
|
44
|
-
throw new Error('useTheme must be used within ZezoUIProvider');
|
|
45
|
-
}
|
|
46
|
-
return ctx;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
type ZezoUIProviderProps = {
|
|
50
|
-
children: ReactNode;
|
|
51
|
-
theme?: ThemeOverride;
|
|
52
|
-
isDark?: boolean;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* ZezoUIProvider — Wraps your app with theming, safe area, and gesture support.
|
|
57
|
-
*/
|
|
58
|
-
export const ZezoUIProvider: React.FC<ZezoUIProviderProps> = ({
|
|
59
|
-
children,
|
|
60
|
-
theme: overrideTheme,
|
|
61
|
-
isDark,
|
|
62
|
-
}) => {
|
|
63
|
-
const {
|
|
64
|
-
theme: finalTheme,
|
|
65
|
-
isDarkMode,
|
|
66
|
-
setTheme,
|
|
67
|
-
themeFull,
|
|
68
|
-
} = useInternalTheme(overrideTheme, isDark);
|
|
69
|
-
|
|
70
|
-
// Memoize context value to prevent unnecessary re-renders
|
|
71
|
-
const contextValue = useMemo(
|
|
72
|
-
() => ({
|
|
73
|
-
theme: themeFull,
|
|
74
|
-
isDarkMode,
|
|
75
|
-
setTheme,
|
|
76
|
-
finalTheme,
|
|
77
|
-
}),
|
|
78
|
-
[themeFull, isDarkMode, setTheme, finalTheme]
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// Memoize container style
|
|
82
|
-
const containerStyle = useMemo(
|
|
83
|
-
() => ({ flex: 1, backgroundColor: finalTheme.colors.background }),
|
|
84
|
-
[finalTheme.colors.background]
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
// Update system navigation bar (Android) with theme colors
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
const isDarkBackground = Color(finalTheme.colors.background).isDark();
|
|
90
|
-
if (Platform.OS === 'android') {
|
|
91
|
-
SystemNavigationBar.setNavigationColor(
|
|
92
|
-
isDarkBackground ? '#212121' : '#FFFFFF'
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}, [finalTheme.colors.background]);
|
|
96
|
-
return (
|
|
97
|
-
<GestureHandlerRootView style={styles.container}>
|
|
98
|
-
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
|
|
99
|
-
<ThemeContext.Provider value={contextValue}>
|
|
100
|
-
<AppStatusBar theme={overrideTheme} />
|
|
101
|
-
<View style={containerStyle}>{children}</View>
|
|
102
|
-
</ThemeContext.Provider>
|
|
103
|
-
</SafeAreaProvider>
|
|
104
|
-
</GestureHandlerRootView>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const styles = StyleSheet.create({
|
|
109
|
-
container: {
|
|
110
|
-
flex: 1,
|
|
111
|
-
},
|
|
112
|
-
});
|
package/src/theme/hook/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useInternalTheme';
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Fri 24 Oct 2025 at 10:45 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useMemo, useEffect } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
DarkTheme,
|
|
9
|
-
LightTheme,
|
|
10
|
-
type ITheme,
|
|
11
|
-
type ThemeOverride,
|
|
12
|
-
type useInternalThemeReturn,
|
|
13
|
-
} from '../themes';
|
|
14
|
-
import { filterValidOverrideColors } from '../utils/validateColor';
|
|
15
|
-
import { useInternalThemeStore } from '../../store/themeStore';
|
|
16
|
-
|
|
17
|
-
import { Appearance } from 'react-native';
|
|
18
|
-
|
|
19
|
-
export const useInternalTheme = (
|
|
20
|
-
override?: ThemeOverride,
|
|
21
|
-
isDark?: boolean
|
|
22
|
-
): useInternalThemeReturn => {
|
|
23
|
-
const {
|
|
24
|
-
isDarkMode: storeDarkMode,
|
|
25
|
-
setTheme,
|
|
26
|
-
themeMode,
|
|
27
|
-
setIsDarkMode,
|
|
28
|
-
} = useInternalThemeStore();
|
|
29
|
-
|
|
30
|
-
const isDarkMode = isDark ?? storeDarkMode;
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (isDark !== undefined) {
|
|
34
|
-
setTheme(isDark ? 'dark' : 'light');
|
|
35
|
-
}
|
|
36
|
-
}, [isDark, setTheme]);
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (themeMode !== 'system') return;
|
|
40
|
-
const subscription = Appearance.addChangeListener(({ colorScheme }) => {
|
|
41
|
-
if (colorScheme === 'dark' || colorScheme === 'light') {
|
|
42
|
-
setIsDarkMode(colorScheme === 'dark');
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return () => subscription.remove();
|
|
47
|
-
}, [themeMode, setIsDarkMode]);
|
|
48
|
-
|
|
49
|
-
// Memoize base theme selection
|
|
50
|
-
const baseTheme = useMemo(
|
|
51
|
-
() => (isDarkMode ? DarkTheme : LightTheme),
|
|
52
|
-
[isDarkMode]
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
// Memoize override colors — only valid, non-empty colors; empty/invalid skipped
|
|
56
|
-
const overrideColors = useMemo(() => {
|
|
57
|
-
const raw = isDarkMode ? (override?.dark ?? {}) : (override?.light ?? {});
|
|
58
|
-
return filterValidOverrideColors(raw) as Partial<ITheme['colors']>;
|
|
59
|
-
}, [override?.dark, override?.light, isDarkMode]);
|
|
60
|
-
|
|
61
|
-
// Memoize final theme with proper dependencies
|
|
62
|
-
const finalTheme = useMemo<ITheme>(
|
|
63
|
-
() => ({
|
|
64
|
-
...baseTheme,
|
|
65
|
-
colors: {
|
|
66
|
-
...baseTheme.colors,
|
|
67
|
-
...overrideColors,
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
[baseTheme, overrideColors]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
// Memoize themeFull — only valid overrides merged with base; empty/invalid skipped
|
|
74
|
-
const themeFull = useMemo(() => {
|
|
75
|
-
const validLight = filterValidOverrideColors(override?.light);
|
|
76
|
-
const validDark = filterValidOverrideColors(override?.dark);
|
|
77
|
-
return {
|
|
78
|
-
light: {
|
|
79
|
-
...LightTheme.colors,
|
|
80
|
-
...(validLight as Partial<ITheme['colors']>),
|
|
81
|
-
} as ITheme['colors'],
|
|
82
|
-
dark: {
|
|
83
|
-
...DarkTheme.colors,
|
|
84
|
-
...(validDark as Partial<ITheme['colors']>),
|
|
85
|
-
} as ITheme['colors'],
|
|
86
|
-
};
|
|
87
|
-
}, [override?.light, override?.dark]);
|
|
88
|
-
|
|
89
|
-
return useMemo(
|
|
90
|
-
() => ({
|
|
91
|
-
theme: finalTheme,
|
|
92
|
-
isDarkMode,
|
|
93
|
-
setTheme,
|
|
94
|
-
themeFull,
|
|
95
|
-
}),
|
|
96
|
-
[finalTheme, isDarkMode, setTheme, themeFull]
|
|
97
|
-
);
|
|
98
|
-
};
|