@zezosoft/zezo-ott-react-native-ui-kit 1.3.6 → 1.3.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/README.md +40 -36
- package/package.json +1 -3
- 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 -354
- package/src/components/Account/index.ts +0 -6
- package/src/components/Alert/AlertDialog.tsx +0 -253
- package/src/components/Alert/UAAlert.tsx +0 -176
- package/src/components/Alert/index.ts +0 -7
- package/src/components/Auth/AuthProvider/AuthProvider.tsx +0 -412
- package/src/components/Auth/One/ForgotPassword/ForgotPassword.tsx +0 -333
- package/src/components/Auth/One/Login/LoginWithEmail.tsx +0 -449
- package/src/components/Auth/One/Login/LoginWithPhone.tsx +0 -309
- package/src/components/Auth/One/OTP/OTP.tsx +0 -539
- package/src/components/Auth/One/QrLogin/QrLogin.tsx +0 -329
- package/src/components/Auth/One/QrLogin/components/index.ts +0 -8
- package/src/components/Auth/One/QrLogin/components/qr-scanner-fallback.tsx +0 -158
- package/src/components/Auth/One/QrLogin/components/qr-scanner-frame.tsx +0 -207
- package/src/components/Auth/One/QrLogin/components/qr-scanner-header.tsx +0 -65
- package/src/components/Auth/One/QrLogin/components/qr-scanner-intro.tsx +0 -255
- package/src/components/Auth/One/QrLogin/components/qr-scanner-overlay.tsx +0 -291
- package/src/components/Auth/One/SignUp/SignUp.tsx +0 -470
- package/src/components/Auth/One/SplashScreen/SplashScreen.tsx +0 -229
- package/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.tsx +0 -92
- package/src/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -129
- package/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -172
- package/src/components/Auth/One/SplashScreen/utils/splashUtils.ts +0 -23
- package/src/components/Auth/One/index.ts +0 -24
- package/src/components/Auth/Two/AuthHeader/AuthHeader.tsx +0 -130
- package/src/components/Auth/Two/ForgotPassword/ForgotPassword.tsx +0 -331
- package/src/components/Auth/Two/Login/EmailOrPhoneLogin.tsx +0 -612
- package/src/components/Auth/Two/OTP/OTP.tsx +0 -504
- package/src/components/Auth/Two/SignUp/SignUp.tsx +0 -439
- package/src/components/Auth/Two/index.ts +0 -20
- package/src/components/Auth/index.ts +0 -16
- package/src/components/BackgroundLayout/One/One.tsx +0 -184
- package/src/components/BackgroundLayout/Two/Two.tsx +0 -65
- package/src/components/BackgroundLayout/index.ts +0 -14
- package/src/components/BlogView/BlogView.tsx +0 -282
- 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 -204
- package/src/components/BottomSheet/BottomSheetOne.tsx +0 -223
- package/src/components/BottomSheet/index.ts +0 -9
- package/src/components/Button/BackBtn.tsx +0 -149
- package/src/components/Button/MenuBtn.tsx +0 -220
- package/src/components/Button/PrimaryBtn.tsx +0 -123
- package/src/components/Button/SecondaryBtn.tsx +0 -123
- package/src/components/Button/TextButton.tsx +0 -150
- package/src/components/Button/index.ts +0 -18
- package/src/components/Button/types.ts +0 -33
- 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 -607
- package/src/components/Content/Card/Sliders/Styles/One.tsx +0 -490
- package/src/components/Content/Card/Sliders/Styles/Three.tsx +0 -1017
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +0 -395
- package/src/components/Content/Card/Sliders/index.ts +0 -18
- package/src/components/Content/Card/Styles/Five.tsx +0 -367
- package/src/components/Content/Card/Styles/Four.tsx +0 -366
- package/src/components/Content/Card/Styles/One.tsx +0 -372
- package/src/components/Content/Card/Styles/RotateInOut.tsx +0 -413
- package/src/components/Content/Card/Styles/Six.tsx +0 -378
- package/src/components/Content/Card/Styles/Three.tsx +0 -312
- package/src/components/Content/Card/Styles/TopTen.tsx +0 -402
- package/src/components/Content/Card/Styles/Two.tsx +0 -404
- package/src/components/Content/Card/components/AdsPoster.tsx +0 -207
- package/src/components/Content/Card/components/CardPoster.tsx +0 -377
- package/src/components/Content/Card/components/LiveBadge.tsx +0 -125
- package/src/components/Content/Card/components/NavigateToMore.tsx +0 -97
- package/src/components/Content/Card/components/RentOrBuyIcon.tsx +0 -134
- package/src/components/Content/Card/components/ShowAllButton.tsx +0 -92
- package/src/components/Content/Card/components/ThumbnailCard.tsx +0 -219
- package/src/components/Content/Card/components/index.ts +0 -12
- package/src/components/Content/Card/index.ts +0 -31
- package/src/components/Content/Content.tsx +0 -338
- package/src/components/Content/Sections.tsx +0 -239
- package/src/components/Content/types.ts +0 -180
- package/src/components/ContentView/MoreContentList.tsx +0 -330
- package/src/components/ContentView/One/ContentViewOne.tsx +0 -251
- package/src/components/ContentView/One/components/CastCard.tsx +0 -266
- package/src/components/ContentView/One/components/HeroBanner.tsx +0 -413
- package/src/components/ContentView/One/components/MiniInfo.tsx +0 -343
- package/src/components/ContentView/One/components/Title.tsx +0 -149
- package/src/components/ContentView/Two/ContentViewTwo.tsx +0 -332
- package/src/components/ContentView/Two/components/Details.tsx +0 -196
- package/src/components/ContentView/Two/components/HeroBanner.tsx +0 -267
- package/src/components/ContentView/Two/components/LikeShareActions.tsx +0 -125
- package/src/components/ContentView/Two/components/MoreLikeThisContentList .tsx +0 -308
- package/src/components/ContentView/Two/components/PlayOrTrailer.tsx +0 -162
- package/src/components/ContentView/Two/components/SectionTabs.tsx +0 -181
- package/src/components/ContentView/Two/components/Title.tsx +0 -229
- package/src/components/ContentView/Two/components/index.ts +0 -12
- package/src/components/ContentView/index.ts +0 -13
- package/src/components/ContentView/shared/AboutSection.tsx +0 -226
- package/src/components/ContentView/shared/EpisodeCard.tsx +0 -600
- package/src/components/ContentView/shared/GenreTags.tsx +0 -189
- package/src/components/ContentView/shared/PlayButton.tsx +0 -52
- package/src/components/ContentView/shared/TrailerButton.tsx +0 -76
- package/src/components/Fallbacks/NoContentFallback.tsx +0 -175
- package/src/components/Fallbacks/NotFoundFallback.tsx +0 -94
- package/src/components/Fallbacks/index.ts +0 -7
- package/src/components/Headers/AppHeader.tsx +0 -151
- package/src/components/Headers/Four.tsx +0 -84
- package/src/components/Headers/One.tsx +0 -115
- package/src/components/Headers/Three.tsx +0 -137
- package/src/components/Headers/Two.tsx +0 -101
- package/src/components/Headers/index.ts +0 -34
- package/src/components/Input/Input.ts +0 -18
- package/src/components/Input/InputOne.tsx +0 -265
- package/src/components/Input/InputThree.tsx +0 -205
- package/src/components/Input/InputTwo.tsx +0 -217
- package/src/components/Input/PhoneInput/One/One.tsx +0 -415
- package/src/components/Input/PhoneInput/Two/Two.tsx +0 -406
- package/src/components/Input/PhoneInput/index.ts +0 -14
- package/src/components/Keyboard/HideKeyboard.tsx +0 -91
- package/src/components/Loader/Loader.tsx +0 -49
- package/src/components/Logo/Logo.tsx +0 -150
- package/src/components/NewRelease/NewReleaseSheet.tsx +0 -260
- package/src/components/NewRelease/index.ts +0 -6
- package/src/components/Reels/ReelsSeries/MediaControls/BottomControls.tsx +0 -226
- package/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.tsx +0 -324
- package/src/components/Reels/ReelsSeries/MediaControls/MiddleControls.tsx +0 -201
- package/src/components/Reels/ReelsSeries/MediaControls/RightControls.tsx +0 -100
- package/src/components/Reels/ReelsSeries/MediaControls/TopControls.tsx +0 -168
- package/src/components/Reels/ReelsSeries/Model/DetailsModal.tsx +0 -207
- package/src/components/Reels/ReelsSeries/Model/SettingModal.tsx +0 -151
- package/src/components/Reels/ReelsSeries/Model/UnlockModal.tsx +0 -159
- package/src/components/Reels/ReelsSeries/ReelsSeries.tsx +0 -278
- package/src/components/Reels/ReelsSeries/ReelsSeriesItem.tsx +0 -569
- package/src/components/Reels/ReelsSeries/components/AnimatedThreeLines.tsx +0 -189
- package/src/components/Reels/ReelsSeries/components/Episodes.tsx +0 -159
- package/src/components/Reels/ReelsSeries/components/GradientOverlay.tsx +0 -46
- package/src/components/Reels/ReelsSeries/components/Like.tsx +0 -45
- package/src/components/Reels/ReelsSeries/components/RotatingLoader.tsx +0 -84
- package/src/components/Reels/ReelsSeries/components/Synopsis.tsx +0 -338
- package/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.tsx +0 -185
- package/src/components/Reels/ReelsSeries/components/VideoControls/SpeedControl.tsx +0 -77
- package/src/components/Reels/ReelsSeries/components/VideoControls/index.ts +0 -7
- package/src/components/Reels/ReelsSeries/types.ts +0 -78
- package/src/components/Reels/ReelsSeries/useReelsWatchProgress.ts +0 -90
- package/src/components/Reels/ReelsSeries/utils/quality.ts +0 -72
- package/src/components/Reels/index.ts +0 -9
- package/src/components/Reels/utils/Controls/gestureUtils.ts +0 -46
- package/src/components/Reels/utils/Controls/index.ts +0 -9
- package/src/components/Reels/utils/Controls/overlayUtils.ts +0 -40
- package/src/components/Reels/utils/Controls/videoControlsConstants.ts +0 -30
- package/src/components/Reels/utils/Controls/videoRef.ts +0 -9
- package/src/components/Reels/utils/index.ts +0 -6
- package/src/components/Reels/utils/timeoutUtils.ts +0 -34
- package/src/components/Search/One.tsx +0 -262
- package/src/components/Search/components/RecentSearchesSection.tsx +0 -181
- package/src/components/Search/components/SearchCard.tsx +0 -285
- package/src/components/Search/index.ts +0 -16
- package/src/components/Settings/AppSettings.tsx +0 -442
- package/src/components/Settings/index.ts +0 -6
- package/src/components/Subscription/SubOne.tsx +0 -423
- package/src/components/Subscription/components/SubsDetailsModal.tsx +0 -347
- package/src/components/Subscription/components/SubscriptionCard.tsx +0 -342
- package/src/components/Subscription/index.ts +0 -12
- package/src/components/TabBar/One.tsx +0 -145
- package/src/components/TabBar/Three.tsx +0 -162
- package/src/components/TabBar/Two.tsx +0 -179
- package/src/components/TabBar/index.ts +0 -20
- package/src/components/Text/Text.tsx +0 -90
- package/src/components/Text/index.ts +0 -6
- package/src/components/User/DeviceSessions/DeviceSessions.tsx +0 -468
- package/src/components/User/ProfileUpdate/ProfileUpdate.tsx +0 -293
- package/src/components/User/PurchaseHistory/PurchaseHistory.tsx +0 -504
- package/src/components/User/WatchHistory/WatchHistory.tsx +0 -214
- package/src/components/User/WatchLater/WatchLater.tsx +0 -400
- package/src/components/User/components/UserAvatar.tsx +0 -121
- package/src/components/User/components/UserSection.tsx +0 -218
- package/src/components/User/index.ts +0 -18
- package/src/components/View/View.tsx +0 -38
- package/src/components/View/index.ts +0 -6
- package/src/components/common/AppStatusBar.tsx +0 -57
- package/src/components/common/index.ts +0 -1
- package/src/components/index.ts +0 -30
- package/src/components/layout/SafeAreaWrapper.tsx +0 -50
- package/src/components/layout/index.ts +0 -6
- package/src/constants/dummySections.ts +0 -103
- package/src/hooks/Images/index.ts +0 -6
- package/src/hooks/Images/useImageLoader.ts +0 -209
- package/src/hooks/index.ts +0 -16
- package/src/hooks/useAdTracking.ts +0 -354
- package/src/hooks/useCards.ts +0 -247
- package/src/hooks/useDebounce.ts +0 -40
- package/src/hooks/useKeyboard.ts +0 -43
- package/src/hooks/useNavigationMode.ts +0 -48
- package/src/hooks/usePaginatedSection.ts +0 -108
- package/src/hooks/usePrevious.ts +0 -28
- package/src/hooks/useSafeCallback.ts +0 -29
- package/src/hooks/useSkeletonItems.ts +0 -30
- package/src/hooks/useSplashCache.ts +0 -245
- package/src/index.tsx +0 -9
- package/src/store/RecentSearchesStore.ts +0 -72
- package/src/store/splashStore.ts +0 -86
- package/src/store/storage.ts +0 -29
- package/src/theme/ThemeContext.ts +0 -19
- package/src/theme/ThemeProvider.tsx +0 -87
- package/src/theme/hooks/index.ts +0 -6
- package/src/theme/hooks/useTheme.ts +0 -118
- package/src/theme/index.ts +0 -8
- package/src/theme/store/theme.ts +0 -50
- package/src/theme/themes.ts +0 -262
- package/src/theme/utils/cleanColors.ts +0 -71
- package/src/theme/utils/toRgba.ts +0 -150
- package/src/types/content/content-view.types.ts +0 -209
- package/src/types/hook/index.ts +0 -6
- package/src/types/hook/usePaginatedSection.ts +0 -20
- package/src/types/index.ts +0 -10
- package/src/types/navigation.ts +0 -17
- package/src/types/sections/index.ts +0 -87
- package/src/types/user.ts +0 -18
- package/src/utils/Display.ts +0 -15
- package/src/utils/Formater.ts +0 -33
- package/src/utils/SizeMatters.ts +0 -8
- package/src/utils/Spacing.ts +0 -27
- package/src/utils/colorUtils.ts +0 -70
- package/src/utils/imageValidation.ts +0 -36
- package/src/utils/interaction.ts +0 -19
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useEffect, useRef, useState } from 'react';
|
|
7
|
-
import RNFS from 'react-native-fs';
|
|
8
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
9
|
-
import { useSplashStore } from '../store/splashStore';
|
|
10
|
-
import { createNamespacedStorage } from '../store/storage';
|
|
11
|
-
|
|
12
|
-
const storage = createNamespacedStorage('splash-cache');
|
|
13
|
-
const pendingDownloads = new Map<string, Promise<CachedAsset | null>>();
|
|
14
|
-
const FALLBACK_EXT = 'bin';
|
|
15
|
-
const FILE_PREFIX = 'splash_';
|
|
16
|
-
|
|
17
|
-
type CachedAsset = {
|
|
18
|
-
filePath: string;
|
|
19
|
-
fileExt: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type SplashCacheOptions = {
|
|
23
|
-
logoUrl?: string;
|
|
24
|
-
backgroundUrl?: string;
|
|
25
|
-
forceRefresh?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type SplashCacheResult = {
|
|
29
|
-
isLoading: boolean;
|
|
30
|
-
logoExt: string;
|
|
31
|
-
data: {
|
|
32
|
-
logoPath: string | null;
|
|
33
|
-
backgroundPath: string | null;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const pathKey = (slot: string) => `splash_path__${slot}`;
|
|
38
|
-
const extKey = (slot: string) => `splash_ext__${slot}`;
|
|
39
|
-
|
|
40
|
-
const isOnline = async (): Promise<boolean> => {
|
|
41
|
-
const state = await NetInfo.fetch();
|
|
42
|
-
return !!state.isConnected;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const extractExt = (url: string): string => {
|
|
46
|
-
try {
|
|
47
|
-
const clean = url.split('?')[0] ?? '';
|
|
48
|
-
const dot = clean.lastIndexOf('.');
|
|
49
|
-
if (dot === -1) return FALLBACK_EXT;
|
|
50
|
-
const ext = clean.substring(dot + 1).toLowerCase();
|
|
51
|
-
return /^[a-z0-9]+$/.test(ext) ? ext : FALLBACK_EXT;
|
|
52
|
-
} catch {
|
|
53
|
-
return FALLBACK_EXT;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const simpleHash = (str: string): string => {
|
|
58
|
-
let hash = 0;
|
|
59
|
-
for (let i = 0; i < str.length; i++) {
|
|
60
|
-
hash = (hash * 31 + str.charCodeAt(i)) % 1000000007;
|
|
61
|
-
}
|
|
62
|
-
return hash.toString(36);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const buildFilePath = (url: string, slot: string, ext: string): string => {
|
|
66
|
-
const cleanExt = ext.replace(/^\./, '') || FALLBACK_EXT;
|
|
67
|
-
const hash = simpleHash(`${url}|${slot}|${cleanExt}`);
|
|
68
|
-
return `${RNFS.CachesDirectoryPath}/${FILE_PREFIX}${hash}.${cleanExt}`;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const fetchAndCache = async (
|
|
72
|
-
url: string,
|
|
73
|
-
slot: string,
|
|
74
|
-
forceRefresh: boolean
|
|
75
|
-
): Promise<CachedAsset | null> => {
|
|
76
|
-
if (!url?.trim()) return null;
|
|
77
|
-
|
|
78
|
-
const ext = extractExt(url);
|
|
79
|
-
const targetPath = buildFilePath(url, slot, ext);
|
|
80
|
-
|
|
81
|
-
if (pendingDownloads.has(targetPath)) {
|
|
82
|
-
return pendingDownloads.get(targetPath)!;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const task = (async (): Promise<CachedAsset | null> => {
|
|
86
|
-
const cachedPath = storage.getString(pathKey(slot)) ?? null;
|
|
87
|
-
const cachedExt = storage.getString(extKey(slot)) ?? ext;
|
|
88
|
-
|
|
89
|
-
const getFallback = async () =>
|
|
90
|
-
cachedPath && (await RNFS.exists(cachedPath))
|
|
91
|
-
? { filePath: cachedPath, fileExt: cachedExt }
|
|
92
|
-
: null;
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
!forceRefresh &&
|
|
96
|
-
cachedPath === targetPath &&
|
|
97
|
-
(await RNFS.exists(targetPath))
|
|
98
|
-
) {
|
|
99
|
-
return { filePath: targetPath, fileExt: cachedExt };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!(await isOnline())) {
|
|
103
|
-
const fallback = await getFallback();
|
|
104
|
-
if (!fallback) {
|
|
105
|
-
console.warn(
|
|
106
|
-
`[SplashCache] Offline — no cached file for slot: ${slot}`
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
return fallback;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const { statusCode } = await RNFS.downloadFile({
|
|
114
|
-
fromUrl: url,
|
|
115
|
-
toFile: targetPath,
|
|
116
|
-
cacheable: true,
|
|
117
|
-
readTimeout: 15_000,
|
|
118
|
-
connectionTimeout: 10_000,
|
|
119
|
-
}).promise;
|
|
120
|
-
|
|
121
|
-
if (statusCode !== 200) {
|
|
122
|
-
throw new Error(`HTTP ${statusCode}`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
storage.set(pathKey(slot), targetPath);
|
|
126
|
-
storage.set(extKey(slot), ext);
|
|
127
|
-
|
|
128
|
-
if (cachedPath && cachedPath !== targetPath) {
|
|
129
|
-
await RNFS.unlink(cachedPath).catch(() => {});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return { filePath: targetPath, fileExt: ext };
|
|
133
|
-
} catch (err) {
|
|
134
|
-
console.warn(`[SplashCache] Download failed for slot "${slot}":`, err);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return getFallback();
|
|
138
|
-
})().finally(() => {
|
|
139
|
-
pendingDownloads.delete(targetPath);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
pendingDownloads.set(targetPath, task);
|
|
143
|
-
return task;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const getCachedAssetForUrl = (
|
|
147
|
-
url: string | undefined,
|
|
148
|
-
slot: string
|
|
149
|
-
): CachedAsset | null => {
|
|
150
|
-
if (!url?.trim()) return null;
|
|
151
|
-
const ext = extractExt(url);
|
|
152
|
-
const targetPath = buildFilePath(url, slot, ext);
|
|
153
|
-
const cachedPath = storage.getString(pathKey(slot)) ?? null;
|
|
154
|
-
const cachedExt = storage.getString(extKey(slot)) ?? ext;
|
|
155
|
-
|
|
156
|
-
return cachedPath === targetPath
|
|
157
|
-
? { filePath: cachedPath, fileExt: cachedExt }
|
|
158
|
-
: null;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
type HookState = {
|
|
162
|
-
isLoading: boolean;
|
|
163
|
-
logoPath: string | null;
|
|
164
|
-
backgroundPath: string | null;
|
|
165
|
-
logoExt: string;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const useSplashCache = ({
|
|
169
|
-
logoUrl,
|
|
170
|
-
backgroundUrl,
|
|
171
|
-
forceRefresh = false,
|
|
172
|
-
}: SplashCacheOptions): SplashCacheResult => {
|
|
173
|
-
const getInitialState = (): HookState => {
|
|
174
|
-
const logo = logoUrl ? getCachedAssetForUrl(logoUrl, 'logo') : null;
|
|
175
|
-
const bg = backgroundUrl
|
|
176
|
-
? getCachedAssetForUrl(backgroundUrl, 'background')
|
|
177
|
-
: null;
|
|
178
|
-
const isReady =
|
|
179
|
-
!forceRefresh && (!logoUrl || logo) && (!backgroundUrl || bg);
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
isLoading: !isReady,
|
|
183
|
-
logoPath: logo?.filePath ?? null,
|
|
184
|
-
backgroundPath: bg?.filePath ?? null,
|
|
185
|
-
logoExt: logo?.fileExt ?? '',
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const [state, setState] = useState<HookState>(getInitialState);
|
|
190
|
-
const prevProps = useRef({ logoUrl, backgroundUrl, forceRefresh });
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
prevProps.current.logoUrl !== logoUrl ||
|
|
194
|
-
prevProps.current.backgroundUrl !== backgroundUrl ||
|
|
195
|
-
prevProps.current.forceRefresh !== forceRefresh
|
|
196
|
-
) {
|
|
197
|
-
prevProps.current = { logoUrl, backgroundUrl, forceRefresh };
|
|
198
|
-
setState(getInitialState());
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const mounted = useRef(true);
|
|
202
|
-
|
|
203
|
-
useEffect(() => {
|
|
204
|
-
mounted.current = true;
|
|
205
|
-
|
|
206
|
-
const sync = async () => {
|
|
207
|
-
const [logoAsset, backgroundAsset] = await Promise.all([
|
|
208
|
-
logoUrl ? fetchAndCache(logoUrl, 'logo', forceRefresh) : null,
|
|
209
|
-
backgroundUrl
|
|
210
|
-
? fetchAndCache(backgroundUrl, 'background', forceRefresh)
|
|
211
|
-
: null,
|
|
212
|
-
]);
|
|
213
|
-
|
|
214
|
-
if (!mounted.current) return;
|
|
215
|
-
|
|
216
|
-
setState({
|
|
217
|
-
isLoading: false,
|
|
218
|
-
logoPath: logoAsset?.filePath ?? null,
|
|
219
|
-
backgroundPath: backgroundAsset?.filePath ?? null,
|
|
220
|
-
logoExt: logoAsset?.fileExt ?? '',
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const { setLogoPath, setBackdropPath } = useSplashStore.getState();
|
|
224
|
-
if (logoAsset?.filePath) setLogoPath(logoAsset.filePath);
|
|
225
|
-
if (backgroundAsset?.filePath) setBackdropPath(backgroundAsset.filePath);
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
sync().catch(() => {
|
|
229
|
-
if (mounted.current) setState((prev) => ({ ...prev, isLoading: false }));
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
return () => {
|
|
233
|
-
mounted.current = false;
|
|
234
|
-
};
|
|
235
|
-
}, [logoUrl, backgroundUrl, forceRefresh]);
|
|
236
|
-
|
|
237
|
-
return {
|
|
238
|
-
isLoading: state.isLoading,
|
|
239
|
-
logoExt: state.logoExt,
|
|
240
|
-
data: {
|
|
241
|
-
logoPath: state.logoPath,
|
|
242
|
-
backgroundPath: state.backgroundPath,
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
};
|
package/src/index.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
-
import { mmkvZustandStorage } from './storage';
|
|
9
|
-
|
|
10
|
-
type RecentSearchesState = {
|
|
11
|
-
recentSearches: string[];
|
|
12
|
-
pillMaxCount: number;
|
|
13
|
-
isLoading: boolean;
|
|
14
|
-
addSearchTerm: (term: string, limit?: number) => void;
|
|
15
|
-
removeSearchTerm: (term: string) => void;
|
|
16
|
-
clearSearches: () => void;
|
|
17
|
-
setPillMaxCount: (count: number) => void;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const useRecentSearchesStore = create<RecentSearchesState>()(
|
|
21
|
-
persist(
|
|
22
|
-
(set, get) => ({
|
|
23
|
-
recentSearches: [],
|
|
24
|
-
pillMaxCount: 20,
|
|
25
|
-
isLoading: true,
|
|
26
|
-
|
|
27
|
-
addSearchTerm: (term, limit) => {
|
|
28
|
-
const trimmed = term.trim();
|
|
29
|
-
if (!trimmed) return;
|
|
30
|
-
|
|
31
|
-
const maxCount = limit ?? get().pillMaxCount;
|
|
32
|
-
const current = get().recentSearches;
|
|
33
|
-
const updated = [
|
|
34
|
-
trimmed,
|
|
35
|
-
...current.filter((t) => t !== trimmed),
|
|
36
|
-
].slice(0, maxCount);
|
|
37
|
-
set({ recentSearches: updated });
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
removeSearchTerm: (term) =>
|
|
41
|
-
set((state) => ({
|
|
42
|
-
recentSearches: state.recentSearches.filter((t) => t !== term),
|
|
43
|
-
})),
|
|
44
|
-
|
|
45
|
-
clearSearches: () => set({ recentSearches: [] }),
|
|
46
|
-
|
|
47
|
-
setPillMaxCount: (count) => set({ pillMaxCount: count }),
|
|
48
|
-
}),
|
|
49
|
-
{
|
|
50
|
-
name: 'recent-searches-storage',
|
|
51
|
-
storage: createJSONStorage(() => mmkvZustandStorage),
|
|
52
|
-
version: 1,
|
|
53
|
-
partialize: (state) => ({
|
|
54
|
-
recentSearches: state.recentSearches,
|
|
55
|
-
pillMaxCount: state.pillMaxCount,
|
|
56
|
-
}),
|
|
57
|
-
onRehydrateStorage: () => (state) => {
|
|
58
|
-
const delay =
|
|
59
|
-
(state?.recentSearches?.length ?? 0) > 0 ||
|
|
60
|
-
(state?.pillMaxCount ?? 20) !== 20;
|
|
61
|
-
|
|
62
|
-
if (delay) {
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
useRecentSearchesStore.setState({ isLoading: false });
|
|
65
|
-
}, 50);
|
|
66
|
-
} else {
|
|
67
|
-
useRecentSearchesStore.setState({ isLoading: false });
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
);
|
package/src/store/splashStore.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
-
import { mmkvZustandStorage } from './storage';
|
|
9
|
-
|
|
10
|
-
interface ImageState {
|
|
11
|
-
localPath: string | null;
|
|
12
|
-
lastUpdated: number | null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type SplashState = {
|
|
16
|
-
logo: ImageState;
|
|
17
|
-
backdrop: ImageState;
|
|
18
|
-
setLogoPath: (path: string | null) => void;
|
|
19
|
-
clearLogoPath: () => void;
|
|
20
|
-
setBackdropPath: (path: string | null) => void;
|
|
21
|
-
clearBackdropPath: () => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const useSplashStore = create<SplashState>()(
|
|
25
|
-
persist(
|
|
26
|
-
(set) => ({
|
|
27
|
-
logo: {
|
|
28
|
-
localPath: null,
|
|
29
|
-
lastUpdated: null,
|
|
30
|
-
},
|
|
31
|
-
backdrop: {
|
|
32
|
-
localPath: null,
|
|
33
|
-
lastUpdated: null,
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
setLogoPath: (path) =>
|
|
37
|
-
set((state) => ({
|
|
38
|
-
logo: {
|
|
39
|
-
...state.logo,
|
|
40
|
-
localPath: path,
|
|
41
|
-
lastUpdated: Date.now(),
|
|
42
|
-
},
|
|
43
|
-
})),
|
|
44
|
-
|
|
45
|
-
clearLogoPath: () =>
|
|
46
|
-
set(() => ({
|
|
47
|
-
logo: {
|
|
48
|
-
localPath: null,
|
|
49
|
-
lastUpdated: null,
|
|
50
|
-
},
|
|
51
|
-
})),
|
|
52
|
-
|
|
53
|
-
setBackdropPath: (path) =>
|
|
54
|
-
set((state) => ({
|
|
55
|
-
backdrop: {
|
|
56
|
-
...state.backdrop,
|
|
57
|
-
localPath: path,
|
|
58
|
-
lastUpdated: Date.now(),
|
|
59
|
-
},
|
|
60
|
-
})),
|
|
61
|
-
|
|
62
|
-
clearBackdropPath: () =>
|
|
63
|
-
set(() => ({
|
|
64
|
-
backdrop: {
|
|
65
|
-
localPath: null,
|
|
66
|
-
lastUpdated: null,
|
|
67
|
-
},
|
|
68
|
-
})),
|
|
69
|
-
}),
|
|
70
|
-
{
|
|
71
|
-
name: 'splash-storage',
|
|
72
|
-
storage: createJSONStorage(() => mmkvZustandStorage),
|
|
73
|
-
version: 1,
|
|
74
|
-
partialize: (state) => ({
|
|
75
|
-
logo: {
|
|
76
|
-
localPath: state.logo.localPath,
|
|
77
|
-
lastUpdated: state.logo.lastUpdated,
|
|
78
|
-
},
|
|
79
|
-
backdrop: {
|
|
80
|
-
localPath: state.backdrop.localPath,
|
|
81
|
-
lastUpdated: state.backdrop.lastUpdated,
|
|
82
|
-
},
|
|
83
|
-
}),
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
);
|
package/src/store/storage.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { createMMKV } from 'react-native-mmkv';
|
|
7
|
-
|
|
8
|
-
export const mmkv = createMMKV({ id: 'zezo-app-storage' });
|
|
9
|
-
|
|
10
|
-
export const mmkvZustandStorage = {
|
|
11
|
-
getItem: (name: string): string | null => mmkv.getString(name) ?? null,
|
|
12
|
-
setItem: (name: string, value: string): void => mmkv.set(name, value),
|
|
13
|
-
removeItem: (name: string) => {
|
|
14
|
-
mmkv.remove(name);
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const createNamespacedStorage = (namespace: string) => {
|
|
19
|
-
const ns = (key: string) => `${namespace}::${key}`;
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
getString: (key: string): string | undefined => mmkv.getString(ns(key)),
|
|
23
|
-
set: (key: string, value: string | number | boolean): void =>
|
|
24
|
-
mmkv.set(ns(key), value),
|
|
25
|
-
remove: (key: string): void => {
|
|
26
|
-
mmkv.remove(ns(key));
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { createContext } from 'react';
|
|
7
|
-
import { type ITheme } from './themes';
|
|
8
|
-
|
|
9
|
-
export type ThemeContextType = {
|
|
10
|
-
themeColors: {
|
|
11
|
-
dark: ITheme['colors'];
|
|
12
|
-
light: ITheme['colors'];
|
|
13
|
-
};
|
|
14
|
-
isDarkMode: boolean;
|
|
15
|
-
setTheme: (mode: 'light' | 'dark' | 'system') => void;
|
|
16
|
-
theme: ITheme;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const ThemeContext = createContext<ThemeContextType | null>(null);
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useEffect, useMemo, type ReactNode } from 'react';
|
|
7
|
-
import 'react-native-gesture-handler';
|
|
8
|
-
import 'react-native-reanimated';
|
|
9
|
-
import { Platform, StyleSheet, View } from 'react-native';
|
|
10
|
-
import {
|
|
11
|
-
SafeAreaProvider,
|
|
12
|
-
initialWindowMetrics,
|
|
13
|
-
} from 'react-native-safe-area-context';
|
|
14
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
15
|
-
import { AppStatusBar } from '../components/common/AppStatusBar';
|
|
16
|
-
import { useTheme } from './hooks/useTheme';
|
|
17
|
-
import { type CustomTheme } from './themes';
|
|
18
|
-
import { ThemeContext } from './ThemeContext';
|
|
19
|
-
import SystemNavigationBar from 'react-native-system-navigation-bar';
|
|
20
|
-
import tinycolor from 'tinycolor2';
|
|
21
|
-
|
|
22
|
-
export { useTheme } from './hooks/useTheme';
|
|
23
|
-
|
|
24
|
-
type ZezoUIProviderProps = {
|
|
25
|
-
children: ReactNode;
|
|
26
|
-
theme?: CustomTheme;
|
|
27
|
-
isDark?: boolean;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* ZezoUIProvider — Wraps your app with theming, safe area, and gesture support.
|
|
32
|
-
*/
|
|
33
|
-
export const ZezoUIProvider: React.FC<ZezoUIProviderProps> = ({
|
|
34
|
-
children,
|
|
35
|
-
theme: overrideTheme,
|
|
36
|
-
isDark,
|
|
37
|
-
}) => {
|
|
38
|
-
const {
|
|
39
|
-
theme: finalTheme,
|
|
40
|
-
isDarkMode,
|
|
41
|
-
setTheme,
|
|
42
|
-
themeColors,
|
|
43
|
-
} = useTheme(overrideTheme, isDark);
|
|
44
|
-
|
|
45
|
-
// Memoize context value to prevent unnecessary re-renders
|
|
46
|
-
const contextValue = useMemo(
|
|
47
|
-
() => ({
|
|
48
|
-
themeColors,
|
|
49
|
-
isDarkMode,
|
|
50
|
-
setTheme,
|
|
51
|
-
theme: finalTheme,
|
|
52
|
-
}),
|
|
53
|
-
[themeColors, isDarkMode, setTheme, finalTheme]
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
// Memoize container style
|
|
57
|
-
const containerStyle = useMemo(
|
|
58
|
-
() => ({ flex: 1, backgroundColor: finalTheme.colors.background }),
|
|
59
|
-
[finalTheme.colors.background]
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// Update system navigation bar (Android) with theme colors
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
const isDarkBackground = tinycolor(finalTheme.colors.background).isDark();
|
|
65
|
-
if (Platform.OS === 'android') {
|
|
66
|
-
SystemNavigationBar.setNavigationColor(
|
|
67
|
-
isDarkBackground ? '#212121' : '#FFFFFF'
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}, [finalTheme.colors.background]);
|
|
71
|
-
return (
|
|
72
|
-
<GestureHandlerRootView style={styles.container}>
|
|
73
|
-
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
|
|
74
|
-
<ThemeContext.Provider value={contextValue}>
|
|
75
|
-
<AppStatusBar theme={overrideTheme} />
|
|
76
|
-
<View style={containerStyle}>{children}</View>
|
|
77
|
-
</ThemeContext.Provider>
|
|
78
|
-
</SafeAreaProvider>
|
|
79
|
-
</GestureHandlerRootView>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const styles = StyleSheet.create({
|
|
84
|
-
container: {
|
|
85
|
-
flex: 1,
|
|
86
|
-
},
|
|
87
|
-
});
|
package/src/theme/hooks/index.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useMemo, useEffect, useContext, useCallback } from 'react';
|
|
7
|
-
import { Appearance } from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
DarkTheme,
|
|
10
|
-
LightTheme,
|
|
11
|
-
type ITheme,
|
|
12
|
-
type ThemeOverride,
|
|
13
|
-
type UseThemeReturn,
|
|
14
|
-
type BaseColors,
|
|
15
|
-
type CustomTheme,
|
|
16
|
-
} from '../themes';
|
|
17
|
-
import { useThemeStore } from '../store/theme';
|
|
18
|
-
import { ThemeContext } from '../ThemeContext';
|
|
19
|
-
import { cleanColors, mergeColors } from '../utils/cleanColors';
|
|
20
|
-
|
|
21
|
-
export const useTheme = (
|
|
22
|
-
themeOverride?: ThemeOverride,
|
|
23
|
-
isDark?: boolean
|
|
24
|
-
): UseThemeReturn => {
|
|
25
|
-
const context = useContext(ThemeContext);
|
|
26
|
-
|
|
27
|
-
const storeState = useThemeStore(
|
|
28
|
-
useCallback((state) => (context ? null : state), [context])
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const isDarkMode =
|
|
32
|
-
isDark ??
|
|
33
|
-
(context ? context.isDarkMode : (storeState?.isDarkMode ?? false));
|
|
34
|
-
const setTheme = useMemo(() => {
|
|
35
|
-
return context ? context.setTheme : (storeState?.setTheme ?? (() => {}));
|
|
36
|
-
}, [context, storeState?.setTheme]);
|
|
37
|
-
|
|
38
|
-
const themeMode = storeState?.themeMode;
|
|
39
|
-
const setIsDarkMode = storeState?.setIsDarkMode;
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (context || !setIsDarkMode || themeMode !== 'system') return;
|
|
43
|
-
const subscription = Appearance.addChangeListener(({ colorScheme }) => {
|
|
44
|
-
if (colorScheme === 'dark' || colorScheme === 'light') {
|
|
45
|
-
setIsDarkMode(colorScheme === 'dark');
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return () => subscription.remove();
|
|
50
|
-
}, [context, themeMode, setIsDarkMode]);
|
|
51
|
-
|
|
52
|
-
const normalizedOverride = useMemo(() => {
|
|
53
|
-
if (!themeOverride) return undefined;
|
|
54
|
-
|
|
55
|
-
let lightOverride: Partial<BaseColors> | undefined;
|
|
56
|
-
let darkOverride: Partial<BaseColors> | undefined;
|
|
57
|
-
|
|
58
|
-
if ('colors' in themeOverride && themeOverride.colors) {
|
|
59
|
-
const cleanedColors = cleanColors(themeOverride.colors);
|
|
60
|
-
if (cleanedColors) {
|
|
61
|
-
lightOverride = cleanedColors;
|
|
62
|
-
darkOverride = cleanedColors;
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
const custom = themeOverride as CustomTheme;
|
|
66
|
-
if (custom.light) {
|
|
67
|
-
lightOverride = cleanColors(custom.light);
|
|
68
|
-
}
|
|
69
|
-
if (custom.dark) {
|
|
70
|
-
darkOverride = cleanColors(custom.dark);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (lightOverride || darkOverride) {
|
|
75
|
-
return {
|
|
76
|
-
light: lightOverride,
|
|
77
|
-
dark: darkOverride,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return undefined;
|
|
82
|
-
}, [themeOverride]);
|
|
83
|
-
|
|
84
|
-
const themeColors = useMemo(() => {
|
|
85
|
-
const lightBase = context ? context.themeColors.light : LightTheme.colors;
|
|
86
|
-
const darkBase = context ? context.themeColors.dark : DarkTheme.colors;
|
|
87
|
-
|
|
88
|
-
if (!normalizedOverride) {
|
|
89
|
-
return { light: lightBase, dark: darkBase };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
light: mergeColors(lightBase, normalizedOverride.light),
|
|
94
|
-
dark: mergeColors(darkBase, normalizedOverride.dark),
|
|
95
|
-
};
|
|
96
|
-
}, [context, normalizedOverride]);
|
|
97
|
-
|
|
98
|
-
const theme = useMemo<ITheme>(() => {
|
|
99
|
-
if (context && !normalizedOverride && isDark === undefined) {
|
|
100
|
-
return context.theme;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
colors: isDarkMode ? themeColors.dark : themeColors.light,
|
|
105
|
-
} as ITheme;
|
|
106
|
-
}, [context, normalizedOverride, isDark, isDarkMode, themeColors]);
|
|
107
|
-
|
|
108
|
-
return useMemo(
|
|
109
|
-
() => ({
|
|
110
|
-
theme,
|
|
111
|
-
finalTheme: theme,
|
|
112
|
-
isDarkMode,
|
|
113
|
-
setTheme,
|
|
114
|
-
themeColors,
|
|
115
|
-
}),
|
|
116
|
-
[theme, isDarkMode, setTheme, themeColors]
|
|
117
|
-
);
|
|
118
|
-
};
|