@applicaster/zapp-react-native-ui-components 14.0.0-alpha.8387612031 → 14.0.0-alpha.9567513212

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.
Files changed (41) hide show
  1. package/Components/AudioPlayer/{tv/index.tsx → AudioPlayer.tsx} +58 -19
  2. package/Components/AudioPlayer/{tv/Layout.tsx → AudioPlayerLayout.tsx} +72 -31
  3. package/Components/AudioPlayer/{mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap → __tests__/__snapshots__/audioPlayer.test.js.snap} +8 -2
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +72 -0
  5. package/Components/AudioPlayer/{tv/__tests__ → __tests__}/audioPlayer.test.js +3 -3
  6. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +26 -0
  7. package/Components/AudioPlayer/{tv/helpers.tsx → helpers.tsx} +2 -1
  8. package/Components/AudioPlayer/index.ts +1 -0
  9. package/Components/PlayerContainer/PlayerContainer.tsx +19 -7
  10. package/Components/PlayerImageBackground/index.tsx +1 -1
  11. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
  12. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  13. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  14. package/Components/VideoModal/VideoModal.tsx +3 -17
  15. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  16. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  17. package/Components/VideoModal/hooks/index.ts +0 -2
  18. package/Components/VideoModal/utils.ts +6 -0
  19. package/package.json +5 -5
  20. package/Components/AudioPlayer/index.tsx +0 -15
  21. package/Components/AudioPlayer/mobile/Layout.tsx +0 -63
  22. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +0 -18
  23. package/Components/AudioPlayer/mobile/index.tsx +0 -23
  24. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -170
  25. package/Components/AudioPlayer/types.ts +0 -40
  26. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
  27. /package/Components/AudioPlayer/{tv/Artwork.tsx → Artwork.tsx} +0 -0
  28. /package/Components/AudioPlayer/{tv/Channel.tsx → Channel.tsx} +0 -0
  29. /package/Components/AudioPlayer/{tv/Runtime.tsx → Runtime.tsx} +0 -0
  30. /package/Components/AudioPlayer/{tv/Summary.tsx → Summary.tsx} +0 -0
  31. /package/Components/AudioPlayer/{tv/Title.tsx → Title.tsx} +0 -0
  32. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/Runtime.test.js +0 -0
  33. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/Runtime.test.js.snap +0 -0
  34. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/artWork.test.js.snap +0 -0
  35. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/channel.test.js.snap +0 -0
  36. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/summary.test.js.snap +0 -0
  37. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/__snapshots__/title.test.js.snap +0 -0
  38. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/artWork.test.js +0 -0
  39. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/channel.test.js +0 -0
  40. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/summary.test.js +0 -0
  41. /package/Components/AudioPlayer/{tv/__tests__ → __tests__}/title.test.js +0 -0
@@ -1,20 +1,58 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
 
3
3
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
- import { getArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
5
4
 
6
- import { AudioPlayerTVLayout } from "./Layout";
5
+ import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
7
6
 
7
+ import { AudioPlayerLayout } from "./AudioPlayerLayout";
8
8
  import { Channel } from "./Channel";
9
9
  import { Title } from "./Title";
10
10
  import { Summary } from "./Summary";
11
11
  import { Runtime } from "./Runtime";
12
12
  import { getPropertyFromEntryOrConfig } from "./helpers";
13
-
14
- import { Props } from "../types";
15
-
16
- export function AudioPlayerTV(props: Props) {
17
- const { audio_item, plugin_configuration, style = {} } = props;
13
+ import { ViewStyle } from "react-native";
14
+
15
+ type Props = {
16
+ audio_item: ZappEntry & {
17
+ extensions?: {
18
+ audio_player_artwork_aspect_ratio?: string;
19
+ audio_player_background_image?: string;
20
+ audio_player_background_color?: string;
21
+ audio_player_channel_icon?: string;
22
+ audio_player_title_color?: string;
23
+ audio_player_summary_color?: string;
24
+ audio_player_rtl?: boolean;
25
+ audio_player_background_image_default_color?: string;
26
+ start_time?: string;
27
+ end_time?: string;
28
+ };
29
+ };
30
+ plugin_configuration: {
31
+ audio_player_background_color?: string;
32
+ audio_player_title_color?: string;
33
+ audio_player_summary_color?: string;
34
+ audio_player_rtl?: string;
35
+ audio_player_background_image_default_color?: string;
36
+ audio_player_background_image?: string;
37
+ audio_player_artwork_aspect_ratio?: string;
38
+ lg_tv_audio_player_title_font_family?: string;
39
+ lg_tv_audio_player_title_font_size?: number;
40
+ lg_tv_audio_player_summary_font_family?: string;
41
+ lg_tv_audio_player_summary_font_size?: number;
42
+ samsung_tv_audio_player_title_font_family?: string;
43
+ samsung_tv_audio_player_title_font_size?: number;
44
+ samsung_tv_audio_player_summary_font_family?: string;
45
+ samsung_tv_audio_player_summary_font_size?: number;
46
+ tv_os_audio_player_title_font_family?: string;
47
+ tv_os_audio_player_title_font_size?: number;
48
+ tv_os_audio_player_summary_font_family?: string;
49
+ tv_os_audio_player_summary_font_size?: number;
50
+ };
51
+ style?: ViewStyle;
52
+ };
53
+
54
+ export function AudioPlayer(props: Props) {
55
+ const { audio_item, plugin_configuration } = props;
18
56
  const { extensions, title, summary } = audio_item;
19
57
 
20
58
  const getProp = useCallback(
@@ -26,15 +64,20 @@ export function AudioPlayerTV(props: Props) {
26
64
  );
27
65
 
28
66
  const config = useMemo(() => {
29
- // Checking if we are receiving items from the DSP
67
+ // Checking if we are recieving items from the DSP
30
68
  const titleColor = getProp("audio_player_title_color");
31
69
  const summaryColor = getProp("audio_player_summary_color");
32
70
  const backgroundColor = getProp("audio_player_background_color");
33
71
  const backgroundImage = getProp("audio_player_background_image");
72
+ const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
34
73
  const channelIcon = getProp("audio_player_channel_icon");
35
74
  const rtlFlag = getProp("audio_player_rtl");
36
75
  const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
37
76
 
77
+ const audioPlayerBackgroundImageDefaultColor = getProp(
78
+ "audio_player_background_image_default_color"
79
+ );
80
+
38
81
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
39
82
 
40
83
  const titleFontFamily = getProp(
@@ -109,27 +152,23 @@ export function AudioPlayerTV(props: Props) {
109
152
  summaryFontSize,
110
153
  runTimeFontFamily,
111
154
  runTimeFontSize,
155
+ artworkAspectRatio,
112
156
  channelIcon,
157
+ audioPlayerBackgroundImageDefaultColor,
113
158
  artworkBorderRadius,
114
159
  };
115
160
  }, [getProp]);
116
161
 
117
- const artwork = React.useMemo(
118
- () =>
119
- getArtworkImage({
120
- key: "audio_player_artwork_image_key",
121
- entry: audio_item,
122
- plugin_configuration,
123
- }),
124
- [audio_item, plugin_configuration]
125
- );
162
+ const artwork = imageSrcFromMediaItem(audio_item, [
163
+ config?.artworkAspectRatio,
164
+ ]);
126
165
 
127
166
  return (
128
- <AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
167
+ <AudioPlayerLayout artwork={artwork} config={config}>
129
168
  <Channel srcImage={config?.channelIcon} config={config} />
130
169
  <Title title={title} config={config} />
131
170
  <Summary summary={summary} config={config} />
132
171
  <Runtime {...extensions} config={config} />
133
- </AudioPlayerTVLayout>
172
+ </AudioPlayerLayout>
134
173
  );
135
174
  }
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { View, ImageBackground, ViewStyle } from "react-native";
1
+ import React, { useRef } from "react";
2
+ import { View, ImageBackground, Animated } from "react-native";
3
3
 
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
@@ -7,30 +7,34 @@ import { Artwork } from "./Artwork";
7
7
  import { directionStyles } from "./helpers";
8
8
 
9
9
  type Props = {
10
- artwork: string;
10
+ artwork?: string;
11
11
  config: {
12
12
  titleColor: string;
13
13
  summaryColor: string;
14
14
  backgroundColor: string;
15
- backgroundImage: Option<string>;
15
+ backgroundImage: string;
16
16
  isRTL: boolean;
17
17
  artworkBorderRadius: Option<number>;
18
18
  };
19
19
  children: React.ReactNode;
20
- style: ViewStyle;
21
20
  };
22
21
 
23
- export function AudioPlayerTVLayout({
24
- artwork,
25
- config,
26
- children,
27
- style,
28
- }: Props) {
22
+ export function AudioPlayerLayout({ artwork, config, children }: Props) {
23
+ const fadeAnimation = useRef(new Animated.Value(0)).current;
24
+
25
+ const fadeAudioPlayerIn = () => {
26
+ Animated.timing(fadeAnimation, {
27
+ toValue: 1,
28
+ duration: 3000,
29
+ useNativeDriver: true,
30
+ }).start();
31
+ };
32
+
29
33
  const { isRTL, backgroundColor, backgroundImage } = config;
30
34
 
31
- const backgroundImageSource = { uri: backgroundImage };
35
+ const backgroundImageSource = { uri: backgroundImage || artwork };
32
36
 
33
- const backgroundColorStyle = backgroundImage
37
+ const backgroundColorStyle = backgroundImageSource.uri
34
38
  ? "transparent"
35
39
  : backgroundColor;
36
40
 
@@ -62,7 +66,8 @@ export function AudioPlayerTVLayout({
62
66
  native: {
63
67
  backgroundColor: backgroundColorStyle,
64
68
  overflow: "hidden",
65
- ...style,
69
+ width: "100%",
70
+ height: "100%",
66
71
  },
67
72
  samsung_tv: {
68
73
  position: "absolute",
@@ -114,6 +119,9 @@ export function AudioPlayerTVLayout({
114
119
  alignItems: "center",
115
120
  justifyContent: "center",
116
121
  },
122
+ native: {
123
+ flex: 1,
124
+ },
117
125
  });
118
126
 
119
127
  const textContainerStyles = platformSelect({
@@ -137,25 +145,58 @@ export function AudioPlayerTVLayout({
137
145
  },
138
146
  });
139
147
 
140
- if (backgroundImage) {
141
- return (
142
- <ImageBackground
143
- source={backgroundImageSource}
144
- style={backgroundImgStyles}
145
- resizeMode="cover"
146
- >
147
- <View style={mainContainerStyles}>
148
- <Artwork srcImage={artwork} config={config} />
149
- <View style={textContainerStyles}>{children}</View>
150
- </View>
151
- </ImageBackground>
152
- );
153
- }
154
-
155
- return (
148
+ const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
149
+ <ImageBackground
150
+ source={backgroundImageSource}
151
+ style={backgroundImgStyles}
152
+ resizeMode="cover"
153
+ >
154
+ <View style={mainContainerStyles}>
155
+ {!!artwork && <Artwork srcImage={artwork} config={config} />}
156
+ <View style={textContainerStyles}>{children}</View>
157
+ </View>
158
+ </ImageBackground>
159
+ ) : (
156
160
  <View style={mainContainerStyles}>
157
- <Artwork srcImage={artwork} config={config} />
161
+ {!!artwork && <Artwork srcImage={artwork} config={config} />}
158
162
  <View style={textContainerStyles}>{children}</View>
159
163
  </View>
160
164
  );
165
+
166
+ const audioPlayerLayoutMobile = () => {
167
+ fadeAudioPlayerIn();
168
+
169
+ return (
170
+ <View style={mainContainerStyles} pointerEvents="none">
171
+ <Animated.View
172
+ style={[
173
+ mainContainerStyles,
174
+ {
175
+ opacity: fadeAnimation,
176
+ },
177
+ ]}
178
+ >
179
+ <ImageBackground
180
+ source={backgroundImageSource}
181
+ style={backgroundImgStyles}
182
+ resizeMode="cover"
183
+ >
184
+ <View style={mainContainerStyles} />
185
+ </ImageBackground>
186
+ </Animated.View>
187
+ </View>
188
+ );
189
+ };
190
+
191
+ const audioPlayerLayout = platformSelect({
192
+ tvos: audioPlayerLayoutTV,
193
+ android_tv: audioPlayerLayoutTV,
194
+ web: audioPlayerLayoutTV,
195
+ samsung_tv: audioPlayerLayoutTV,
196
+ lg_tv: audioPlayerLayoutTV,
197
+ ios: audioPlayerLayoutMobile(),
198
+ android: audioPlayerLayoutMobile(),
199
+ });
200
+
201
+ return audioPlayerLayout;
161
202
  }
@@ -1,12 +1,14 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
3
+ exports[`<AudioPlayer /> renders correctly 1`] = `
4
4
  <View
5
5
  pointerEvents="none"
6
6
  style={
7
7
  {
8
8
  "backgroundColor": "transparent",
9
+ "height": "100%",
9
10
  "overflow": "hidden",
11
+ "width": "100%",
10
12
  }
11
13
  }
12
14
  >
@@ -15,8 +17,10 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
15
17
  style={
16
18
  {
17
19
  "backgroundColor": "transparent",
20
+ "height": "100%",
18
21
  "opacity": 0,
19
22
  "overflow": "hidden",
23
+ "width": "100%",
20
24
  }
21
25
  }
22
26
  >
@@ -32,7 +36,7 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
32
36
  resizeMode="cover"
33
37
  source={
34
38
  {
35
- "uri": undefined,
39
+ "uri": "https://example.com",
36
40
  }
37
41
  }
38
42
  style={
@@ -56,7 +60,9 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
56
60
  style={
57
61
  {
58
62
  "backgroundColor": "transparent",
63
+ "height": "100%",
59
64
  "overflow": "hidden",
65
+ "width": "100%",
60
66
  }
61
67
  }
62
68
  />
@@ -0,0 +1,72 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
4
+ <View
5
+ pointerEvents="none"
6
+ style={
7
+ {
8
+ "backgroundColor": "transparent",
9
+ "height": "100%",
10
+ "overflow": "hidden",
11
+ "width": "100%",
12
+ }
13
+ }
14
+ >
15
+ <View
16
+ collapsable={false}
17
+ style={
18
+ {
19
+ "backgroundColor": "transparent",
20
+ "height": "100%",
21
+ "opacity": 0,
22
+ "overflow": "hidden",
23
+ "width": "100%",
24
+ }
25
+ }
26
+ >
27
+ <View
28
+ accessibilityIgnoresInvertColors={true}
29
+ style={
30
+ {
31
+ "flex": 1,
32
+ }
33
+ }
34
+ >
35
+ <Image
36
+ resizeMode="cover"
37
+ source={
38
+ {
39
+ "uri": "https://example.com",
40
+ }
41
+ }
42
+ style={
43
+ [
44
+ {
45
+ "bottom": 0,
46
+ "left": 0,
47
+ "position": "absolute",
48
+ "right": 0,
49
+ "top": 0,
50
+ },
51
+ {
52
+ "height": undefined,
53
+ "width": undefined,
54
+ },
55
+ undefined,
56
+ ]
57
+ }
58
+ />
59
+ <View
60
+ style={
61
+ {
62
+ "backgroundColor": "transparent",
63
+ "height": "100%",
64
+ "overflow": "hidden",
65
+ "width": "100%",
66
+ }
67
+ }
68
+ />
69
+ </View>
70
+ </View>
71
+ </View>
72
+ `;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { render } from "@testing-library/react-native";
3
3
 
4
- import { AudioPlayerTV } from "..";
4
+ import { AudioPlayer } from "../AudioPlayer";
5
5
 
6
6
  const audioPlayerProps = {
7
7
  audio_item: {
@@ -45,9 +45,9 @@ const audioPlayerProps = {
45
45
  styles: {},
46
46
  };
47
47
 
48
- describe("<AudioPlayerTV />", () => {
48
+ describe("<AudioPlayer />", () => {
49
49
  it("renders correctly", () => {
50
- const { toJSON } = render(<AudioPlayerTV {...audioPlayerProps} />);
50
+ const { toJSON } = render(<AudioPlayer {...audioPlayerProps} />);
51
51
  expect(toJSON()).toMatchSnapshot();
52
52
  });
53
53
  });
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { render } from "@testing-library/react-native";
3
+
4
+ import { AudioPlayerLayout } from "../AudioPlayerLayout";
5
+
6
+ const audioPlayerLayoutProps = {
7
+ artwork: "string",
8
+ config: {
9
+ titleColor: "white",
10
+ summaryColor: "white",
11
+ backgroundColor: "black",
12
+ backgroundImage: "https://example.com",
13
+ isRTL: true,
14
+ },
15
+ children: [],
16
+ };
17
+
18
+ describe("<AudioPlayerLayout />", () => {
19
+ it("renders correctly", () => {
20
+ const { toJSON } = render(
21
+ <AudioPlayerLayout {...audioPlayerLayoutProps} />
22
+ );
23
+
24
+ expect(toJSON()).toMatchSnapshot();
25
+ });
26
+ });
@@ -2,8 +2,9 @@ const defaults = {
2
2
  audio_player_title_color: "white",
3
3
  audio_player_summary_color: "white",
4
4
  audio_player_background_color: "black",
5
- audio_player_background_image: undefined,
5
+ audio_player_artwork_aspect_ratio: "1:1",
6
6
  audio_player_rtl: false,
7
+ audio_player_background_image_default_color: "",
7
8
  };
8
9
 
9
10
  export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
@@ -0,0 +1 @@
1
+ export { AudioPlayer } from "./AudioPlayer";
@@ -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
- background: "black",
130
+ backgroundColor: "black",
131
131
  },
132
132
  playerWrapper: {
133
133
  height: "100%",
@@ -135,6 +135,9 @@ const webStyles = {
135
135
  },
136
136
  inlineRiver: {
137
137
  height: INLINE_CONTAINER_CONTENT_HEIGHT,
138
+
139
+ borderWidth: 4,
140
+ borderColor: "yellow",
138
141
  },
139
142
  };
140
143
 
@@ -145,7 +148,6 @@ const nativeStyles = {
145
148
  },
146
149
  playerScreen: {
147
150
  flex: 1,
148
- backgroundColor: "black",
149
151
  overflow: "hidden",
150
152
  },
151
153
  playerWrapper: {
@@ -565,8 +567,9 @@ const PlayerContainerComponent = (props: Props) => {
565
567
  const isInlineTV = isInlineTVUtil(screenData);
566
568
 
567
569
  const inline =
568
- [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
569
- isInlineTV;
570
+ [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
571
+ mode as any
572
+ ) || isInlineTV;
570
573
 
571
574
  const value = React.useMemo(
572
575
  () => ({ playerId: state.playerId }),
@@ -587,7 +590,11 @@ const PlayerContainerComponent = (props: Props) => {
587
590
  );
588
591
  }
589
592
 
590
- if (screen_background_color && mode !== VideoModalMode.FULLSCREEN) {
593
+ if (
594
+ screen_background_color &&
595
+ mode !== VideoModalMode.FULLSCREEN &&
596
+ isTV()
597
+ ) {
591
598
  updatedStyles.playerScreen.backgroundColor = screen_background_color;
592
599
  }
593
600
 
@@ -617,6 +624,8 @@ const PlayerContainerComponent = (props: Props) => {
617
624
  playNextData,
618
625
  };
619
626
 
627
+ const pointerEventsProp = mode === "MINIMIZED" ? "box-none" : "auto";
628
+
620
629
  return (
621
630
  <PlayerStateContext.Provider value={value}>
622
631
  <PlayerContainerContextProvider
@@ -637,14 +646,17 @@ const PlayerContainerComponent = (props: Props) => {
637
646
  preferredFocus
638
647
  shouldUsePreferredFocus
639
648
  groupId={groupId}
649
+ pointerEvents={pointerEventsProp}
640
650
  >
641
651
  {/* Video player and components */}
642
652
  <View
643
653
  style={styles.playerScreen}
644
654
  testID={"player-screen-container"}
655
+ pointerEvents={pointerEventsProp}
645
656
  >
646
657
  {/* Player container */}
647
658
  <View
659
+ pointerEvents={pointerEventsProp}
648
660
  style={[
649
661
  styles.playerWrapper,
650
662
  // eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
@@ -716,7 +728,7 @@ const PlayerContainerComponent = (props: Props) => {
716
728
  key={item.id}
717
729
  groupId={FocusableGroupMainContainerId}
718
730
  cellTapAction={onCellTap}
719
- extraAnchorPointYOffset={0}
731
+ extraAnchorPointYOffset={-600}
720
732
  isScreenWrappedInContainer={true}
721
733
  containerHeight={styles.inlineRiver.height}
722
734
  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
- isTablet = false,
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