@zezosoft/zezo-ott-react-native-ui-kit 1.2.0 → 1.2.2
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/Auth/AuthProvider/AuthProvider.js +2 -2
- package/lib/module/components/Auth/AuthProvider/AuthProvider.js.map +1 -1
- package/lib/module/components/Auth/One/ForgotPassword/ForgotPassword.js +16 -16
- package/lib/module/components/Auth/One/ForgotPassword/ForgotPassword.js.map +1 -1
- package/lib/module/components/Auth/One/Login/LoginWithEmail.js +16 -16
- package/lib/module/components/Auth/One/Login/LoginWithEmail.js.map +1 -1
- package/lib/module/components/Auth/One/Login/LoginWithPhone.js +17 -17
- package/lib/module/components/Auth/One/Login/LoginWithPhone.js.map +1 -1
- package/lib/module/components/Auth/One/OTP/OTP.js +100 -67
- package/lib/module/components/Auth/One/OTP/OTP.js.map +1 -1
- package/lib/module/components/Auth/One/SignUp/SignUp.js +17 -17
- package/lib/module/components/Auth/One/SignUp/SignUp.js.map +1 -1
- package/lib/module/components/Auth/One/SplashScreen/SplashScreen.js +57 -76
- package/lib/module/components/Auth/One/SplashScreen/SplashScreen.js.map +1 -1
- package/lib/module/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.js +23 -26
- package/lib/module/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.js.map +1 -1
- package/lib/module/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.js +56 -18
- package/lib/module/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.js.map +1 -1
- package/lib/module/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.js +62 -71
- package/lib/module/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.js.map +1 -1
- package/lib/module/components/Auth/Two/AuthHeader/AuthHeader.js +20 -17
- package/lib/module/components/Auth/Two/AuthHeader/AuthHeader.js.map +1 -1
- package/lib/module/components/Auth/Two/ForgotPassword/ForgotPassword.js +11 -13
- package/lib/module/components/Auth/Two/ForgotPassword/ForgotPassword.js.map +1 -1
- package/lib/module/components/Auth/Two/Login/EmailOrPhoneLogin.js +489 -0
- package/lib/module/components/Auth/Two/Login/EmailOrPhoneLogin.js.map +1 -0
- package/lib/module/components/Auth/Two/OTP/OTP.js +90 -91
- package/lib/module/components/Auth/Two/OTP/OTP.js.map +1 -1
- package/lib/module/components/Auth/Two/SignUp/SignUp.js +49 -66
- package/lib/module/components/Auth/Two/SignUp/SignUp.js.map +1 -1
- package/lib/module/components/Auth/Two/index.js +3 -7
- package/lib/module/components/Auth/Two/index.js.map +1 -1
- package/lib/module/components/BackgroundLayout/{BackgroundLayout.js → One/One.js} +12 -9
- package/lib/module/components/BackgroundLayout/One/One.js.map +1 -0
- package/lib/module/components/BackgroundLayout/{BackgroundLayoutOne.js → Two/Two.js} +11 -5
- package/lib/module/components/BackgroundLayout/Two/Two.js.map +1 -0
- package/lib/module/components/BackgroundLayout/index.js +10 -0
- package/lib/module/components/BackgroundLayout/index.js.map +1 -0
- package/lib/module/components/ContentView/One/components/AboutSection.js +9 -18
- package/lib/module/components/ContentView/One/components/AboutSection.js.map +1 -1
- package/lib/module/components/ContentView/One/components/GenreTags.js +5 -1
- package/lib/module/components/ContentView/One/components/GenreTags.js.map +1 -1
- package/lib/module/components/ContentView/Two/components/AboutSection.js +4 -1
- package/lib/module/components/ContentView/Two/components/AboutSection.js.map +1 -1
- package/lib/module/components/ContentView/Two/components/Details.js +3 -0
- package/lib/module/components/ContentView/Two/components/Details.js.map +1 -1
- package/lib/module/components/ContentView/Two/components/GenreTags.js +4 -1
- package/lib/module/components/ContentView/Two/components/GenreTags.js.map +1 -1
- package/lib/module/components/ContentView/Two/components/SectionTabs.js +3 -0
- package/lib/module/components/ContentView/Two/components/SectionTabs.js.map +1 -1
- package/lib/module/components/ContentView/Two/components/Title.js.map +1 -1
- package/lib/module/components/Headers/One.js +1 -1
- package/lib/module/components/Input/Input.js +2 -4
- package/lib/module/components/Input/Input.js.map +1 -1
- package/lib/module/components/Input/InputThree.js +31 -33
- package/lib/module/components/Input/InputThree.js.map +1 -1
- package/lib/module/components/Input/InputTwo.js +1 -0
- package/lib/module/components/Input/InputTwo.js.map +1 -1
- package/lib/module/components/Input/{PhoneNumberInput.js → PhoneInput/One/One.js} +4 -4
- package/lib/module/components/Input/PhoneInput/One/One.js.map +1 -0
- package/lib/module/components/Input/{PhoneNumberInputTwo.js → PhoneInput/Two/Two.js} +2 -2
- package/lib/module/components/Input/PhoneInput/Two/Two.js.map +1 -0
- package/lib/module/components/Input/PhoneInput/index.js +15 -0
- package/lib/module/components/Input/PhoneInput/index.js.map +1 -0
- package/lib/module/components/Keyboard/HideKeyboard.js +1 -1
- package/lib/module/components/Keyboard/HideKeyboard.js.map +1 -1
- package/lib/module/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.js +4 -3
- package/lib/module/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.js.map +1 -1
- package/lib/module/components/Reels/ReelsSeries/Model/SettingModal.js +3 -1
- package/lib/module/components/Reels/ReelsSeries/Model/SettingModal.js.map +1 -1
- package/lib/module/components/Reels/ReelsSeries/ReelsSeriesItem.js +37 -6
- package/lib/module/components/Reels/ReelsSeries/ReelsSeriesItem.js.map +1 -1
- package/lib/module/components/Reels/ReelsSeries/components/VideoControls/QualityControl.js +9 -6
- package/lib/module/components/Reels/ReelsSeries/components/VideoControls/QualityControl.js.map +1 -1
- package/lib/module/components/Reels/ReelsSeries/utils/quality.js +19 -15
- package/lib/module/components/Reels/ReelsSeries/utils/quality.js.map +1 -1
- package/lib/module/hooks/useSplashCache.js +120 -85
- package/lib/module/hooks/useSplashCache.js.map +1 -1
- package/lib/typescript/src/components/Auth/One/ForgotPassword/ForgotPassword.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/Login/LoginWithEmail.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/Login/LoginWithPhone.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/OTP/OTP.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/SignUp/SignUp.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/SplashScreen/SplashScreen.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.d.ts +4 -0
- package/lib/typescript/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.d.ts +1 -0
- package/lib/typescript/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/One/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/Two/AuthHeader/AuthHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/Two/ForgotPassword/ForgotPassword.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/Two/Login/EmailOrPhoneLogin.d.ts +47 -0
- package/lib/typescript/src/components/Auth/Two/Login/EmailOrPhoneLogin.d.ts.map +1 -0
- package/lib/typescript/src/components/Auth/Two/OTP/OTP.d.ts +0 -12
- package/lib/typescript/src/components/Auth/Two/OTP/OTP.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/Two/SignUp/SignUp.d.ts +1 -17
- package/lib/typescript/src/components/Auth/Two/SignUp/SignUp.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/Two/index.d.ts +33 -85
- package/lib/typescript/src/components/Auth/Two/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/index.d.ts +33 -85
- package/lib/typescript/src/components/Auth/index.d.ts.map +1 -1
- package/lib/typescript/src/components/BackgroundLayout/{BackgroundLayout.d.ts → One/One.d.ts} +5 -5
- package/lib/typescript/src/components/BackgroundLayout/One/One.d.ts.map +1 -0
- package/lib/typescript/src/components/BackgroundLayout/{BackgroundLayoutOne.d.ts → Two/Two.d.ts} +4 -3
- package/lib/typescript/src/components/BackgroundLayout/Two/Two.d.ts.map +1 -0
- package/lib/typescript/src/components/BackgroundLayout/index.d.ts +20 -0
- package/lib/typescript/src/components/BackgroundLayout/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ContentView/One/components/AboutSection.d.ts +3 -3
- package/lib/typescript/src/components/ContentView/One/components/AboutSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/One/components/GenreTags.d.ts +1 -1
- package/lib/typescript/src/components/ContentView/One/components/GenreTags.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/AboutSection.d.ts +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/AboutSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/Details.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/GenreTags.d.ts +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/GenreTags.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/SectionTabs.d.ts +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/SectionTabs.d.ts.map +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/Title.d.ts +1 -1
- package/lib/typescript/src/components/ContentView/Two/components/Title.d.ts.map +1 -1
- package/lib/typescript/src/components/Input/Input.d.ts +4 -2
- package/lib/typescript/src/components/Input/Input.d.ts.map +1 -1
- package/lib/typescript/src/components/Input/InputThree.d.ts +0 -1
- package/lib/typescript/src/components/Input/InputThree.d.ts.map +1 -1
- package/lib/typescript/src/components/Input/InputTwo.d.ts.map +1 -1
- package/lib/typescript/src/components/Input/{PhoneNumberInput.d.ts → PhoneInput/One/One.d.ts} +4 -4
- package/lib/typescript/src/components/Input/PhoneInput/One/One.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/{PhoneNumberInputTwo.d.ts → PhoneInput/Two/Two.d.ts} +4 -4
- package/lib/typescript/src/components/Input/PhoneInput/Two/Two.d.ts.map +1 -0
- package/lib/typescript/src/components/Input/PhoneInput/index.d.ts +12 -0
- package/lib/typescript/src/components/Input/PhoneInput/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.d.ts +4 -2
- package/lib/typescript/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/Reels/ReelsSeries/Model/SettingModal.d.ts +5 -3
- package/lib/typescript/src/components/Reels/ReelsSeries/Model/SettingModal.d.ts.map +1 -1
- package/lib/typescript/src/components/Reels/ReelsSeries/ReelsSeriesItem.d.ts.map +1 -1
- package/lib/typescript/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.d.ts +5 -12
- package/lib/typescript/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.d.ts.map +1 -1
- package/lib/typescript/src/components/Reels/ReelsSeries/types.d.ts +4 -0
- package/lib/typescript/src/components/Reels/ReelsSeries/types.d.ts.map +1 -1
- package/lib/typescript/src/components/Reels/ReelsSeries/utils/quality.d.ts +1 -4
- package/lib/typescript/src/components/Reels/ReelsSeries/utils/quality.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useSplashCache.d.ts +7 -10
- package/lib/typescript/src/hooks/useSplashCache.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/module/components/Auth/Two/Login/AuthLoginShell.js +0 -138
- package/lib/module/components/Auth/Two/Login/AuthLoginShell.js.map +0 -1
- package/lib/module/components/Auth/Two/Login/LoginWithEmail.js +0 -226
- package/lib/module/components/Auth/Two/Login/LoginWithEmail.js.map +0 -1
- package/lib/module/components/Auth/Two/Login/LoginWithPhone.js +0 -143
- package/lib/module/components/Auth/Two/Login/LoginWithPhone.js.map +0 -1
- package/lib/module/components/BackgroundLayout/BackgroundLayout.js.map +0 -1
- package/lib/module/components/BackgroundLayout/BackgroundLayoutOne.js.map +0 -1
- package/lib/module/components/Input/PhoneNumberInput.js.map +0 -1
- package/lib/module/components/Input/PhoneNumberInputTwo.js.map +0 -1
- package/lib/typescript/src/components/Auth/Two/Login/AuthLoginShell.d.ts +0 -17
- package/lib/typescript/src/components/Auth/Two/Login/AuthLoginShell.d.ts.map +0 -1
- package/lib/typescript/src/components/Auth/Two/Login/LoginWithEmail.d.ts +0 -52
- package/lib/typescript/src/components/Auth/Two/Login/LoginWithEmail.d.ts.map +0 -1
- package/lib/typescript/src/components/Auth/Two/Login/LoginWithPhone.d.ts +0 -37
- package/lib/typescript/src/components/Auth/Two/Login/LoginWithPhone.d.ts.map +0 -1
- package/lib/typescript/src/components/BackgroundLayout/BackgroundLayout.d.ts.map +0 -1
- package/lib/typescript/src/components/BackgroundLayout/BackgroundLayoutOne.d.ts.map +0 -1
- package/lib/typescript/src/components/Input/PhoneNumberInput.d.ts.map +0 -1
- package/lib/typescript/src/components/Input/PhoneNumberInputTwo.d.ts.map +0 -1
|
@@ -10,27 +10,29 @@ import SplashImage from "./components/SplashImage/SplashImage.js";
|
|
|
10
10
|
import SplashVideo from "./components/SplashVideo/SplashVideo.js";
|
|
11
11
|
import SplashLottie from "./components/SplashLottie/SplashLottie.js";
|
|
12
12
|
import { useInternalTheme } from "../../../../theme/hook/useInternalTheme.js";
|
|
13
|
-
import { BackgroundLayout } from "../../../BackgroundLayout/BackgroundLayout.js";
|
|
14
13
|
import { useSplashCache } from "../../../../hooks/useSplashCache.js";
|
|
15
14
|
import { AppStatusBar } from "../../../common/AppStatusBar.js";
|
|
15
|
+
import { BackgroundLayout } from "../../../BackgroundLayout/index.js";
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const DEFAULT_IMAGE_TIMEOUT = 5;
|
|
18
18
|
const FALLBACK_TIMEOUT = 0.5;
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
const
|
|
20
|
+
// Stable module-level default — prevents a new object reference on every render
|
|
21
|
+
// when the caller omits the backgroundImage prop.
|
|
22
|
+
const DEFAULT_BG_IMAGE = {
|
|
23
|
+
gradientSplitBackground: 0.4,
|
|
24
|
+
resizeMode: 'cover'
|
|
25
|
+
};
|
|
23
26
|
export const SplashScreen = /*#__PURE__*/React.memo(({
|
|
24
27
|
splashScreenConfig,
|
|
25
28
|
innerContainerStyle,
|
|
26
|
-
backgroundImage =
|
|
27
|
-
gradientSplitBackground: 0.4,
|
|
28
|
-
resizeMode: 'cover'
|
|
29
|
-
},
|
|
29
|
+
backgroundImage = DEFAULT_BG_IMAGE,
|
|
30
30
|
onRedirect,
|
|
31
31
|
theme: overrideTheme
|
|
32
32
|
}) => {
|
|
33
|
-
|
|
33
|
+
const {
|
|
34
|
+
theme
|
|
35
|
+
} = useInternalTheme(overrideTheme);
|
|
34
36
|
const {
|
|
35
37
|
source: splashSource = '',
|
|
36
38
|
type: splashType = 'image',
|
|
@@ -42,23 +44,20 @@ export const SplashScreen = /*#__PURE__*/React.memo(({
|
|
|
42
44
|
resizeMode = 'contain',
|
|
43
45
|
backgroundColor: splashBgColor
|
|
44
46
|
} = splashScreenConfig || {};
|
|
47
|
+
const isImageSplash = splashType === 'image';
|
|
48
|
+
const isRemote = splashSource?.startsWith('http') ?? false;
|
|
45
49
|
|
|
46
|
-
//
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const backgroundImageUrl = useMemo(() => isImageSplash && backgroundImage.source?.startsWith('http') ? backgroundImage.source : undefined, [isImageSplash, backgroundImage.source]);
|
|
50
|
+
// Direct scalar derivation (slower to useMemo this than just to compute it)
|
|
51
|
+
const resolvedBgColor = splashBgColor || (splashType === 'video' || splashType === 'lottie-animation' ? '#000000' : theme.colors.background);
|
|
52
|
+
const backgroundImageUrl = isImageSplash && backgroundImage?.source?.startsWith('http') ? backgroundImage.source : undefined;
|
|
50
53
|
const {
|
|
51
54
|
data
|
|
52
55
|
} = useSplashCache({
|
|
53
56
|
logoUrl: isRemote ? splashSource : undefined,
|
|
54
57
|
backgroundUrl: backgroundImageUrl
|
|
55
58
|
});
|
|
56
|
-
const resolvedSplashUri =
|
|
57
|
-
const displayTimeout =
|
|
58
|
-
if (typeof screenTime === 'number' && screenTime > 0) return screenTime;
|
|
59
|
-
if (isImageSplash || isStatic) return DEFAULT_IMAGE_TIMEOUT;
|
|
60
|
-
return 0;
|
|
61
|
-
}, [screenTime, isImageSplash, isStatic]);
|
|
59
|
+
const resolvedSplashUri = isRemote && data.logoPath ? data.logoPath.startsWith('file://') ? data.logoPath : `file://${data.logoPath}` : splashSource || '';
|
|
60
|
+
const displayTimeout = typeof screenTime === 'number' && screenTime > 0 ? screenTime : isImageSplash || isStatic ? DEFAULT_IMAGE_TIMEOUT : 0;
|
|
62
61
|
const handleRedirect = useCallback(() => {
|
|
63
62
|
try {
|
|
64
63
|
onRedirect();
|
|
@@ -67,76 +66,58 @@ export const SplashScreen = /*#__PURE__*/React.memo(({
|
|
|
67
66
|
}
|
|
68
67
|
}, [onRedirect]);
|
|
69
68
|
useEffect(() => {
|
|
70
|
-
const
|
|
71
|
-
const timer = setTimeout(handleRedirect,
|
|
69
|
+
const ms = (displayTimeout > 0 ? displayTimeout : FALLBACK_TIMEOUT) * 1000;
|
|
70
|
+
const timer = setTimeout(handleRedirect, ms);
|
|
72
71
|
return () => clearTimeout(timer);
|
|
73
72
|
}, [displayTimeout, handleRedirect]);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
width,
|
|
77
|
-
height,
|
|
78
|
-
fullscreen,
|
|
79
|
-
resizeMode: resizeMode
|
|
80
|
-
}), [resolvedSplashUri, width, height, fullscreen, resizeMode]);
|
|
81
|
-
|
|
82
|
-
// Memoize file type checks
|
|
83
|
-
const isVideoFile = useMemo(() => VIDEO_EXTENSIONS.some(ext => resolvedSplashUri.toLowerCase().endsWith(ext)), [resolvedSplashUri]);
|
|
84
|
-
const isLottieFile = useMemo(() => LOTTIE_EXTENSIONS.some(ext => resolvedSplashUri.toLowerCase().endsWith(ext)), [resolvedSplashUri]);
|
|
85
|
-
|
|
86
|
-
// Memoize video onEnd handler
|
|
87
|
-
const videoOnEnd = useMemo(() => displayTimeout ? undefined : handleRedirect, [displayTimeout, handleRedirect]);
|
|
88
|
-
|
|
89
|
-
// Memoize lottie onAnimationFinish handler
|
|
90
|
-
const lottieOnAnimationFinish = useMemo(() => displayTimeout ? undefined : handleRedirect, [displayTimeout, handleRedirect]);
|
|
91
|
-
|
|
92
|
-
// Memoize BackgroundLayout props
|
|
93
|
-
const backgroundLayoutProps = useMemo(() => ({
|
|
94
|
-
backgroundImage: isImageSplash ? backgroundImage.source : undefined,
|
|
95
|
-
backgroundColor: splashBgColor,
|
|
96
|
-
resizeMode: backgroundImage.resizeMode ?? 'cover',
|
|
97
|
-
innerContainerStyle,
|
|
98
|
-
onImageError: backgroundImage.onImageError,
|
|
99
|
-
theme: overrideTheme,
|
|
100
|
-
gradientSplitBackground: backgroundImage.gradientSplitBackground ?? 0.4
|
|
101
|
-
}), [isImageSplash, backgroundImage.source, backgroundImage.resizeMode, backgroundImage.onImageError, backgroundImage.gradientSplitBackground, splashBgColor, innerContainerStyle, overrideTheme]);
|
|
73
|
+
const videoOnEnd = displayTimeout ? undefined : handleRedirect;
|
|
74
|
+
const lottieOnAnimationFinish = displayTimeout ? undefined : handleRedirect;
|
|
102
75
|
|
|
103
|
-
//
|
|
76
|
+
// Stability for the theme object passed as a single prop
|
|
104
77
|
const appStatusBarTheme = useMemo(() => ({
|
|
105
78
|
...overrideTheme,
|
|
106
79
|
dark: {
|
|
107
80
|
...overrideTheme?.dark,
|
|
108
|
-
background:
|
|
81
|
+
background: resolvedBgColor
|
|
109
82
|
},
|
|
110
83
|
light: {
|
|
111
84
|
...overrideTheme?.light,
|
|
112
|
-
background:
|
|
113
|
-
}
|
|
114
|
-
}), [overrideTheme, splashBgColor]);
|
|
115
|
-
const renderSplashContent = useCallback(() => {
|
|
116
|
-
switch (splashType) {
|
|
117
|
-
case 'video':
|
|
118
|
-
return isVideoFile ? /*#__PURE__*/_jsx(SplashVideo, {
|
|
119
|
-
...splashProps,
|
|
120
|
-
onEnd: videoOnEnd
|
|
121
|
-
}) : null;
|
|
122
|
-
case 'lottie-animation':
|
|
123
|
-
return isLottieFile ? /*#__PURE__*/_jsx(SplashLottie, {
|
|
124
|
-
...splashProps,
|
|
125
|
-
onAnimationFinish: lottieOnAnimationFinish
|
|
126
|
-
}) : null;
|
|
127
|
-
case 'image':
|
|
128
|
-
default:
|
|
129
|
-
return /*#__PURE__*/_jsx(SplashImage, {
|
|
130
|
-
...splashProps,
|
|
131
|
-
theme: overrideTheme
|
|
132
|
-
});
|
|
85
|
+
background: resolvedBgColor
|
|
133
86
|
}
|
|
134
|
-
}, [
|
|
135
|
-
return /*#__PURE__*/_jsxs(BackgroundLayout, {
|
|
136
|
-
|
|
87
|
+
}), [overrideTheme, resolvedBgColor]);
|
|
88
|
+
return /*#__PURE__*/_jsxs(BackgroundLayout.One, {
|
|
89
|
+
backgroundImage: isImageSplash ? backgroundImage.source : undefined,
|
|
90
|
+
backgroundColor: resolvedBgColor,
|
|
91
|
+
resizeMode: backgroundImage.resizeMode ?? 'cover',
|
|
92
|
+
innerContainerStyle: innerContainerStyle,
|
|
93
|
+
onImageError: backgroundImage.onImageError,
|
|
94
|
+
theme: overrideTheme,
|
|
95
|
+
gradientSplitBackground: backgroundImage.gradientSplitBackground ?? 0.4,
|
|
137
96
|
children: [/*#__PURE__*/_jsx(AppStatusBar, {
|
|
138
97
|
theme: appStatusBarTheme
|
|
139
|
-
}),
|
|
98
|
+
}), splashType === 'video' && resolvedSplashUri ? /*#__PURE__*/_jsx(SplashVideo, {
|
|
99
|
+
source: resolvedSplashUri,
|
|
100
|
+
width: width,
|
|
101
|
+
height: height,
|
|
102
|
+
fullscreen: fullscreen,
|
|
103
|
+
resizeMode: resizeMode,
|
|
104
|
+
backgroundColor: resolvedBgColor,
|
|
105
|
+
onEnd: videoOnEnd
|
|
106
|
+
}) : splashType === 'lottie-animation' && resolvedSplashUri ? /*#__PURE__*/_jsx(SplashLottie, {
|
|
107
|
+
source: resolvedSplashUri,
|
|
108
|
+
width: width,
|
|
109
|
+
height: height,
|
|
110
|
+
fullscreen: fullscreen,
|
|
111
|
+
resizeMode: resizeMode,
|
|
112
|
+
onAnimationFinish: lottieOnAnimationFinish
|
|
113
|
+
}) : splashType === 'image' || !resolvedSplashUri ? /*#__PURE__*/_jsx(SplashImage, {
|
|
114
|
+
source: resolvedSplashUri,
|
|
115
|
+
width: width,
|
|
116
|
+
height: height,
|
|
117
|
+
fullscreen: fullscreen,
|
|
118
|
+
resizeMode: resizeMode,
|
|
119
|
+
theme: overrideTheme
|
|
120
|
+
}) : null]
|
|
140
121
|
});
|
|
141
122
|
});
|
|
142
123
|
//# sourceMappingURL=SplashScreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useCallback","SplashImage","SplashVideo","SplashLottie","useInternalTheme","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useCallback","SplashImage","SplashVideo","SplashLottie","useInternalTheme","useSplashCache","AppStatusBar","BackgroundLayout","jsx","_jsx","jsxs","_jsxs","DEFAULT_IMAGE_TIMEOUT","FALLBACK_TIMEOUT","DEFAULT_BG_IMAGE","gradientSplitBackground","resizeMode","SplashScreen","memo","splashScreenConfig","innerContainerStyle","backgroundImage","onRedirect","theme","overrideTheme","source","splashSource","type","splashType","width","height","isStatic","screenTime","fullscreen","backgroundColor","splashBgColor","isImageSplash","isRemote","startsWith","resolvedBgColor","colors","background","backgroundImageUrl","undefined","data","logoUrl","backgroundUrl","resolvedSplashUri","logoPath","displayTimeout","handleRedirect","err","console","error","ms","timer","setTimeout","clearTimeout","videoOnEnd","lottieOnAnimationFinish","appStatusBarTheme","dark","light","One","onImageError","children","onEnd","onAnimationFinish"],"sourceRoot":"../../../../../../src","sources":["components/Auth/One/SplashScreen/SplashScreen.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,WAAW,QAAQ,OAAO;AAE9D,OAAOC,WAAW,M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MAAO;MACfG,UAAU,EAAEA,UAAW;MACvBjB,UAAU,EAAEA,UAAkB;MAC9BmD,iBAAiB,EAAER;IAAwB,CAC5C,CAAC,GACA/B,UAAU,KAAK,OAAO,IAAI,CAACmB,iBAAiB,gBAC9CtC,IAAA,CAACR,WAAW;MACVwB,MAAM,EAAEsB,iBAAkB;MAC1BlB,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA,MAAO;MACfG,UAAU,EAAEA,UAAW;MACvBjB,UAAU,EAAEA,UAAkB;MAC9BO,KAAK,EAAEC;IAAc,CACtB,CAAC,GACA,IAAI;EAAA,CACY,CAAC;AAE3B,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @author Naresh Dhamu
|
|
5
|
+
* @lastModified Thu 12 Jun 2025 at 09:22 AM
|
|
6
|
+
*/
|
|
7
|
+
import React, { useState, useMemo } from 'react';
|
|
4
8
|
import FastImage from 'react-native-fast-image';
|
|
5
9
|
import { ActivityIndicator, View, StyleSheet } from 'react-native';
|
|
6
10
|
import Display from "../../../../../../utils/Display.js";
|
|
7
11
|
import { useInternalTheme } from "../../../../../../theme/hook/useInternalTheme.js";
|
|
8
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const resolveUri = src => {
|
|
14
|
+
if (!src) return '';
|
|
15
|
+
if (src.startsWith('http') || src.startsWith('file://')) return src;
|
|
16
|
+
return `file://${src}`;
|
|
17
|
+
};
|
|
9
18
|
const SplashImage = ({
|
|
10
19
|
fullscreen,
|
|
11
20
|
height,
|
|
@@ -17,34 +26,22 @@ const SplashImage = ({
|
|
|
17
26
|
const {
|
|
18
27
|
theme
|
|
19
28
|
} = useInternalTheme(themeOverride);
|
|
20
|
-
const [isLoading, setIsLoading] = useState(!!source);
|
|
21
29
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
// Track which source the loading flag belongs to.
|
|
31
|
+
// When source changes, update isLoading in the same render (no useEffect,
|
|
32
|
+
// no extra paint) using React's supported "setState during render" pattern.
|
|
33
|
+
const [trackedSource, setTrackedSource] = useState(source);
|
|
34
|
+
const [isLoading, setIsLoading] = useState(!!source);
|
|
35
|
+
if (trackedSource !== source) {
|
|
36
|
+
setTrackedSource(source);
|
|
37
|
+
setIsLoading(!!source);
|
|
38
|
+
}
|
|
28
39
|
const imageStyles = useMemo(() => ({
|
|
29
40
|
width: fullscreen ? Display.fullWidth : width,
|
|
30
41
|
height: fullscreen ? Display.fullHeight : height,
|
|
31
42
|
flex: 1
|
|
32
43
|
}), [fullscreen, width, height]);
|
|
33
|
-
const
|
|
34
|
-
setIsLoading(false);
|
|
35
|
-
}, []);
|
|
36
|
-
const handleError = useCallback(() => {
|
|
37
|
-
setIsLoading(false);
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
// Memoize URI resolution
|
|
41
|
-
const resolvedUri = useMemo(() => {
|
|
42
|
-
if (!source) return '';
|
|
43
|
-
if (source.startsWith('http') || source.startsWith('https') || source.startsWith('file://')) return source;
|
|
44
|
-
return `file://${source}`;
|
|
45
|
-
}, [source]);
|
|
46
|
-
|
|
47
|
-
// Memoize image source
|
|
44
|
+
const resolvedUri = resolveUri(source);
|
|
48
45
|
const imageSource = useMemo(() => ({
|
|
49
46
|
uri: resolvedUri
|
|
50
47
|
}), [resolvedUri]);
|
|
@@ -57,10 +54,10 @@ const SplashImage = ({
|
|
|
57
54
|
color: theme.colors.primary
|
|
58
55
|
}), /*#__PURE__*/_jsx(FastImage, {
|
|
59
56
|
source: imageSource,
|
|
60
|
-
onLoadEnd:
|
|
57
|
+
onLoadEnd: () => setIsLoading(false),
|
|
58
|
+
onError: () => setIsLoading(false),
|
|
61
59
|
style: imageStyles,
|
|
62
|
-
resizeMode: resizeMode
|
|
63
|
-
onError: handleError
|
|
60
|
+
resizeMode: resizeMode
|
|
64
61
|
})]
|
|
65
62
|
});
|
|
66
63
|
};
|
package/lib/module/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useMemo","
|
|
1
|
+
{"version":3,"names":["React","useState","useMemo","FastImage","ActivityIndicator","View","StyleSheet","Display","useInternalTheme","jsx","_jsx","jsxs","_jsxs","resolveUri","src","startsWith","SplashImage","fullscreen","height","resizeMode","source","width","theme","themeOverride","trackedSource","setTrackedSource","isLoading","setIsLoading","imageStyles","fullWidth","fullHeight","flex","resolvedUri","imageSource","uri","style","styles","container","children","size","loader","color","colors","primary","onLoadEnd","onError","create","justifyContent","alignItems","position","memo"],"sourceRoot":"../../../../../../../../src","sources":["components/Auth/One/SplashScreen/components/SplashImage/SplashImage.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,SAASC,iBAAiB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAClE,OAAOC,OAAO,MAAM,oCAAiC;AACrD,SAASC,gBAAgB,QAAQ,kDAA+C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAajF,MAAMC,UAAU,GAAIC,GAAW,IAAa;EAC1C,IAAI,CAACA,GAAG,EAAE,OAAO,EAAE;EACnB,IAAIA,GAAG,CAACC,UAAU,CAAC,MAAM,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE,OAAOD,GAAG;EACnE,OAAO,UAAUA,GAAG,EAAE;AACxB,CAAC;AAED,MAAME,WAAuC,GAAGA,CAAC;EAC/CC,UAAU;EACVC,MAAM;EACNC,UAAU,GAAG,SAAS;EACtBC,MAAM;EACNC,KAAK;EACLC,KAAK,EAAEC;AACT,CAAC,K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E;MACrCkB,OAAO,EAAEA,CAAA,KAAMlB,YAAY,CAAC,KAAK,CAAE;MACnCQ,KAAK,EAAEP,WAAY;MACnBT,UAAU,EAAEA;IAAW,CACxB,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAED,MAAMiB,MAAM,GAAG9B,UAAU,CAACwC,MAAM,CAAC;EAC/BT,SAAS,EAAE;IACTN,IAAI,EAAE,CAAC;IACPV,KAAK,EAAEd,OAAO,CAACsB,SAAS;IACxBX,MAAM,EAAEX,OAAO,CAACuB,UAAU;IAC1BiB,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDR,MAAM,EAAE;IACNS,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,4BAAejD,KAAK,CAACkD,IAAI,CAAClC,WAAW,CAAC","ignoreList":[]}
|
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
* @author Naresh Dhamu
|
|
5
5
|
* @lastModified Thu 12 Jun 2025 at 09:22 AM
|
|
6
6
|
*/
|
|
7
|
-
import React, { useMemo,
|
|
7
|
+
import React, { useMemo, useEffect, useState } from 'react';
|
|
8
8
|
import LottieView from 'lottie-react-native';
|
|
9
9
|
import { StyleSheet } from 'react-native';
|
|
10
|
+
import RNFS from 'react-native-fs';
|
|
10
11
|
import Display from "../../../../../../utils/Display.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const isLocalPath = src => src.startsWith('file://') || src.startsWith('/');
|
|
14
|
+
const toFsPath = src => src.startsWith('file://') ? src.slice(7) : src;
|
|
15
|
+
const toFileUri = src => src.startsWith('file://') ? src : `file://${src}`;
|
|
16
|
+
const isLocalJson = src => isLocalPath(src) && src.toLowerCase().endsWith('.json');
|
|
17
|
+
const onFailure = err => console.error('[SplashLottie] Animation failed to load:', err);
|
|
12
18
|
const SplashLottie = ({
|
|
13
19
|
fullscreen,
|
|
14
20
|
height,
|
|
@@ -17,28 +23,60 @@ const SplashLottie = ({
|
|
|
17
23
|
width,
|
|
18
24
|
onAnimationFinish
|
|
19
25
|
}) => {
|
|
20
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Synchronous resolution for all non-JSON sources:
|
|
28
|
+
* - remote http(s) URL → { uri: source }
|
|
29
|
+
* - local .lottie file → { uri: 'file://...' }
|
|
30
|
+
* - local .json file → null (async state below handles it)
|
|
31
|
+
* - unknown → { uri: source }
|
|
32
|
+
*
|
|
33
|
+
* This avoids an extra render for the common cases (remote URL / .lottie).
|
|
34
|
+
*/
|
|
35
|
+
const syncSource = useMemo(() => {
|
|
36
|
+
if (!source || isLocalJson(source)) return null;
|
|
37
|
+
return {
|
|
38
|
+
uri: isLocalPath(source) ? toFileUri(source) : source
|
|
39
|
+
};
|
|
40
|
+
}, [source]);
|
|
41
|
+
|
|
42
|
+
// Only used for local .json files — requires async RNFS read
|
|
43
|
+
const [jsonSource, setJsonSource] = useState(null);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!isLocalJson(source)) {
|
|
46
|
+
setJsonSource(null);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let cancelled = false;
|
|
50
|
+
const fsPath = toFsPath(toFileUri(source));
|
|
51
|
+
const fileUri = toFileUri(source);
|
|
52
|
+
(async () => {
|
|
53
|
+
try {
|
|
54
|
+
if (!(await RNFS.exists(fsPath))) {
|
|
55
|
+
if (!cancelled) setJsonSource({
|
|
56
|
+
uri: fileUri
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const parsed = JSON.parse(await RNFS.readFile(fsPath, 'utf8'));
|
|
61
|
+
if (!cancelled) setJsonSource(parsed);
|
|
62
|
+
} catch {
|
|
63
|
+
if (!cancelled) setJsonSource({
|
|
64
|
+
uri: fileUri
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
return () => {
|
|
69
|
+
cancelled = true;
|
|
70
|
+
};
|
|
71
|
+
}, [source]);
|
|
72
|
+
const lottieSource = isLocalJson(source) ? jsonSource : syncSource;
|
|
21
73
|
const lottieStyle = useMemo(() => ({
|
|
22
74
|
...styles.base,
|
|
23
75
|
width: fullscreen ? Display.fullWidth : width,
|
|
24
76
|
height: fullscreen ? Display.fullHeight : height,
|
|
25
77
|
...(fullscreen ? styles.fullscreen : {})
|
|
26
78
|
}), [fullscreen, width, height]);
|
|
27
|
-
|
|
28
|
-
// Memoize Lottie source
|
|
29
|
-
const lottieSource = useMemo(() => ({
|
|
30
|
-
uri: source
|
|
31
|
-
}), [source]);
|
|
32
|
-
|
|
33
|
-
// Memoize error handler
|
|
34
|
-
const handleAnimationFailure = useCallback(error => {
|
|
35
|
-
console.error('Lottie animation failed to load:', error);
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
// Early return if invalid source
|
|
39
|
-
if (!source) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
79
|
+
if (!source || !lottieSource) return null;
|
|
42
80
|
return /*#__PURE__*/_jsx(LottieView, {
|
|
43
81
|
source: lottieSource,
|
|
44
82
|
autoPlay: true,
|
|
@@ -46,7 +84,7 @@ const SplashLottie = ({
|
|
|
46
84
|
onAnimationFinish: onAnimationFinish,
|
|
47
85
|
style: lottieStyle,
|
|
48
86
|
resizeMode: resizeMode,
|
|
49
|
-
onAnimationFailure:
|
|
87
|
+
onAnimationFailure: onFailure,
|
|
50
88
|
hardwareAccelerationAndroid: true,
|
|
51
89
|
cacheComposition: true
|
|
52
90
|
});
|
package/lib/module/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","
|
|
1
|
+
{"version":3,"names":["React","useMemo","useEffect","useState","LottieView","StyleSheet","RNFS","Display","jsx","_jsx","isLocalPath","src","startsWith","toFsPath","slice","toFileUri","isLocalJson","toLowerCase","endsWith","onFailure","err","console","error","SplashLottie","fullscreen","height","source","resizeMode","width","onAnimationFinish","syncSource","uri","jsonSource","setJsonSource","cancelled","fsPath","fileUri","exists","parsed","JSON","parse","readFile","lottieSource","lottieStyle","styles","base","fullWidth","fullHeight","autoPlay","loop","style","onAnimationFailure","hardwareAccelerationAndroid","cacheComposition","create","alignSelf","flex","memo"],"sourceRoot":"../../../../../../../../src","sources":["components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,OAAO,MAAM,oCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAatD,MAAMC,WAAW,GAAIC,GAAW,IAC9BA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,MAAMC,QAAQ,GAAIF,GAAW,IAC3BA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,GAAGD,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,GAAGH,GAAG;AAChD,MAAMI,SAAS,GAAIJ,GAAW,IAC5BA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,GAAGD,GAAG,GAAG,UAAUA,GAAG,EAAE;AACnD,MAAMK,WAAW,GAAIL,GAAW,IAC9BD,WAAW,CAACC,GAAG,CAAC,IAAIA,GAAG,CAACM,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,OAAO,CAAC;AAEzD,MAAMC,SAAS,GAAIC,GAAQ,IACzBC,OAAO,CAACC,KAAK,CAAC,0CAA0C,EAAEF,GAAG,CAAC;AAEhE,MAAMG,YAA8B,GAAGA,CAAC;EACtCC,UAAU;EACVC,MAAM;EACNC,MAAM;EACNC,UAAU,GAAG,SAAS;EACtBC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ;AACF;A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E,CAACR,MAAM,CAAC,CAAC;EAEZ,MAAMgB,YAAY,GAAG1B,WAAW,CAACU,MAAM,CAAC,GAAGM,UAAU,GAAGF,UAAU;EAElE,MAAMa,WAAW,GAAG1C,OAAO,CACzB,OAAO;IACL,GAAG2C,MAAM,CAACC,IAAI;IACdjB,KAAK,EAAEJ,UAAU,GAAGjB,OAAO,CAACuC,SAAS,GAAGlB,KAAK;IAC7CH,MAAM,EAAED,UAAU,GAAGjB,OAAO,CAACwC,UAAU,GAAGtB,MAAM;IAChD,IAAID,UAAU,GAAGoB,MAAM,CAACpB,UAAU,GAAG,CAAC,CAAC;EACzC,CAAC,CAAC,EACF,CAACA,UAAU,EAAEI,KAAK,EAAEH,MAAM,CAC5B,CAAC;EAED,IAAI,CAACC,MAAM,IAAI,CAACgB,YAAY,EAAE,OAAO,IAAI;EAEzC,oBACEjC,IAAA,CAACL,UAAU;IACTsB,MAAM,EAAEgB,YAAoB;IAC5BM,QAAQ;IACRC,IAAI,EAAE,KAAM;IACZpB,iBAAiB,EAAEA,iBAAkB;IACrCqB,KAAK,EAAEP,WAAY;IACnBhB,UAAU,EAAEA,UAAW;IACvBwB,kBAAkB,EAAEhC,SAAU;IAC9BiC,2BAA2B;IAC3BC,gBAAgB;EAAA,CACjB,CAAC;AAEN,CAAC;AAED,MAAMT,MAAM,GAAGvC,UAAU,CAACiD,MAAM,CAAC;EAC/BT,IAAI,EAAE;IAAEU,SAAS,EAAE;EAAS,CAAC;EAC7B/B,UAAU,EAAE;IAAEgC,IAAI,EAAE;EAAE;AACxB,CAAC,CAAC;AAEF,4BAAexD,KAAK,CAACyD,IAAI,CAAClC,YAAY,CAAC","ignoreList":[]}
|
|
@@ -6,17 +6,43 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, { useMemo, useCallback, useRef, useEffect } from 'react';
|
|
9
|
-
import { StyleSheet, Animated, useWindowDimensions } from 'react-native';
|
|
9
|
+
import { StyleSheet, Animated, useWindowDimensions, View } from 'react-native';
|
|
10
10
|
import Video from 'react-native-video';
|
|
11
11
|
import Display from "../../../../../../utils/Display.js";
|
|
12
|
-
import { View } from "../../../../../View/index.js";
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const BUFFER_CONFIG = {
|
|
14
|
+
minBufferMs: 2000,
|
|
15
|
+
maxBufferMs: 10000,
|
|
16
|
+
bufferForPlaybackMs: 1000,
|
|
17
|
+
bufferForPlaybackAfterRebufferMs: 2000
|
|
18
|
+
};
|
|
19
|
+
const CONTROLS_HIDDEN = {
|
|
20
|
+
hideForward: true,
|
|
21
|
+
hideDuration: true,
|
|
22
|
+
hideFullscreen: true,
|
|
23
|
+
hidePlayPause: true,
|
|
24
|
+
hideNavigationBarOnFullScreenMode: true,
|
|
25
|
+
hideNotificationBarOnFullScreenMode: true,
|
|
26
|
+
hideNext: true,
|
|
27
|
+
hidePosition: true,
|
|
28
|
+
hidePrevious: true,
|
|
29
|
+
hideRewind: true,
|
|
30
|
+
hideSeekBar: true,
|
|
31
|
+
hideSettingButton: true
|
|
32
|
+
};
|
|
33
|
+
const resolveUri = src => {
|
|
34
|
+
if (!src) return '';
|
|
35
|
+
if (/^(https?|file):\/\//.test(src)) return src;
|
|
36
|
+
if (src.startsWith('/')) return `file://${src}`;
|
|
37
|
+
return src;
|
|
38
|
+
};
|
|
14
39
|
const SplashVideo = ({
|
|
15
40
|
fullscreen = true,
|
|
16
41
|
width,
|
|
17
42
|
height,
|
|
18
43
|
source,
|
|
19
44
|
resizeMode = 'cover',
|
|
45
|
+
backgroundColor = '#000000',
|
|
20
46
|
onEnd,
|
|
21
47
|
onLoadStart,
|
|
22
48
|
onLoaded,
|
|
@@ -27,93 +53,57 @@ const SplashVideo = ({
|
|
|
27
53
|
width: windowWidth,
|
|
28
54
|
height: windowHeight
|
|
29
55
|
} = useWindowDimensions();
|
|
30
|
-
|
|
31
|
-
|
|
56
|
+
const animateIn = useCallback(() => {
|
|
57
|
+
Animated.timing(fadeAnim, {
|
|
58
|
+
toValue: 1,
|
|
59
|
+
duration: 300,
|
|
60
|
+
useNativeDriver: true
|
|
61
|
+
}).start();
|
|
62
|
+
}, [fadeAnim]);
|
|
32
63
|
const videoStyle = useMemo(() => {
|
|
33
|
-
if (fullscreen) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const w = width ?? windowWidth ?? Display.fullWidth;
|
|
40
|
-
const h = height ?? windowHeight ?? Display.fullHeight;
|
|
64
|
+
if (fullscreen) return {
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: '100%'
|
|
67
|
+
};
|
|
41
68
|
return {
|
|
42
|
-
width:
|
|
43
|
-
height:
|
|
69
|
+
width: width ?? windowWidth ?? Display.fullWidth,
|
|
70
|
+
height: height ?? windowHeight ?? Display.fullHeight
|
|
44
71
|
};
|
|
45
72
|
}, [fullscreen, width, height, windowWidth, windowHeight]);
|
|
46
|
-
|
|
47
|
-
/** 🎨 Fullscreen wrapper fills container so video covers entire screen on any device */
|
|
48
73
|
const wrapperStyle = useMemo(() => fullscreen ? [StyleSheet.absoluteFillObject, {
|
|
49
74
|
opacity: fadeAnim
|
|
50
75
|
}] : [videoStyle, {
|
|
51
76
|
opacity: fadeAnim,
|
|
52
77
|
position: 'absolute'
|
|
53
78
|
}], [fullscreen, videoStyle, fadeAnim]);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
toValue: 1,
|
|
59
|
-
duration: 400,
|
|
60
|
-
useNativeDriver: true
|
|
61
|
-
}).start();
|
|
62
|
-
}, [fadeAnim]);
|
|
63
|
-
|
|
64
|
-
/** 📦 Resolve video URI */
|
|
65
|
-
const resolveUri = useCallback(src => {
|
|
66
|
-
if (!src) return '';
|
|
67
|
-
if (/^(https?|file):\/\//.test(src)) return src;
|
|
68
|
-
return `file://${src}`;
|
|
69
|
-
}, []);
|
|
70
|
-
|
|
71
|
-
/** 🔄 Video lifecycle handlers */
|
|
79
|
+
const resolvedUri = useMemo(() => resolveUri(source), [source]);
|
|
80
|
+
const videoSource = useMemo(() => ({
|
|
81
|
+
uri: resolvedUri
|
|
82
|
+
}), [resolvedUri]);
|
|
72
83
|
const handleLoadStart = useCallback(() => {
|
|
73
84
|
fadeAnim.setValue(0);
|
|
74
85
|
onLoadStart?.();
|
|
75
86
|
}, [fadeAnim, onLoadStart]);
|
|
76
87
|
const handleLoad = useCallback(data => {
|
|
77
|
-
animateIn();
|
|
78
88
|
onLoaded?.(data);
|
|
79
|
-
}, [
|
|
89
|
+
}, [onLoaded]);
|
|
90
|
+
const handleReadyForDisplay = useCallback(() => {
|
|
91
|
+
animateIn();
|
|
92
|
+
}, [animateIn]);
|
|
80
93
|
const handleError = useCallback(err => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
const msg = err?.error?.message || err?.message || JSON.stringify(err) || 'Unknown video error';
|
|
95
|
+
console.warn('[SplashVideo] Error:', msg);
|
|
96
|
+
onError?.(msg);
|
|
97
|
+
animateIn();
|
|
98
|
+
}, [onError, animateIn]);
|
|
86
99
|
useEffect(() => {
|
|
87
100
|
return () => fadeAnim.stopAnimation();
|
|
88
101
|
}, [fadeAnim]);
|
|
89
|
-
|
|
90
|
-
// Memoize resolved URI
|
|
91
|
-
const resolvedUri = useMemo(() => resolveUri(source), [source, resolveUri]);
|
|
92
|
-
|
|
93
|
-
// Memoize video source
|
|
94
|
-
const videoSource = useMemo(() => ({
|
|
95
|
-
uri: resolvedUri
|
|
96
|
-
}), [resolvedUri]);
|
|
97
|
-
|
|
98
|
-
// Memoize controls styles
|
|
99
|
-
const controlsStyles = useMemo(() => ({
|
|
100
|
-
hideForward: true,
|
|
101
|
-
hideDuration: true,
|
|
102
|
-
hideFullscreen: true,
|
|
103
|
-
hidePlayPause: true,
|
|
104
|
-
hideNavigationBarOnFullScreenMode: true,
|
|
105
|
-
hideNotificationBarOnFullScreenMode: true,
|
|
106
|
-
hideNext: true,
|
|
107
|
-
hidePosition: true,
|
|
108
|
-
hidePrevious: true,
|
|
109
|
-
hideRewind: true,
|
|
110
|
-
hideSeekBar: true,
|
|
111
|
-
hideSettingButton: true
|
|
112
|
-
}), []);
|
|
113
|
-
|
|
114
|
-
/** 🧱 Render */
|
|
102
|
+
if (!resolvedUri) return null;
|
|
115
103
|
return /*#__PURE__*/_jsx(View, {
|
|
116
|
-
style: styles.container,
|
|
104
|
+
style: [styles.container, {
|
|
105
|
+
backgroundColor
|
|
106
|
+
}],
|
|
117
107
|
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
118
108
|
style: wrapperStyle,
|
|
119
109
|
children: /*#__PURE__*/_jsx(Video, {
|
|
@@ -123,14 +113,16 @@ const SplashVideo = ({
|
|
|
123
113
|
paused: false,
|
|
124
114
|
onLoadStart: handleLoadStart,
|
|
125
115
|
onLoad: handleLoad,
|
|
116
|
+
onReadyForDisplay: handleReadyForDisplay,
|
|
126
117
|
onError: handleError,
|
|
127
118
|
onEnd: onEnd,
|
|
128
|
-
controlsStyles:
|
|
119
|
+
controlsStyles: CONTROLS_HIDDEN,
|
|
120
|
+
shutterColor: backgroundColor,
|
|
129
121
|
ignoreSilentSwitch: "obey",
|
|
130
122
|
playInBackground: false,
|
|
131
123
|
playWhenInactive: false,
|
|
132
124
|
allowsExternalPlayback: false,
|
|
133
|
-
|
|
125
|
+
bufferConfig: BUFFER_CONFIG,
|
|
134
126
|
controls: false,
|
|
135
127
|
repeat: false
|
|
136
128
|
})
|
|
@@ -142,7 +134,6 @@ const styles = StyleSheet.create({
|
|
|
142
134
|
flex: 1,
|
|
143
135
|
width: '100%',
|
|
144
136
|
height: '100%',
|
|
145
|
-
position: 'relative',
|
|
146
137
|
alignSelf: 'stretch'
|
|
147
138
|
},
|
|
148
139
|
video: {
|