@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5621117258 → 14.0.0-alpha.6335583720
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/Components/AudioPlayer/index.tsx +15 -0
- package/Components/AudioPlayer/mobile/Layout.tsx +63 -0
- package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -8
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +23 -0
- package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +31 -72
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +3 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +1 -2
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +19 -58
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +7 -22
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -5
- package/Components/River/RiverItem.tsx +8 -8
- package/Components/River/TV/River.tsx +0 -3
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -6
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -9
- package/Components/VideoModal/PlayerDetails.tsx +2 -24
- package/Components/VideoModal/PlayerWrapper.tsx +142 -26
- package/Components/VideoModal/VideoModal.tsx +17 -3
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +240 -44
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
- package/Components/VideoModal/hooks/index.ts +2 -0
- package/Components/VideoModal/hooks/useBackgroundColor.ts +10 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/Components/VideoModal/utils.ts +0 -6
- package/index.d.ts +0 -1
- package/package.json +5 -5
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -72
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- /package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +0 -0
- /package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
- /package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +0 -0
- /package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +0 -0
- /package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
export type Props = {
|
|
4
|
+
audio_item: ZappEntry & {
|
|
5
|
+
extensions?: {
|
|
6
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
7
|
+
audio_player_background_image?: string;
|
|
8
|
+
audio_player_background_color?: string;
|
|
9
|
+
audio_player_channel_icon?: string;
|
|
10
|
+
audio_player_title_color?: string;
|
|
11
|
+
audio_player_summary_color?: string;
|
|
12
|
+
audio_player_rtl?: boolean;
|
|
13
|
+
audio_player_background_image_default_color?: string;
|
|
14
|
+
start_time?: string;
|
|
15
|
+
end_time?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
plugin_configuration: {
|
|
19
|
+
audio_player_background_color?: string;
|
|
20
|
+
audio_player_title_color?: string;
|
|
21
|
+
audio_player_summary_color?: string;
|
|
22
|
+
audio_player_rtl?: string;
|
|
23
|
+
audio_player_background_image_default_color?: string;
|
|
24
|
+
audio_player_background_image?: string;
|
|
25
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
26
|
+
lg_tv_audio_player_title_font_family?: string;
|
|
27
|
+
lg_tv_audio_player_title_font_size?: number;
|
|
28
|
+
lg_tv_audio_player_summary_font_family?: string;
|
|
29
|
+
lg_tv_audio_player_summary_font_size?: number;
|
|
30
|
+
samsung_tv_audio_player_title_font_family?: string;
|
|
31
|
+
samsung_tv_audio_player_title_font_size?: number;
|
|
32
|
+
samsung_tv_audio_player_summary_font_family?: string;
|
|
33
|
+
samsung_tv_audio_player_summary_font_size?: number;
|
|
34
|
+
tv_os_audio_player_title_font_family?: string;
|
|
35
|
+
tv_os_audio_player_title_font_size?: number;
|
|
36
|
+
tv_os_audio_player_summary_font_family?: string;
|
|
37
|
+
tv_os_audio_player_summary_font_size?: number;
|
|
38
|
+
};
|
|
39
|
+
style?: ViewStyle;
|
|
40
|
+
};
|
|
@@ -30,7 +30,6 @@ export const GeneralContentScreen = ({
|
|
|
30
30
|
isScreenWrappedInContainer,
|
|
31
31
|
componentsMapExtraProps = {},
|
|
32
32
|
focused,
|
|
33
|
-
extraOffset,
|
|
34
33
|
parentFocus,
|
|
35
34
|
containerHeight,
|
|
36
35
|
preferredFocus = false,
|
|
@@ -122,7 +121,6 @@ export const GeneralContentScreen = ({
|
|
|
122
121
|
isScreenWrappedInContainer={isScreenWrappedInContainer}
|
|
123
122
|
parentFocus={parentFocus}
|
|
124
123
|
focused={focused}
|
|
125
|
-
extraOffset={extraOffset}
|
|
126
124
|
containerHeight={containerHeight}
|
|
127
125
|
preferredFocus={preferredFocus}
|
|
128
126
|
{...componentsMapExtraProps}
|
|
@@ -88,7 +88,7 @@ export const VideoModalMode = {
|
|
|
88
88
|
MAXIMIZED: "MAXIMIZED",
|
|
89
89
|
MINIMIZED: "MINIMIZED",
|
|
90
90
|
FULLSCREEN: "FULLSCREEN",
|
|
91
|
-
}
|
|
91
|
+
};
|
|
92
92
|
|
|
93
93
|
export type PlayNextData = {
|
|
94
94
|
state: PlayNextState;
|
|
@@ -105,11 +105,6 @@ const isTvOS = isTvOSPlatform();
|
|
|
105
105
|
// height for container with additional content below player
|
|
106
106
|
const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
|
|
107
107
|
|
|
108
|
-
// Default Y offset for anchor points on non-Android TV platforms
|
|
109
|
-
const DEFAULT_OFFSET_Y = -600;
|
|
110
|
-
|
|
111
|
-
const EXTRA_ANCHOR_POINT_Y_OFFSET = isAndroidTV ? 0 : DEFAULT_OFFSET_Y;
|
|
112
|
-
|
|
113
108
|
const withBorderHack = () => {
|
|
114
109
|
if (isAndroidTV) {
|
|
115
110
|
/* @HACK: see GH#7269 */
|
|
@@ -132,7 +127,7 @@ const webStyles = {
|
|
|
132
127
|
playerScreen: {
|
|
133
128
|
flex: 1,
|
|
134
129
|
height: "100vh",
|
|
135
|
-
|
|
130
|
+
background: "black",
|
|
136
131
|
},
|
|
137
132
|
playerWrapper: {
|
|
138
133
|
height: "100%",
|
|
@@ -570,9 +565,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
570
565
|
const isInlineTV = isInlineTVUtil(screenData);
|
|
571
566
|
|
|
572
567
|
const inline =
|
|
573
|
-
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
574
|
-
|
|
575
|
-
) || isInlineTV;
|
|
568
|
+
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
|
|
569
|
+
isInlineTV;
|
|
576
570
|
|
|
577
571
|
const value = React.useMemo(
|
|
578
572
|
() => ({ playerId: state.playerId }),
|
|
@@ -593,11 +587,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
593
587
|
);
|
|
594
588
|
}
|
|
595
589
|
|
|
596
|
-
if (
|
|
597
|
-
screen_background_color &&
|
|
598
|
-
mode !== VideoModalMode.FULLSCREEN &&
|
|
599
|
-
isTV()
|
|
600
|
-
) {
|
|
590
|
+
if (screen_background_color && mode !== VideoModalMode.FULLSCREEN) {
|
|
601
591
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
602
592
|
}
|
|
603
593
|
|
|
@@ -647,17 +637,14 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
647
637
|
preferredFocus
|
|
648
638
|
shouldUsePreferredFocus
|
|
649
639
|
groupId={groupId}
|
|
650
|
-
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
651
640
|
>
|
|
652
641
|
{/* Video player and components */}
|
|
653
642
|
<View
|
|
654
643
|
style={styles.playerScreen}
|
|
655
644
|
testID={"player-screen-container"}
|
|
656
|
-
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
657
645
|
>
|
|
658
646
|
{/* Player container */}
|
|
659
647
|
<View
|
|
660
|
-
pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
|
|
661
648
|
style={[
|
|
662
649
|
styles.playerWrapper,
|
|
663
650
|
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
@@ -729,13 +716,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
729
716
|
key={item.id}
|
|
730
717
|
groupId={FocusableGroupMainContainerId}
|
|
731
718
|
cellTapAction={onCellTap}
|
|
732
|
-
extraAnchorPointYOffset={
|
|
733
|
-
EXTRA_ANCHOR_POINT_Y_OFFSET
|
|
734
|
-
}
|
|
719
|
+
extraAnchorPointYOffset={0}
|
|
735
720
|
isScreenWrappedInContainer={true}
|
|
736
721
|
containerHeight={styles.inlineRiver.height}
|
|
737
722
|
componentsMapExtraProps={{
|
|
738
|
-
isNestedComponentsMap:
|
|
723
|
+
isNestedComponentsMap: true,
|
|
739
724
|
}}
|
|
740
725
|
/>
|
|
741
726
|
)}
|
|
@@ -28,7 +28,7 @@ const PlayerImageBackgroundComponent = ({
|
|
|
28
28
|
defaultImageDimensions,
|
|
29
29
|
}: Props) => {
|
|
30
30
|
const source = React.useMemo(
|
|
31
|
-
() => ({ uri: imageSrcFromMediaItem(entry, imageKey) }),
|
|
31
|
+
() => ({ uri: imageSrcFromMediaItem(entry, [imageKey]) }),
|
|
32
32
|
[imageKey, entry]
|
|
33
33
|
);
|
|
34
34
|
|
|
@@ -281,8 +281,8 @@ function ComponentsMapComponent(props: Props) {
|
|
|
281
281
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
282
282
|
extraData={feed}
|
|
283
283
|
stickyHeaderIndices={stickyHeaderIndices}
|
|
284
|
-
onLayout={handleOnLayout}
|
|
285
284
|
removeClippedSubviews={isAndroid}
|
|
285
|
+
onLayout={handleOnLayout}
|
|
286
286
|
initialNumToRender={3}
|
|
287
287
|
maxToRenderPerBatch={10}
|
|
288
288
|
windowSize={12}
|
|
@@ -303,10 +303,6 @@ function ComponentsMapComponent(props: Props) {
|
|
|
303
303
|
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
304
304
|
onScrollEndDrag={_onScrollEndDrag}
|
|
305
305
|
scrollEventThrottle={16}
|
|
306
|
-
maintainVisibleContentPosition={{
|
|
307
|
-
minIndexForVisible: 0,
|
|
308
|
-
autoscrollToTopThreshold: 10,
|
|
309
|
-
}}
|
|
310
306
|
{...scrollViewExtraProps}
|
|
311
307
|
/>
|
|
312
308
|
</ViewportTracker>
|
|
@@ -39,6 +39,10 @@ function getFeedUrl(feed: ZappFeed, index: number) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
const isNextIndex = (index, readyIndex) => {
|
|
43
|
+
return readyIndex + 1 >= index;
|
|
44
|
+
};
|
|
45
|
+
|
|
42
46
|
/**
|
|
43
47
|
* useLoadingState for RiverItemComponent
|
|
44
48
|
* takes currentIndex and loadingState as arguments
|
|
@@ -48,24 +52,20 @@ const useLoadingState = (
|
|
|
48
52
|
loadingState: RiverItemType["loadingState"]
|
|
49
53
|
) => {
|
|
50
54
|
const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
|
|
51
|
-
loadingState.getValue().index
|
|
55
|
+
isNextIndex(currentIndex, loadingState.getValue().index)
|
|
52
56
|
);
|
|
53
57
|
|
|
54
58
|
useEffect(() => {
|
|
55
59
|
const subscription = loadingState.subscribe(({ index }) => {
|
|
56
|
-
if (index
|
|
60
|
+
if (isNextIndex(currentIndex, index)) {
|
|
57
61
|
setReadyToBeDisplayed(true);
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
|
|
61
|
-
if (loadingState.getValue().index + 1 >= currentIndex) {
|
|
62
|
-
setReadyToBeDisplayed(true);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
65
|
return () => {
|
|
66
66
|
subscription.unsubscribe();
|
|
67
67
|
};
|
|
68
|
-
}, [
|
|
68
|
+
}, [currentIndex]);
|
|
69
69
|
|
|
70
70
|
return readyToBeDisplayed;
|
|
71
71
|
};
|
|
@@ -151,7 +151,7 @@ function RiverItemComponent(props: RiverItemType) {
|
|
|
151
151
|
component={item}
|
|
152
152
|
componentIndex={index}
|
|
153
153
|
onLoadFailed={onLoadFailed}
|
|
154
|
-
onLoadFinished={() => onLoadFinished(index)}
|
|
154
|
+
onLoadFinished={() => onLoadFinished(index)}
|
|
155
155
|
groupId={groupId}
|
|
156
156
|
feedUrl={feedUrl}
|
|
157
157
|
isLast={isLast}
|
|
@@ -26,7 +26,6 @@ type Props = {
|
|
|
26
26
|
componentsMapExtraProps?: any;
|
|
27
27
|
isInsideContainer?: boolean;
|
|
28
28
|
extraAnchorPointYOffset: number;
|
|
29
|
-
extraOffset: number;
|
|
30
29
|
river?: ZappRiver | ZappEntry;
|
|
31
30
|
};
|
|
32
31
|
|
|
@@ -39,7 +38,6 @@ export const River = (props: Props) => {
|
|
|
39
38
|
componentsMapExtraProps,
|
|
40
39
|
isInsideContainer,
|
|
41
40
|
extraAnchorPointYOffset,
|
|
42
|
-
extraOffset,
|
|
43
41
|
} = props;
|
|
44
42
|
|
|
45
43
|
const { title: screenTitle, summary: screenSummary } = useNavbarState();
|
|
@@ -120,7 +118,6 @@ export const River = (props: Props) => {
|
|
|
120
118
|
<GeneralContentScreen
|
|
121
119
|
feed={feedData}
|
|
122
120
|
screenId={screenId}
|
|
123
|
-
extraOffset={extraOffset}
|
|
124
121
|
isScreenWrappedInContainer={isInsideContainer}
|
|
125
122
|
extraAnchorPointYOffset={extraAnchorPointYOffset}
|
|
126
123
|
componentsMapExtraProps={componentsMapExtraProps}
|
|
@@ -135,12 +135,6 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
135
135
|
getItemCount={[Function]}
|
|
136
136
|
initialNumToRender={3}
|
|
137
137
|
keyExtractor={[Function]}
|
|
138
|
-
maintainVisibleContentPosition={
|
|
139
|
-
{
|
|
140
|
-
"autoscrollToTopThreshold": 10,
|
|
141
|
-
"minIndexForVisible": 0,
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
138
|
maxToRenderPerBatch={10}
|
|
145
139
|
onContentSizeChange={[Function]}
|
|
146
140
|
onLayout={[Function]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, ViewStyle } from "react-native";
|
|
3
3
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
4
4
|
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
6
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
6
7
|
|
|
7
8
|
interface IProps {
|
|
8
9
|
targetScreenId?: string;
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
style?: ViewStyle;
|
|
11
|
-
|
|
12
|
+
extraVerticalOffset: Option<number>;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
type CombinedProps = IProps & ViewProps;
|
|
15
15
|
/**
|
|
16
16
|
* The MarginTop is essentially a feature used for managing the visibility of components on your screen.
|
|
17
17
|
* A more accurate term for this might be something like a 'component visibility threshold' or 'cut-off point'.
|
|
@@ -47,7 +47,7 @@ export const useMarginTop = (targetScreenId: string): number => {
|
|
|
47
47
|
|
|
48
48
|
// Empty string means that value is blank in the CMS. Fallback to theme
|
|
49
49
|
if (String(screenData?.styles?.screen_margin_top) === "") {
|
|
50
|
-
return
|
|
50
|
+
return toNumberWithDefault(0, theme.screen_margin_top);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -58,28 +58,29 @@ export const useMarginTop = (targetScreenId: string): number => {
|
|
|
58
58
|
*/
|
|
59
59
|
if (screenData?.styles?.screen_margin_top === undefined) {
|
|
60
60
|
if (isGeneralContentScreen || supportsUiComponents) {
|
|
61
|
-
return
|
|
61
|
+
return toNumberWithDefault(0, theme.screen_margin_top);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
return 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return toNumberWithDefault(0, screenData?.styles?.screen_margin_top);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const TopMarginApplicator: React.FC<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
export const TopMarginApplicator: React.FC<IProps> = ({
|
|
71
|
+
targetScreenId,
|
|
72
|
+
style,
|
|
73
|
+
children,
|
|
74
|
+
extraVerticalOffset,
|
|
75
|
+
}: IProps) => {
|
|
76
|
+
const extraOffset = toNumberWithDefault(0, extraVerticalOffset);
|
|
74
77
|
|
|
75
78
|
// HACK: Remove extraOffset when focusIssue with absolute elements is fixed on tvos
|
|
76
|
-
const marginTop = useMarginTop(
|
|
77
|
-
const style = { ...((props.style as {}) || {}), marginTop };
|
|
79
|
+
const marginTop = useMarginTop(targetScreenId);
|
|
78
80
|
|
|
79
|
-
// Then, spread the rest of the props on your returned JSX.
|
|
80
81
|
return (
|
|
81
|
-
<View
|
|
82
|
-
{
|
|
82
|
+
<View style={[style, { marginTop: marginTop + extraOffset }]}>
|
|
83
|
+
{children}
|
|
83
84
|
</View>
|
|
84
85
|
);
|
|
85
86
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { Animated
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
useSafeAreaInsets,
|
|
@@ -23,7 +23,6 @@ export enum PlayerAnimationStateEnum {
|
|
|
23
23
|
export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
24
24
|
|
|
25
25
|
export type ModalAnimationContextT = {
|
|
26
|
-
yTranslate: React.MutableRefObject<Animated.Value | null>;
|
|
27
26
|
isActiveGesture: boolean;
|
|
28
27
|
playerAnimationState: PlayerAnimationStateT;
|
|
29
28
|
setPlayerAnimationState: (value: PlayerAnimationStateT) => void;
|
|
@@ -49,7 +48,6 @@ export type ModalAnimationContextT = {
|
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
52
|
-
yTranslate: React.createRef<Animated.Value | null>(),
|
|
53
51
|
isActiveGesture: false,
|
|
54
52
|
playerAnimationState: null,
|
|
55
53
|
setPlayerAnimationState: () => null,
|
|
@@ -75,10 +73,6 @@ export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
75
73
|
});
|
|
76
74
|
|
|
77
75
|
const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
78
|
-
const yTranslate = React.useRef(
|
|
79
|
-
new Animated.Value(Dimensions.get("window").height)
|
|
80
|
-
);
|
|
81
|
-
|
|
82
76
|
const [playerAnimationState, setPlayerAnimationState] =
|
|
83
77
|
React.useState<PlayerAnimationStateT>(null);
|
|
84
78
|
|
|
@@ -106,7 +100,6 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
106
100
|
// Reset player animation state when video modal is closed
|
|
107
101
|
if (!visible) {
|
|
108
102
|
resetPlayerAnimationState();
|
|
109
|
-
yTranslate.current?.setValue(Dimensions.get("window").height);
|
|
110
103
|
}
|
|
111
104
|
}, [visible, resetPlayerAnimationState]);
|
|
112
105
|
|
|
@@ -148,7 +141,6 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
148
141
|
return (
|
|
149
142
|
<ReactContext.Provider
|
|
150
143
|
value={{
|
|
151
|
-
yTranslate,
|
|
152
144
|
startComponentsAnimation,
|
|
153
145
|
setStartComponentsAnimation,
|
|
154
146
|
isActiveGesture: playerAnimationState !== null,
|
|
@@ -11,8 +11,6 @@ import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactH
|
|
|
11
11
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
12
12
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
13
13
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
14
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
15
|
-
import { useDelayedPlayerDetails } from "./hooks";
|
|
16
14
|
|
|
17
15
|
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
18
16
|
|
|
@@ -28,10 +26,6 @@ type Props = {
|
|
|
28
26
|
isTabletLandscape?: boolean;
|
|
29
27
|
isAudioPlayer?: boolean;
|
|
30
28
|
isTablet?: boolean;
|
|
31
|
-
inline?: any;
|
|
32
|
-
docked?: boolean;
|
|
33
|
-
isModal?: boolean;
|
|
34
|
-
pip?: boolean;
|
|
35
29
|
};
|
|
36
30
|
|
|
37
31
|
const containerStyle = ({
|
|
@@ -48,24 +42,8 @@ export const PlayerDetails = ({
|
|
|
48
42
|
configuration,
|
|
49
43
|
isTabletLandscape = false,
|
|
50
44
|
isAudioPlayer,
|
|
51
|
-
|
|
52
|
-
docked,
|
|
53
|
-
isModal,
|
|
54
|
-
pip,
|
|
45
|
+
isTablet = false,
|
|
55
46
|
}: Props) => {
|
|
56
|
-
const isInlineModal = inline && isModal;
|
|
57
|
-
|
|
58
|
-
// Mounting the PlayerDetails component is a resource-intensive process.
|
|
59
|
-
// Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
|
|
60
|
-
// The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
|
|
61
|
-
// This helps to avoid blocking the rotation and any animations related to the rotation.
|
|
62
|
-
const isShowPlayerDetails = useDelayedPlayerDetails({
|
|
63
|
-
isInline: isInlineModal,
|
|
64
|
-
isDocked: docked,
|
|
65
|
-
isPip: pip,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const isTablet = useIsTablet();
|
|
69
47
|
const screenData = useTargetScreenData(entry);
|
|
70
48
|
const insets = useSafeAreaInsets();
|
|
71
49
|
|
|
@@ -101,7 +79,7 @@ export const PlayerDetails = ({
|
|
|
101
79
|
}
|
|
102
80
|
}, [isAudioPlayer]);
|
|
103
81
|
|
|
104
|
-
if (isNilOrEmpty(screenData?.ui_components)
|
|
82
|
+
if (isNilOrEmpty(screenData?.ui_components)) {
|
|
105
83
|
return null;
|
|
106
84
|
}
|
|
107
85
|
|