@applicaster/zapp-react-native-ui-components 14.0.0-alpha.4011674803 → 14.0.0-alpha.4055325032
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/mobile/Layout.tsx +9 -4
- package/Components/AudioPlayer/mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap +1 -1
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +1 -1
- package/Components/AudioPlayer/mobile/index.tsx +4 -14
- package/Components/AudioPlayer/tv/Artwork.tsx +3 -2
- package/Components/AudioPlayer/tv/Channel.tsx +7 -7
- package/Components/AudioPlayer/tv/Layout.tsx +100 -93
- package/Components/AudioPlayer/tv/Runtime.tsx +7 -1
- package/Components/AudioPlayer/tv/Summary.tsx +6 -2
- package/Components/AudioPlayer/tv/Title.tsx +6 -2
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/Runtime.test.js.snap +2 -2
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +21 -27
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +8 -17
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/summary.test.js.snap +1 -2
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/title.test.js.snap +1 -2
- package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +4 -0
- package/Components/AudioPlayer/tv/index.tsx +9 -15
- package/Components/Cell/index.js +6 -2
- package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
- package/Components/Focusable/index.android.tsx +12 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +11 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
- package/Components/MasterCell/index.tsx +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +16 -10
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useModalSize.ts +18 -2
- package/Components/VideoModal/utils.ts +6 -0
- package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
- package/package.json +5 -8
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Channel /> renders correctly 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<Image
|
|
5
|
+
fadeDuration={0}
|
|
6
|
+
source={
|
|
7
|
+
{
|
|
8
|
+
"uri": "https://example.com",
|
|
9
|
+
}
|
|
10
|
+
}
|
|
5
11
|
style={
|
|
6
12
|
{
|
|
7
13
|
"height": 72,
|
|
@@ -9,20 +15,5 @@ exports[`<Channel /> renders correctly 1`] = `
|
|
|
9
15
|
"width": 128,
|
|
10
16
|
}
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
<Image
|
|
14
|
-
fadeDuration={0}
|
|
15
|
-
source={
|
|
16
|
-
{
|
|
17
|
-
"uri": "https://example.com",
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
style={
|
|
21
|
-
{
|
|
22
|
-
"height": 72,
|
|
23
|
-
"width": 128,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/>
|
|
27
|
-
</View>
|
|
18
|
+
/>
|
|
28
19
|
`;
|
|
@@ -3,6 +3,10 @@ import { render } from "@testing-library/react-native";
|
|
|
3
3
|
|
|
4
4
|
import { AudioPlayerTV } from "..";
|
|
5
5
|
|
|
6
|
+
jest.mock("@applicaster/zapp-react-native-utils/audioPlayerUtils", () => ({
|
|
7
|
+
useArtworkImage: jest.fn(() => "artwork_url"),
|
|
8
|
+
}));
|
|
9
|
+
|
|
6
10
|
const audioPlayerProps = {
|
|
7
11
|
audio_item: {
|
|
8
12
|
title: "tittle",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
-
import {
|
|
4
|
+
import { useArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
5
5
|
|
|
6
6
|
import { AudioPlayerTVLayout } from "./Layout";
|
|
7
7
|
|
|
@@ -17,6 +17,8 @@ export function AudioPlayerTV(props: Props) {
|
|
|
17
17
|
const { audio_item, plugin_configuration, style = {} } = props;
|
|
18
18
|
const { extensions, title, summary } = audio_item;
|
|
19
19
|
|
|
20
|
+
const artwork = useArtworkImage(audio_item);
|
|
21
|
+
|
|
20
22
|
const getProp = useCallback(
|
|
21
23
|
getPropertyFromEntryOrConfig({
|
|
22
24
|
entry: audio_item,
|
|
@@ -33,6 +35,11 @@ export function AudioPlayerTV(props: Props) {
|
|
|
33
35
|
const backgroundImage = getProp("audio_player_background_image");
|
|
34
36
|
const channelIcon = getProp("audio_player_channel_icon");
|
|
35
37
|
const rtlFlag = getProp("audio_player_rtl");
|
|
38
|
+
|
|
39
|
+
const backgroundImageOverlay = getProp(
|
|
40
|
+
"audio_player_background_image_overlay"
|
|
41
|
+
);
|
|
42
|
+
|
|
36
43
|
const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
|
|
37
44
|
|
|
38
45
|
const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
|
|
@@ -111,23 +118,10 @@ export function AudioPlayerTV(props: Props) {
|
|
|
111
118
|
runTimeFontSize,
|
|
112
119
|
channelIcon,
|
|
113
120
|
artworkBorderRadius,
|
|
121
|
+
backgroundImageOverlay,
|
|
114
122
|
};
|
|
115
123
|
}, [getProp]);
|
|
116
124
|
|
|
117
|
-
const artwork = getArtworkImage({
|
|
118
|
-
key: "audio_player_artwork_image_key",
|
|
119
|
-
entry: audio_item,
|
|
120
|
-
plugin_configuration,
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// console.log("debug_2", "AudioPlayer", {
|
|
124
|
-
// config,
|
|
125
|
-
// // mobileConfig,
|
|
126
|
-
// audio_item,
|
|
127
|
-
// plugin_configuration,
|
|
128
|
-
// artwork,
|
|
129
|
-
// });
|
|
130
|
-
|
|
131
125
|
return (
|
|
132
126
|
<AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
|
|
133
127
|
<Channel srcImage={config?.channelIcon} config={config} />
|
package/Components/Cell/index.js
CHANGED
|
@@ -3,11 +3,15 @@ import * as R from "ramda";
|
|
|
3
3
|
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
4
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
HorizontalScrollContext,
|
|
8
|
+
RiverOffsetContext,
|
|
9
|
+
ScreenScrollingContext,
|
|
10
|
+
} from "../../Contexts";
|
|
11
|
+
|
|
7
12
|
import { CellComponent } from "./Cell";
|
|
8
13
|
import { TvOSCellComponent } from "./TvOSCellComponent";
|
|
9
14
|
import { withConsumer } from "../../Contexts/HeaderOffsetContext";
|
|
10
|
-
import { ScreenScrollingContext } from "../../Contexts/ScreenScrollingContext";
|
|
11
15
|
|
|
12
16
|
import { ScreenLayoutContextConsumer } from "../../Contexts/ScreenLayoutContext";
|
|
13
17
|
import { createContext } from "@applicaster/zapp-react-native-utils/reactUtils/createContext";
|
|
@@ -38,6 +38,9 @@ describe("Focusable", () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it("updates disableFocus state when disableFocus prop changes", () => {
|
|
41
|
+
const unregister = jest.fn();
|
|
42
|
+
mockFocusManager.registerFocusable.mockReturnValue(unregister);
|
|
43
|
+
|
|
41
44
|
const { rerender } = render(
|
|
42
45
|
<Focusable id="test-id" disableFocus={false}>
|
|
43
46
|
<Touchable testID="touchable" />
|
|
@@ -43,11 +43,13 @@ export const FocusableContext = React.createContext<
|
|
|
43
43
|
// eslint-disable-next-line
|
|
44
44
|
setIsFocusable: (enableFocus: boolean) => void;
|
|
45
45
|
ref: FocusManager.FocusableRef;
|
|
46
|
+
parentFocusableId: Option<string>;
|
|
46
47
|
} & ParentFocus
|
|
47
48
|
>({
|
|
48
49
|
focused: false,
|
|
49
50
|
setIsFocusable: () => {},
|
|
50
51
|
ref: { current: null },
|
|
52
|
+
parentFocusableId: undefined,
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
export const useFocusable = () => React.useContext(FocusableContext);
|
|
@@ -74,7 +76,7 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
74
76
|
|
|
75
77
|
const isRTL = useIsRTL();
|
|
76
78
|
const focusManager = useFocusManager();
|
|
77
|
-
const { ref:
|
|
79
|
+
const { ref: parentFocusableRef, parentFocusableId } = useFocusable();
|
|
78
80
|
const touchableRef = React.useRef(null);
|
|
79
81
|
|
|
80
82
|
const [focused, setFocused] = React.useState(() =>
|
|
@@ -98,13 +100,14 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
98
100
|
}
|
|
99
101
|
}, [disableFocus]);
|
|
100
102
|
|
|
101
|
-
React.
|
|
103
|
+
React.useLayoutEffect(() => {
|
|
102
104
|
if (id) {
|
|
103
|
-
const unregister = focusManager.registerFocusable(
|
|
105
|
+
const unregister = focusManager.registerFocusable({
|
|
104
106
|
touchableRef,
|
|
105
|
-
|
|
106
|
-
isFocusableCell
|
|
107
|
-
|
|
107
|
+
parentFocusableRef,
|
|
108
|
+
isFocusableCell,
|
|
109
|
+
parentFocusableId,
|
|
110
|
+
});
|
|
108
111
|
|
|
109
112
|
onRegister();
|
|
110
113
|
|
|
@@ -112,7 +115,7 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
112
115
|
unregister();
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
|
-
}, [id, onRegister, isFocusableCell]);
|
|
118
|
+
}, [id, onRegister, isFocusableCell, parentFocusableId]);
|
|
116
119
|
|
|
117
120
|
if (R.isNil(id)) {
|
|
118
121
|
// eslint-disable-next-line no-console
|
|
@@ -164,8 +167,9 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
164
167
|
...parentFocus,
|
|
165
168
|
ref: touchableRef,
|
|
166
169
|
setIsFocusable,
|
|
170
|
+
parentFocusableId: id,
|
|
167
171
|
};
|
|
168
|
-
}, [parentFocus, focused]);
|
|
172
|
+
}, [parentFocus, focused, id]);
|
|
169
173
|
|
|
170
174
|
return (
|
|
171
175
|
<Touchable
|
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
8
8
|
import {
|
|
9
9
|
useDimensions,
|
|
10
|
+
useIsTablet as isTablet,
|
|
10
11
|
useNavigation,
|
|
11
12
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
13
|
|
|
13
14
|
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
14
15
|
import { PlayerContainer } from "../PlayerContainer";
|
|
15
16
|
import { useModalSize } from "../VideoModal/hooks";
|
|
17
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
16
18
|
|
|
17
19
|
type Props = {
|
|
18
20
|
item: ZappEntry;
|
|
@@ -83,6 +85,13 @@ type PlayableComponent = {
|
|
|
83
85
|
Component: React.ComponentType<any>;
|
|
84
86
|
};
|
|
85
87
|
|
|
88
|
+
const dimensionsContext: "window" | "screen" = platformSelect({
|
|
89
|
+
android_tv: "window",
|
|
90
|
+
amazon: "window",
|
|
91
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
92
|
+
default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
|
|
93
|
+
});
|
|
94
|
+
|
|
86
95
|
export function HandlePlayable({
|
|
87
96
|
item,
|
|
88
97
|
isModal,
|
|
@@ -135,7 +144,8 @@ export function HandlePlayable({
|
|
|
135
144
|
});
|
|
136
145
|
}, [casting]);
|
|
137
146
|
|
|
138
|
-
const { width: screenWidth, height: screenHeight } =
|
|
147
|
+
const { width: screenWidth, height: screenHeight } =
|
|
148
|
+
useDimensions(dimensionsContext);
|
|
139
149
|
|
|
140
150
|
const modalSize = useModalSize();
|
|
141
151
|
|
|
@@ -2,7 +2,6 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { ImageStyle } from "react-native";
|
|
3
3
|
import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
|
-
import * as R from "ramda";
|
|
6
5
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
6
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
8
7
|
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
@@ -67,32 +66,10 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
67
66
|
const handleFocus = (focusable) => {
|
|
68
67
|
const focusedButtonId = getFocusedButtonId(focusable);
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const right = left + width;
|
|
75
|
-
|
|
76
|
-
const boundingRect = {
|
|
77
|
-
x,
|
|
78
|
-
y,
|
|
79
|
-
pageX,
|
|
80
|
-
pageY,
|
|
81
|
-
width,
|
|
82
|
-
height,
|
|
83
|
-
top,
|
|
84
|
-
bottom,
|
|
85
|
-
left,
|
|
86
|
-
right,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
otherProps?.onToggleFocus?.({
|
|
90
|
-
focusable: {
|
|
91
|
-
getRect: R.always(boundingRect),
|
|
92
|
-
},
|
|
93
|
-
focusedButtonId,
|
|
94
|
-
mouse: focusable.mouse,
|
|
95
|
-
});
|
|
69
|
+
otherProps?.onToggleFocus?.({
|
|
70
|
+
focusable: wrapperRef.current,
|
|
71
|
+
focusedButtonId,
|
|
72
|
+
mouse: focusable.mouse,
|
|
96
73
|
});
|
|
97
74
|
|
|
98
75
|
if (ttsLabel) {
|
|
@@ -86,7 +86,7 @@ export function masterCellBuilder({
|
|
|
86
86
|
entry: item,
|
|
87
87
|
state: getEntryState(state, entryIsSelected),
|
|
88
88
|
}),
|
|
89
|
-
[state, item
|
|
89
|
+
[state, item, entryIsSelected] // Assuming that item won't mutate
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
const wrapperRef = React.useRef(null);
|
|
@@ -88,7 +88,7 @@ export const VideoModalMode = {
|
|
|
88
88
|
MAXIMIZED: "MAXIMIZED",
|
|
89
89
|
MINIMIZED: "MINIMIZED",
|
|
90
90
|
FULLSCREEN: "FULLSCREEN",
|
|
91
|
-
};
|
|
91
|
+
} as const;
|
|
92
92
|
|
|
93
93
|
export type PlayNextData = {
|
|
94
94
|
state: PlayNextState;
|
|
@@ -127,7 +127,7 @@ const webStyles = {
|
|
|
127
127
|
playerScreen: {
|
|
128
128
|
flex: 1,
|
|
129
129
|
height: "100vh",
|
|
130
|
-
|
|
130
|
+
backgroundColor: "black",
|
|
131
131
|
},
|
|
132
132
|
playerWrapper: {
|
|
133
133
|
height: "100%",
|
|
@@ -135,9 +135,6 @@ const webStyles = {
|
|
|
135
135
|
},
|
|
136
136
|
inlineRiver: {
|
|
137
137
|
height: INLINE_CONTAINER_CONTENT_HEIGHT,
|
|
138
|
-
|
|
139
|
-
borderWidth: 4,
|
|
140
|
-
borderColor: "yellow",
|
|
141
138
|
},
|
|
142
139
|
};
|
|
143
140
|
|
|
@@ -148,7 +145,6 @@ const nativeStyles = {
|
|
|
148
145
|
},
|
|
149
146
|
playerScreen: {
|
|
150
147
|
flex: 1,
|
|
151
|
-
backgroundColor: "black",
|
|
152
148
|
overflow: "hidden",
|
|
153
149
|
},
|
|
154
150
|
playerWrapper: {
|
|
@@ -568,8 +564,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
568
564
|
const isInlineTV = isInlineTVUtil(screenData);
|
|
569
565
|
|
|
570
566
|
const inline =
|
|
571
|
-
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
572
|
-
|
|
567
|
+
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
568
|
+
mode as any
|
|
569
|
+
) || isInlineTV;
|
|
573
570
|
|
|
574
571
|
const value = React.useMemo(
|
|
575
572
|
() => ({ playerId: state.playerId }),
|
|
@@ -590,7 +587,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
590
587
|
);
|
|
591
588
|
}
|
|
592
589
|
|
|
593
|
-
if (
|
|
590
|
+
if (
|
|
591
|
+
screen_background_color &&
|
|
592
|
+
mode !== VideoModalMode.FULLSCREEN &&
|
|
593
|
+
isTV()
|
|
594
|
+
) {
|
|
594
595
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
595
596
|
}
|
|
596
597
|
|
|
@@ -620,6 +621,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
620
621
|
playNextData,
|
|
621
622
|
};
|
|
622
623
|
|
|
624
|
+
const pointerEventsProp = mode === "MINIMIZED" ? "box-none" : "auto";
|
|
625
|
+
|
|
623
626
|
return (
|
|
624
627
|
<PlayerStateContext.Provider value={value}>
|
|
625
628
|
<PlayerContainerContextProvider
|
|
@@ -640,14 +643,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
640
643
|
preferredFocus
|
|
641
644
|
shouldUsePreferredFocus
|
|
642
645
|
groupId={groupId}
|
|
646
|
+
pointerEvents={pointerEventsProp}
|
|
643
647
|
>
|
|
644
648
|
{/* Video player and components */}
|
|
645
649
|
<View
|
|
646
650
|
style={styles.playerScreen}
|
|
647
651
|
testID={"player-screen-container"}
|
|
652
|
+
pointerEvents={pointerEventsProp}
|
|
648
653
|
>
|
|
649
654
|
{/* Player container */}
|
|
650
655
|
<View
|
|
656
|
+
pointerEvents={pointerEventsProp}
|
|
651
657
|
style={[
|
|
652
658
|
styles.playerWrapper,
|
|
653
659
|
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
@@ -719,7 +725,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
719
725
|
key={item.id}
|
|
720
726
|
groupId={FocusableGroupMainContainerId}
|
|
721
727
|
cellTapAction={onCellTap}
|
|
722
|
-
extraAnchorPointYOffset={
|
|
728
|
+
extraAnchorPointYOffset={0}
|
|
723
729
|
isScreenWrappedInContainer={true}
|
|
724
730
|
containerHeight={styles.inlineRiver.height}
|
|
725
731
|
componentsMapExtraProps={{
|
|
@@ -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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { Animated } from "react-native";
|
|
2
|
+
import { Animated, Dimensions } from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
useSafeAreaInsets,
|
|
@@ -23,6 +23,7 @@ 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>;
|
|
26
27
|
isActiveGesture: boolean;
|
|
27
28
|
playerAnimationState: PlayerAnimationStateT;
|
|
28
29
|
setPlayerAnimationState: (value: PlayerAnimationStateT) => void;
|
|
@@ -48,6 +49,7 @@ export type ModalAnimationContextT = {
|
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
52
|
+
yTranslate: React.createRef<Animated.Value | null>(),
|
|
51
53
|
isActiveGesture: false,
|
|
52
54
|
playerAnimationState: null,
|
|
53
55
|
setPlayerAnimationState: () => null,
|
|
@@ -73,6 +75,10 @@ export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
73
75
|
});
|
|
74
76
|
|
|
75
77
|
const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
78
|
+
const yTranslate = React.useRef(
|
|
79
|
+
new Animated.Value(Dimensions.get("window").height)
|
|
80
|
+
);
|
|
81
|
+
|
|
76
82
|
const [playerAnimationState, setPlayerAnimationState] =
|
|
77
83
|
React.useState<PlayerAnimationStateT>(null);
|
|
78
84
|
|
|
@@ -100,6 +106,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
100
106
|
// Reset player animation state when video modal is closed
|
|
101
107
|
if (!visible) {
|
|
102
108
|
resetPlayerAnimationState();
|
|
109
|
+
yTranslate.current?.setValue(Dimensions.get("window").height);
|
|
103
110
|
}
|
|
104
111
|
}, [visible, resetPlayerAnimationState]);
|
|
105
112
|
|
|
@@ -141,6 +148,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
141
148
|
return (
|
|
142
149
|
<ReactContext.Provider
|
|
143
150
|
value={{
|
|
151
|
+
yTranslate,
|
|
144
152
|
startComponentsAnimation,
|
|
145
153
|
setStartComponentsAnimation,
|
|
146
154
|
isActiveGesture: playerAnimationState !== null,
|
|
@@ -11,6 +11,8 @@ 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";
|
|
14
16
|
|
|
15
17
|
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
16
18
|
|
|
@@ -26,6 +28,10 @@ type Props = {
|
|
|
26
28
|
isTabletLandscape?: boolean;
|
|
27
29
|
isAudioPlayer?: boolean;
|
|
28
30
|
isTablet?: boolean;
|
|
31
|
+
inline?: any;
|
|
32
|
+
docked?: boolean;
|
|
33
|
+
isModal?: boolean;
|
|
34
|
+
pip?: boolean;
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
const containerStyle = ({
|
|
@@ -42,8 +48,24 @@ export const PlayerDetails = ({
|
|
|
42
48
|
configuration,
|
|
43
49
|
isTabletLandscape = false,
|
|
44
50
|
isAudioPlayer,
|
|
45
|
-
|
|
51
|
+
inline,
|
|
52
|
+
docked,
|
|
53
|
+
isModal,
|
|
54
|
+
pip,
|
|
46
55
|
}: 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();
|
|
47
69
|
const screenData = useTargetScreenData(entry);
|
|
48
70
|
const insets = useSafeAreaInsets();
|
|
49
71
|
|
|
@@ -79,7 +101,7 @@ export const PlayerDetails = ({
|
|
|
79
101
|
}
|
|
80
102
|
}, [isAudioPlayer]);
|
|
81
103
|
|
|
82
|
-
if (isNilOrEmpty(screenData?.ui_components)) {
|
|
104
|
+
if (isNilOrEmpty(screenData?.ui_components) || !isShowPlayerDetails) {
|
|
83
105
|
return null;
|
|
84
106
|
}
|
|
85
107
|
|