@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,423 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Ashok Desai
|
|
3
|
-
* @lastModified oct 02 Oct 2025 at 10:30 AM
|
|
4
|
-
*/
|
|
5
|
-
import React, { useEffect, useRef, useMemo, useCallback } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
View,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
Animated,
|
|
10
|
-
Easing,
|
|
11
|
-
Dimensions,
|
|
12
|
-
Platform,
|
|
13
|
-
} from 'react-native';
|
|
14
|
-
import type { ViewStyle } from 'react-native';
|
|
15
|
-
import { scale } from 'react-native-size-matters';
|
|
16
|
-
import type { ThemeOverride } from '../../../../../theme/themes';
|
|
17
|
-
import { useInternalTheme } from '../../../../../theme/hook/useInternalTheme';
|
|
18
|
-
|
|
19
|
-
const { width: SCREEN_W, height: SCREEN_H } = Dimensions.get('window');
|
|
20
|
-
|
|
21
|
-
// ==================== Constants ====================
|
|
22
|
-
const ANIMATION_DURATION = 2000;
|
|
23
|
-
const CORNER_SIZE = 18;
|
|
24
|
-
const CORNER_BORDER_WIDTH = 3;
|
|
25
|
-
const SCAN_LINE_HEIGHT = 3;
|
|
26
|
-
const SCAN_LINE_MARGIN = 12;
|
|
27
|
-
const BOX_WIDTH_RATIO = 0.7;
|
|
28
|
-
const BOX_SIZE_RATIO = 0.9;
|
|
29
|
-
const MAX_BOX_WIDTH = 320;
|
|
30
|
-
const VERTICAL_OFFSET = 40;
|
|
31
|
-
const DEFAULT_OVERLAY_COLOR = 'rgba(0, 0, 0, 0.6)';
|
|
32
|
-
const DEFAULT_SHADOW_COLOR = '#000';
|
|
33
|
-
|
|
34
|
-
// ==================== Types ====================
|
|
35
|
-
type QrViewAreaProps = {
|
|
36
|
-
scanBoxWidth?: number;
|
|
37
|
-
headerHeight?: number;
|
|
38
|
-
theme?: ThemeOverride;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
type BoxDimensions = {
|
|
42
|
-
boxW: number;
|
|
43
|
-
boxH: number;
|
|
44
|
-
boxTop: number;
|
|
45
|
-
topOverlayHeight: number;
|
|
46
|
-
bottomOverlayHeight: number;
|
|
47
|
-
sideOverlayWidth: number;
|
|
48
|
-
rightOverlayWidth: number;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
type CornerPosition = 'tl' | 'tr' | 'bl' | 'br';
|
|
52
|
-
|
|
53
|
-
// ==================== Helper Functions ====================
|
|
54
|
-
/**
|
|
55
|
-
* Calculates the scan box dimensions and overlay positions
|
|
56
|
-
*/
|
|
57
|
-
const calculateBoxDimensions = (
|
|
58
|
-
scanBoxWidth: number | undefined,
|
|
59
|
-
headerHeight: number
|
|
60
|
-
): BoxDimensions => {
|
|
61
|
-
const defaultBoxW =
|
|
62
|
-
scanBoxWidth || Math.min(SCREEN_W * BOX_WIDTH_RATIO, MAX_BOX_WIDTH);
|
|
63
|
-
const boxW = defaultBoxW * BOX_SIZE_RATIO;
|
|
64
|
-
const boxH = boxW;
|
|
65
|
-
const availableHeight = SCREEN_H - headerHeight;
|
|
66
|
-
const boxTop = Math.max(
|
|
67
|
-
headerHeight,
|
|
68
|
-
Math.floor(
|
|
69
|
-
headerHeight + (availableHeight - boxH) / 2 - scale(VERTICAL_OFFSET)
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const topOverlayHeight = Math.max(0, Math.floor(boxTop - headerHeight));
|
|
74
|
-
const bottomOverlayHeight = Math.max(
|
|
75
|
-
0,
|
|
76
|
-
Math.floor(SCREEN_H - (boxTop + boxH))
|
|
77
|
-
);
|
|
78
|
-
const leftOverlayWidth = Math.floor((SCREEN_W - boxW) / 2);
|
|
79
|
-
const scanBoxRight = leftOverlayWidth + boxW;
|
|
80
|
-
const rightOverlayWidth = Math.max(0, SCREEN_W - scanBoxRight);
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
boxW,
|
|
84
|
-
boxH,
|
|
85
|
-
boxTop,
|
|
86
|
-
topOverlayHeight,
|
|
87
|
-
bottomOverlayHeight,
|
|
88
|
-
sideOverlayWidth: leftOverlayWidth,
|
|
89
|
-
rightOverlayWidth,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Creates overlay style for a specific position
|
|
95
|
-
*/
|
|
96
|
-
const createOverlayStyle = (
|
|
97
|
-
position: 'top' | 'bottom' | 'left' | 'right',
|
|
98
|
-
dimensions: BoxDimensions,
|
|
99
|
-
headerHeight: number,
|
|
100
|
-
overlayColor: string
|
|
101
|
-
): ViewStyle[] => {
|
|
102
|
-
const baseStyleKey =
|
|
103
|
-
`overlay${position.charAt(0).toUpperCase() + position.slice(1)}` as keyof typeof styles;
|
|
104
|
-
const baseStyle = styles[baseStyleKey] || styles.overlaySide;
|
|
105
|
-
|
|
106
|
-
switch (position) {
|
|
107
|
-
case 'top':
|
|
108
|
-
return [
|
|
109
|
-
baseStyle,
|
|
110
|
-
{
|
|
111
|
-
top: headerHeight,
|
|
112
|
-
height: Math.max(0, dimensions.topOverlayHeight),
|
|
113
|
-
backgroundColor: overlayColor,
|
|
114
|
-
},
|
|
115
|
-
];
|
|
116
|
-
case 'bottom':
|
|
117
|
-
return [
|
|
118
|
-
baseStyle,
|
|
119
|
-
{
|
|
120
|
-
top: dimensions.boxTop + dimensions.boxH,
|
|
121
|
-
height: Math.max(0, dimensions.bottomOverlayHeight),
|
|
122
|
-
backgroundColor: overlayColor,
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
|
-
case 'left':
|
|
126
|
-
return [
|
|
127
|
-
baseStyle,
|
|
128
|
-
{
|
|
129
|
-
left: 0,
|
|
130
|
-
top: dimensions.boxTop,
|
|
131
|
-
height: dimensions.boxH,
|
|
132
|
-
width: Math.max(0, dimensions.sideOverlayWidth),
|
|
133
|
-
backgroundColor: overlayColor,
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
case 'right':
|
|
137
|
-
return [
|
|
138
|
-
baseStyle,
|
|
139
|
-
{
|
|
140
|
-
right: 0,
|
|
141
|
-
top: dimensions.boxTop,
|
|
142
|
-
height: dimensions.boxH,
|
|
143
|
-
width: Math.max(0, dimensions.rightOverlayWidth),
|
|
144
|
-
backgroundColor: overlayColor,
|
|
145
|
-
},
|
|
146
|
-
];
|
|
147
|
-
default:
|
|
148
|
-
return [baseStyle];
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Creates corner style based on position
|
|
154
|
-
*/
|
|
155
|
-
const createCornerStyle = (
|
|
156
|
-
position: CornerPosition,
|
|
157
|
-
borderColor: string,
|
|
158
|
-
cornerSize: number,
|
|
159
|
-
cornerBorderWidth: number
|
|
160
|
-
): ViewStyle[] => {
|
|
161
|
-
const baseStyle = [
|
|
162
|
-
styles.corner,
|
|
163
|
-
styles[`corner_${position}` as keyof typeof styles],
|
|
164
|
-
];
|
|
165
|
-
|
|
166
|
-
const dynamicStyle: ViewStyle = {
|
|
167
|
-
borderColor,
|
|
168
|
-
width: cornerSize,
|
|
169
|
-
height: cornerSize,
|
|
170
|
-
borderTopWidth: position.startsWith('t') ? cornerBorderWidth : 0,
|
|
171
|
-
borderBottomWidth: position.startsWith('b') ? cornerBorderWidth : 0,
|
|
172
|
-
borderLeftWidth: position.endsWith('l') ? cornerBorderWidth : 0,
|
|
173
|
-
borderRightWidth: position.endsWith('r') ? cornerBorderWidth : 0,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
return [...baseStyle, dynamicStyle];
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Creates animated scan line style
|
|
181
|
-
*/
|
|
182
|
-
const createScanLineStyle = (
|
|
183
|
-
margin: number,
|
|
184
|
-
scanLineHeight: number,
|
|
185
|
-
borderColor: string,
|
|
186
|
-
shadowColor: string,
|
|
187
|
-
translateY: Animated.AnimatedInterpolation<number>
|
|
188
|
-
): ViewStyle => ({
|
|
189
|
-
position: 'absolute',
|
|
190
|
-
top: margin,
|
|
191
|
-
left: margin,
|
|
192
|
-
right: margin,
|
|
193
|
-
height: scanLineHeight,
|
|
194
|
-
borderRadius: scanLineHeight / 2,
|
|
195
|
-
backgroundColor: borderColor,
|
|
196
|
-
transform: [{ translateY }],
|
|
197
|
-
shadowColor,
|
|
198
|
-
shadowOffset: { width: 0, height: 2 },
|
|
199
|
-
shadowOpacity: 0.4,
|
|
200
|
-
shadowRadius: 4,
|
|
201
|
-
elevation: Platform.OS === 'android' ? 5 : 0,
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// ==================== Custom Hooks ====================
|
|
205
|
-
/**
|
|
206
|
-
* Hook to manage scan line animation
|
|
207
|
-
*/
|
|
208
|
-
const useScanLineAnimation = (lineTravel: number) => {
|
|
209
|
-
const anim = useRef(new Animated.Value(0)).current;
|
|
210
|
-
|
|
211
|
-
useEffect(() => {
|
|
212
|
-
const animation = Animated.loop(
|
|
213
|
-
Animated.sequence([
|
|
214
|
-
Animated.timing(anim, {
|
|
215
|
-
toValue: 1,
|
|
216
|
-
duration: ANIMATION_DURATION,
|
|
217
|
-
easing: Easing.linear,
|
|
218
|
-
useNativeDriver: true,
|
|
219
|
-
}),
|
|
220
|
-
Animated.timing(anim, {
|
|
221
|
-
toValue: 0,
|
|
222
|
-
duration: ANIMATION_DURATION,
|
|
223
|
-
easing: Easing.linear,
|
|
224
|
-
useNativeDriver: true,
|
|
225
|
-
}),
|
|
226
|
-
])
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
animation.start();
|
|
230
|
-
return () => animation.stop();
|
|
231
|
-
}, [anim]);
|
|
232
|
-
|
|
233
|
-
const translateY = useMemo(
|
|
234
|
-
() =>
|
|
235
|
-
anim.interpolate({
|
|
236
|
-
inputRange: [0, 1],
|
|
237
|
-
outputRange: [0, lineTravel],
|
|
238
|
-
}),
|
|
239
|
-
[anim, lineTravel]
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
return translateY;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// ==================== Component ====================
|
|
246
|
-
const QrViewArea: React.FC<QrViewAreaProps> = React.memo(
|
|
247
|
-
({ scanBoxWidth, headerHeight = 0, theme }) => {
|
|
248
|
-
const { theme: appliedTheme } = useInternalTheme(theme);
|
|
249
|
-
const { colors } = appliedTheme;
|
|
250
|
-
|
|
251
|
-
// Calculate dimensions
|
|
252
|
-
const boxDimensions = useMemo(
|
|
253
|
-
() => calculateBoxDimensions(scanBoxWidth, headerHeight),
|
|
254
|
-
[scanBoxWidth, headerHeight]
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
// Calculate scan line properties
|
|
258
|
-
const margin = useMemo(() => scale(SCAN_LINE_MARGIN), []);
|
|
259
|
-
const lineTravel = useMemo(
|
|
260
|
-
() =>
|
|
261
|
-
Math.max(0, boxDimensions.boxH - margin * 2 - scale(SCAN_LINE_HEIGHT)),
|
|
262
|
-
[boxDimensions.boxH, margin]
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
// Animation
|
|
266
|
-
const translateY = useScanLineAnimation(lineTravel);
|
|
267
|
-
|
|
268
|
-
// Theme colors
|
|
269
|
-
const overlayColor = colors.overlay || DEFAULT_OVERLAY_COLOR;
|
|
270
|
-
const shadowColor = colors.shadow || DEFAULT_SHADOW_COLOR;
|
|
271
|
-
|
|
272
|
-
// Corner properties
|
|
273
|
-
const cornerSize = useMemo(() => scale(CORNER_SIZE), []);
|
|
274
|
-
const cornerBorderWidth = useMemo(() => scale(CORNER_BORDER_WIDTH), []);
|
|
275
|
-
|
|
276
|
-
// Create overlay styles
|
|
277
|
-
const overlayStyles = useMemo(
|
|
278
|
-
() => ({
|
|
279
|
-
top: createOverlayStyle(
|
|
280
|
-
'top',
|
|
281
|
-
boxDimensions,
|
|
282
|
-
headerHeight,
|
|
283
|
-
overlayColor
|
|
284
|
-
),
|
|
285
|
-
bottom: createOverlayStyle(
|
|
286
|
-
'bottom',
|
|
287
|
-
boxDimensions,
|
|
288
|
-
headerHeight,
|
|
289
|
-
overlayColor
|
|
290
|
-
),
|
|
291
|
-
left: createOverlayStyle(
|
|
292
|
-
'left',
|
|
293
|
-
boxDimensions,
|
|
294
|
-
headerHeight,
|
|
295
|
-
overlayColor
|
|
296
|
-
),
|
|
297
|
-
right: createOverlayStyle(
|
|
298
|
-
'right',
|
|
299
|
-
boxDimensions,
|
|
300
|
-
headerHeight,
|
|
301
|
-
overlayColor
|
|
302
|
-
),
|
|
303
|
-
}),
|
|
304
|
-
[boxDimensions, headerHeight, overlayColor]
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
// Scan box style
|
|
308
|
-
const scanBoxStyle = useMemo(
|
|
309
|
-
() => [
|
|
310
|
-
styles.scanBox,
|
|
311
|
-
{
|
|
312
|
-
top: boxDimensions.boxTop,
|
|
313
|
-
left: boxDimensions.sideOverlayWidth,
|
|
314
|
-
width: boxDimensions.boxW,
|
|
315
|
-
height: boxDimensions.boxH,
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
[boxDimensions]
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
// Corner style generator
|
|
322
|
-
const getCornerStyle = useCallback(
|
|
323
|
-
(position: CornerPosition) =>
|
|
324
|
-
createCornerStyle(
|
|
325
|
-
position,
|
|
326
|
-
colors.button,
|
|
327
|
-
cornerSize,
|
|
328
|
-
cornerBorderWidth
|
|
329
|
-
),
|
|
330
|
-
[colors.button, cornerSize, cornerBorderWidth]
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
// Scan line style
|
|
334
|
-
const scanLineHeight = useMemo(() => scale(SCAN_LINE_HEIGHT), []);
|
|
335
|
-
const scanLineStyle = useMemo(
|
|
336
|
-
() =>
|
|
337
|
-
createScanLineStyle(
|
|
338
|
-
margin,
|
|
339
|
-
scanLineHeight,
|
|
340
|
-
colors.button,
|
|
341
|
-
shadowColor,
|
|
342
|
-
translateY
|
|
343
|
-
),
|
|
344
|
-
[margin, scanLineHeight, colors.button, shadowColor, translateY]
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
// Corner positions
|
|
348
|
-
const cornerPositions: CornerPosition[] = ['tl', 'tr', 'bl', 'br'];
|
|
349
|
-
|
|
350
|
-
return (
|
|
351
|
-
<View style={styles.container} pointerEvents="box-none">
|
|
352
|
-
{/* Overlay sections */}
|
|
353
|
-
<View style={overlayStyles.top} />
|
|
354
|
-
<View style={overlayStyles.bottom} />
|
|
355
|
-
<View style={overlayStyles.left} />
|
|
356
|
-
<View style={overlayStyles.right} />
|
|
357
|
-
|
|
358
|
-
{/* Scan box */}
|
|
359
|
-
<View style={scanBoxStyle} pointerEvents="none">
|
|
360
|
-
{/* Corner markers */}
|
|
361
|
-
{cornerPositions.map((position) => (
|
|
362
|
-
<View key={position} style={getCornerStyle(position)} />
|
|
363
|
-
))}
|
|
364
|
-
|
|
365
|
-
{/* Animated scan line */}
|
|
366
|
-
<Animated.View style={scanLineStyle} />
|
|
367
|
-
</View>
|
|
368
|
-
</View>
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
const styles = StyleSheet.create({
|
|
374
|
-
container: {
|
|
375
|
-
...StyleSheet.absoluteFillObject,
|
|
376
|
-
zIndex: 10,
|
|
377
|
-
},
|
|
378
|
-
overlayTop: {
|
|
379
|
-
position: 'absolute',
|
|
380
|
-
left: 0,
|
|
381
|
-
right: 0,
|
|
382
|
-
zIndex: 1,
|
|
383
|
-
},
|
|
384
|
-
overlayBottom: {
|
|
385
|
-
position: 'absolute',
|
|
386
|
-
left: 0,
|
|
387
|
-
right: 0,
|
|
388
|
-
zIndex: 1,
|
|
389
|
-
},
|
|
390
|
-
overlaySide: {
|
|
391
|
-
position: 'absolute',
|
|
392
|
-
zIndex: 1,
|
|
393
|
-
},
|
|
394
|
-
scanBox: {
|
|
395
|
-
position: 'absolute',
|
|
396
|
-
justifyContent: 'center',
|
|
397
|
-
alignItems: 'center',
|
|
398
|
-
overflow: 'hidden',
|
|
399
|
-
zIndex: 2,
|
|
400
|
-
},
|
|
401
|
-
corner: {
|
|
402
|
-
position: 'absolute',
|
|
403
|
-
zIndex: 3,
|
|
404
|
-
},
|
|
405
|
-
corner_tl: {
|
|
406
|
-
top: 0,
|
|
407
|
-
left: 0,
|
|
408
|
-
},
|
|
409
|
-
corner_tr: {
|
|
410
|
-
top: 0,
|
|
411
|
-
right: 0,
|
|
412
|
-
},
|
|
413
|
-
corner_bl: {
|
|
414
|
-
bottom: 0,
|
|
415
|
-
left: 0,
|
|
416
|
-
},
|
|
417
|
-
corner_br: {
|
|
418
|
-
bottom: 0,
|
|
419
|
-
right: 0,
|
|
420
|
-
},
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
export default QrViewArea;
|