@applicaster/zapp-react-native-ui-components 12.0.0-rc.5 → 12.0.0-rc.50

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 (95) hide show
  1. package/Components/AnimatedInOut/index.tsx +18 -10
  2. package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
  3. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
  4. package/Components/AudioPlayer/helpers.tsx +1 -0
  5. package/Components/Cell/Cell.tsx +2 -2
  6. package/Components/Cell/CellWithFocusable.tsx +21 -14
  7. package/Components/Cell/TvOSCellComponent.tsx +2 -2
  8. package/Components/ErrorScreen/index.tsx +1 -1
  9. package/Components/FocusableCell/index.tsx +7 -7
  10. package/Components/FocusableList/FocusableChild.ts +24 -14
  11. package/Components/FocusableList/FocusableItem.tsx +1 -1
  12. package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
  13. package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
  14. package/Components/FocusableList/index.tsx +26 -25
  15. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
  16. package/Components/HandlePlayable/HandlePlayable.tsx +1 -1
  17. package/Components/HookRenderer/index.tsx +1 -6
  18. package/Components/Image/Image.android.tsx +3 -22
  19. package/Components/Image/Image.tsx +18 -2
  20. package/Components/Image/utils/index.ts +39 -0
  21. package/Components/Layout/TV/__tests__/index.test.tsx +1 -34
  22. package/Components/Layout/TV/index.tsx +20 -36
  23. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +0 -1
  24. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
  25. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
  26. package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
  27. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
  28. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
  29. package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
  30. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +8 -10
  31. package/Components/MasterCell/utils/index.ts +16 -5
  32. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  33. package/Components/ModalComponent/Button/Item.tsx +82 -0
  34. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  35. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  36. package/Components/ModalComponent/Button/assets.ts +4 -0
  37. package/Components/ModalComponent/Button/index.tsx +111 -0
  38. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  39. package/Components/ModalComponent/Header/Title.tsx +70 -0
  40. package/Components/ModalComponent/Header/assets.ts +4 -0
  41. package/Components/ModalComponent/Header/index.tsx +71 -0
  42. package/Components/ModalComponent/Header/utils.ts +79 -0
  43. package/Components/ModalComponent/index.tsx +38 -0
  44. package/Components/ModalComponent/utils.ts +126 -0
  45. package/Components/PlayerContainer/ErrorDisplay/ErrorDisplay.tsx +4 -7
  46. package/Components/PlayerContainer/PlayerContainer.tsx +56 -29
  47. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
  48. package/Components/PlayerImageBackground/index.tsx +34 -8
  49. package/Components/River/ComponentsMap/ComponentsMap.tsx +25 -0
  50. package/Components/River/River.tsx +8 -5
  51. package/Components/River/TV/River.tsx +2 -2
  52. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
  53. package/Components/River/__tests__/componentsMap.test.js +7 -0
  54. package/Components/River/useScreenConfiguration.ts +5 -6
  55. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  56. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  57. package/Components/RouteManager/index.tsx +5 -3
  58. package/Components/Screen/__tests__/Screen.test.tsx +48 -36
  59. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +20 -6
  60. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  61. package/Components/Screen/index.tsx +92 -44
  62. package/Components/Screen/navigationHandler.ts +0 -82
  63. package/Components/Screen/orientationHandler.ts +1 -1
  64. package/Components/ScreenResolver/index.tsx +1 -1
  65. package/Components/Tabs/TV/styles.ts +1 -1
  66. package/Components/TrackedView/index.tsx +6 -3
  67. package/Components/VideoLive/LiveImageManager.ts +42 -13
  68. package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
  69. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
  70. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +22 -27
  71. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
  72. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +335 -0
  73. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +144 -0
  74. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +438 -0
  75. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +143 -0
  76. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  77. package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
  78. package/Components/VideoModal/PlayerDetails.tsx +3 -0
  79. package/Components/VideoModal/PlayerWrapper.tsx +119 -95
  80. package/Components/VideoModal/VideoModal.tsx +8 -25
  81. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
  82. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +8 -3
  83. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +242 -166
  84. package/Components/VideoModal/hooks/useModalSize.ts +13 -4
  85. package/Components/VideoModal/utils.ts +3 -3
  86. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
  87. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
  88. package/Components/ZappUIComponent/index.tsx +22 -12
  89. package/Components/index.js +2 -0
  90. package/Contexts/ScreenContext/index.tsx +1 -4
  91. package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
  92. package/Decorators/RiverResolver/index.tsx +0 -4
  93. package/Decorators/index.tsx +0 -4
  94. package/package.json +5 -6
  95. package/Components/VideoModal/hooks/usePosition.ts +0 -50
@@ -0,0 +1,299 @@
1
+ /* eslint-disable padding-line-between-statements */
2
+
3
+ import { PlayerAnimationStateEnum } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
4
+
5
+ export enum ComponentAnimationType {
6
+ bottomBar = "bottomBar",
7
+ player = "player",
8
+ componentFade = "componentFade",
9
+ componentAppears = "componentAppears",
10
+ moveUpComponent = "moveUpComponent",
11
+ moveComponentHorizontal = "moveComponentHorizontal",
12
+ audioPlayerPaddingHorizontal = "audioPlayerPaddingHorizontal",
13
+ }
14
+
15
+ export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
16
+
17
+ export const defaultAspectRatioWidth = (height: number): number =>
18
+ (height / 9) * 16;
19
+
20
+ export const getAnimationStyle = (component, animatedValue) => {
21
+ switch (component) {
22
+ case ComponentAnimationType.bottomBar: {
23
+ return { zIndex: 99, transform: [{ translateY: animatedValue }] };
24
+ }
25
+
26
+ case ComponentAnimationType.player: {
27
+ return { width: animatedValue.x, height: animatedValue.y };
28
+ }
29
+
30
+ case ComponentAnimationType.componentFade:
31
+ case ComponentAnimationType.componentAppears: {
32
+ return { opacity: animatedValue };
33
+ }
34
+
35
+ case ComponentAnimationType.moveUpComponent: {
36
+ return { transform: [{ translateY: animatedValue }] };
37
+ }
38
+
39
+ case ComponentAnimationType.audioPlayerPaddingHorizontal:
40
+ case ComponentAnimationType.moveComponentHorizontal: {
41
+ return { transform: [{ translateX: animatedValue }] };
42
+ }
43
+
44
+ default:
45
+ return null;
46
+ }
47
+ };
48
+
49
+ export const getAnimationDefaultValue = (component, bottomTabBarHeight) => {
50
+ switch (component) {
51
+ case ComponentAnimationType.bottomBar: {
52
+ return bottomTabBarHeight;
53
+ }
54
+
55
+ case ComponentAnimationType.player: {
56
+ return { x: 0, y: 0 };
57
+ }
58
+
59
+ case ComponentAnimationType.componentFade: {
60
+ return 1;
61
+ }
62
+
63
+ case ComponentAnimationType.audioPlayerPaddingHorizontal:
64
+ case ComponentAnimationType.moveComponentHorizontal:
65
+ case ComponentAnimationType.componentAppears:
66
+ case ComponentAnimationType.moveUpComponent: {
67
+ return 0;
68
+ }
69
+ }
70
+ };
71
+
72
+ export const calculateAnimationValue = (animationType, dragPosition, data) => {
73
+ const {
74
+ isAudioItem,
75
+ bottomTabBarHeight,
76
+ minimisedHeight,
77
+ minimisedWidth,
78
+ defaultValue,
79
+ moveUpValue,
80
+ moveComponentHorizontalValue,
81
+ isTablet,
82
+ isTabletLandscape,
83
+ isRTL,
84
+ fromMiniPlayer,
85
+ inlineAudioPlayer,
86
+ } = data;
87
+
88
+ switch (animationType) {
89
+ case ComponentAnimationType.bottomBar: {
90
+ if (fromMiniPlayer) {
91
+ return dragPosition < bottomTabBarHeight
92
+ ? dragPosition
93
+ : bottomTabBarHeight;
94
+ }
95
+
96
+ return dragPosition < bottomTabBarHeight
97
+ ? bottomTabBarHeight - dragPosition
98
+ : 0;
99
+ }
100
+
101
+ case ComponentAnimationType.player: {
102
+ const value =
103
+ isAudioItem && !inlineAudioPlayer
104
+ ? isTabletLandscape
105
+ ? fromMiniPlayer
106
+ ? { forWidth: 4, forHeight: 4.5 }
107
+ : { forWidth: 3, forHeight: 3 }
108
+ : { forWidth: 2, forHeight: 2 }
109
+ : isTabletLandscape
110
+ ? { forWidth: 8, forHeight: 6.5 }
111
+ : { forWidth: 3.5, forHeight: 2 };
112
+
113
+ const minWidth =
114
+ isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
115
+
116
+ if (fromMiniPlayer) {
117
+ const calculationWidth =
118
+ dragPosition * value.forWidth < minWidth
119
+ ? minWidth
120
+ : dragPosition * value.forWidth;
121
+ const calculationHeight =
122
+ dragPosition * value.forHeight < minimisedHeight
123
+ ? minimisedHeight
124
+ : dragPosition * value.forHeight;
125
+
126
+ return {
127
+ x:
128
+ calculationWidth < defaultValue.x
129
+ ? calculationWidth
130
+ : defaultValue.x,
131
+ y:
132
+ calculationHeight < defaultValue.y
133
+ ? calculationHeight
134
+ : defaultValue.y,
135
+ };
136
+ }
137
+
138
+ const calculationWidth = defaultValue.x - dragPosition * value.forWidth;
139
+
140
+ const calculationHeight = defaultValue.y - dragPosition * value.forHeight;
141
+
142
+ return {
143
+ x: calculationWidth > minWidth ? calculationWidth : minWidth,
144
+ y:
145
+ calculationHeight > minimisedHeight
146
+ ? calculationHeight
147
+ : minimisedHeight,
148
+ };
149
+ }
150
+
151
+ case ComponentAnimationType.componentFade: {
152
+ if (fromMiniPlayer) {
153
+ const calculation = dragPosition / (isTablet ? 200 : 150);
154
+
155
+ return calculation < 1 ? calculation : 1;
156
+ }
157
+
158
+ const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
159
+
160
+ return calculation > 0 ? calculation : 0;
161
+ }
162
+
163
+ case ComponentAnimationType.componentAppears: {
164
+ if (fromMiniPlayer) {
165
+ const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
166
+
167
+ return calculation > 0 ? calculation : 0;
168
+ }
169
+
170
+ const calculation = dragPosition / (isTablet ? 200 : 150);
171
+
172
+ return calculation < 1 ? calculation : 1;
173
+ }
174
+
175
+ case ComponentAnimationType.moveUpComponent: {
176
+ if (fromMiniPlayer) {
177
+ const calculation =
178
+ moveUpValue + dragPosition / (isTabletLandscape ? 1 : 4);
179
+
180
+ return calculation < 0 ? calculation : 0;
181
+ }
182
+
183
+ const calculation = 0 - dragPosition / (isTabletLandscape ? 1 : 2);
184
+
185
+ return calculation > moveUpValue ? calculation : moveUpValue;
186
+ }
187
+
188
+ case ComponentAnimationType.moveComponentHorizontal: {
189
+ if (fromMiniPlayer) {
190
+ const calculation = isRTL
191
+ ? moveComponentHorizontalValue - dragPosition * 2
192
+ : moveComponentHorizontalValue + dragPosition * 2;
193
+ const condition = isRTL ? calculation > 0 : calculation < 0;
194
+
195
+ return condition ? calculation : 0;
196
+ }
197
+
198
+ const calculation = isRTL ? dragPosition * 2 : -(dragPosition * 2);
199
+ const condition = isRTL
200
+ ? calculation < moveComponentHorizontalValue
201
+ : calculation > moveComponentHorizontalValue;
202
+
203
+ return condition ? calculation : moveComponentHorizontalValue;
204
+ }
205
+
206
+ case ComponentAnimationType.audioPlayerPaddingHorizontal: {
207
+ const padding = isRTL
208
+ ? AUDIO_PLAYER_HORIZONTAL_PADDING
209
+ : -AUDIO_PLAYER_HORIZONTAL_PADDING;
210
+
211
+ if (fromMiniPlayer) {
212
+ const calculation = isRTL
213
+ ? padding - dragPosition / 5
214
+ : padding + dragPosition / 5;
215
+ const condition = isRTL ? calculation > 0 : calculation < 0;
216
+
217
+ return condition ? calculation : 0;
218
+ }
219
+
220
+ const calculation = isRTL ? dragPosition / 5 : -(dragPosition / 5);
221
+ const condition = isRTL ? calculation < padding : calculation > padding;
222
+
223
+ return condition ? calculation : padding;
224
+ }
225
+ }
226
+ };
227
+
228
+ export const gestureListenerHelper = (data) => {
229
+ const {
230
+ listenerValue,
231
+ preparedValue,
232
+ animationType,
233
+ animatedValue,
234
+ calculationData,
235
+ modalSnapPoint,
236
+ startAnimationDistance,
237
+ startComponentsAnimation,
238
+ setStartComponentsAnimation,
239
+ getAnimationValue,
240
+ } = data;
241
+
242
+ if (calculationData.fromMiniPlayer) {
243
+ if (listenerValue <= 0) {
244
+ if (
245
+ preparedValue >= 0 &&
246
+ preparedValue <= modalSnapPoint - startAnimationDistance
247
+ ) {
248
+ !startComponentsAnimation && setStartComponentsAnimation(true);
249
+
250
+ animatedValue.setValue(
251
+ calculateAnimationValue(animationType, preparedValue, calculationData)
252
+ );
253
+ } else {
254
+ animatedValue.setValue(calculationData.defaultValue);
255
+ startComponentsAnimation && setStartComponentsAnimation(false);
256
+ }
257
+ } else {
258
+ const value = getAnimationValue(
259
+ animationType,
260
+ PlayerAnimationStateEnum.minimize
261
+ ).toValue;
262
+
263
+ animatedValue.setValue(value);
264
+ }
265
+ } else {
266
+ if (preparedValue >= startAnimationDistance) {
267
+ !startComponentsAnimation && setStartComponentsAnimation(true);
268
+ const value = Math.round(preparedValue - startAnimationDistance);
269
+
270
+ animatedValue.setValue(
271
+ calculateAnimationValue(animationType, value, calculationData)
272
+ );
273
+ } else {
274
+ animatedValue.setValue(calculationData.defaultValue);
275
+ startComponentsAnimation && setStartComponentsAnimation(false);
276
+ }
277
+ }
278
+ };
279
+
280
+ export const setScrollModalAnimatedValue = (
281
+ animatedValue,
282
+ value,
283
+ setLastSnap
284
+ ) => {
285
+ setLastSnap(value);
286
+ animatedValue.setValue(value);
287
+ };
288
+
289
+ export const resetScrollAnimatedValues = (
290
+ lastScrollY,
291
+ lastScrollYValue,
292
+ dragScrollY,
293
+ dragVideoPlayerY
294
+ ) => {
295
+ lastScrollY.setValue(0);
296
+ lastScrollYValue.current = 0;
297
+ dragScrollY.setValue(0);
298
+ dragVideoPlayerY.setValue(0);
299
+ };
@@ -23,6 +23,8 @@ const containerStyle = ({
23
23
  backgroundColor: modal_background_color,
24
24
  });
25
25
 
26
+ // const audioMarginStyle = { marginTop: 0, marginBottom: 0 };
27
+
26
28
  export const PlayerDetails = ({
27
29
  entry,
28
30
  style,
@@ -75,6 +77,7 @@ export const PlayerDetails = ({
75
77
  transform: [{ translateY }],
76
78
  opacity,
77
79
  },
80
+ // isAudioPlayer && audioMarginStyle,
78
81
  ]}
79
82
  >
80
83
  {screenData && (
@@ -1,18 +1,31 @@
1
1
  import * as React from "react";
2
- import { Platform, StyleSheet, View, ViewStyle } from "react-native";
2
+ import {
3
+ Dimensions,
4
+ Platform,
5
+ StyleSheet,
6
+ View,
7
+ ViewStyle,
8
+ } from "react-native";
3
9
  import { Edge, SafeAreaView } from "react-native-safe-area-context";
4
10
 
5
11
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
6
- import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device";
12
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
7
13
  import { PlayerDetails } from "./PlayerDetails";
8
14
  import { playerDimesionsHack } from "./utils";
9
15
  import { PathnameContext } from "../../Contexts/PathnameContext";
10
- import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks";
11
16
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
12
17
 
13
- type Dimensions = {
14
- width: number;
15
- height: number;
18
+ import {
19
+ AnimationComponent,
20
+ ComponentAnimationType,
21
+ AnimatedScrollModal,
22
+ AnimatedVideoPlayerComponent,
23
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
24
+
25
+ type DimensionsT = {
26
+ width: number | string;
27
+ height: number | string | undefined;
28
+ aspectRatio?: number;
16
29
  };
17
30
 
18
31
  type Configuration = {
@@ -23,25 +36,22 @@ type Configuration = {
23
36
 
24
37
  type Props = {
25
38
  entry: ZappEntry;
26
- style: ViewStyle & Dimensions;
39
+ style: ViewStyle & DimensionsT;
27
40
  containerStyle?: ViewStyle;
28
41
  inline?: boolean;
29
42
  docked?: boolean;
43
+ pip?: boolean;
30
44
  isModal?: boolean;
31
45
  fullscreen?: boolean;
32
46
  isTabletPortrait?: boolean;
33
- children: (playerDimensions: Dimensions) => React.ReactNode;
47
+ children: (playerDimensions: DimensionsT) => React.ReactNode;
34
48
  configuration: Configuration;
35
49
  };
36
50
 
37
51
  const defaultStyles = StyleSheet.create({
38
52
  playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
39
53
  playerDetails: { flex: 1, paddingTop: 20 },
40
- inlinePlayerContainerDimensions: {
41
- aspectRatio: 16 / 9,
42
- width: "100%",
43
- height: undefined,
44
- },
54
+ flex: { flex: 1 },
45
55
  });
46
56
 
47
57
  const orientationStyles = StyleSheet.create({
@@ -57,6 +67,15 @@ const directionStyles = (isTabletLandscape: boolean): ViewStyle => {
57
67
  return orientationStyles.portrait;
58
68
  };
59
69
 
70
+ const getScreenAspectRatio = () => {
71
+ const { width, height } = Dimensions.get("screen");
72
+
73
+ const longEdge = Math.max(width, height);
74
+ const shortEdge = Math.min(width, height);
75
+
76
+ return longEdge / shortEdge;
77
+ };
78
+
60
79
  const safeAreaStyles = (
61
80
  configuration: Configuration,
62
81
  isTablet: boolean
@@ -71,9 +90,21 @@ const safeAreaStyles = (
71
90
  };
72
91
  };
73
92
 
93
+ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
94
+ if (isTablet) {
95
+ return ["top"];
96
+ }
97
+
98
+ if (!isInlineModal && Platform.OS === "android") {
99
+ return [];
100
+ }
101
+
102
+ return ["top"];
103
+ };
104
+
74
105
  const getTabletWidth = (
75
106
  configuration: Configuration,
76
- dimensions: Dimensions
107
+ dimensions: DimensionsT
77
108
  ) => {
78
109
  const tablet_landscape_sidebar_width =
79
110
  configuration?.tablet_landscape_sidebar_width;
@@ -83,41 +114,14 @@ const getTabletWidth = (
83
114
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
84
115
 
85
116
  if (tablet_landscape_sidebar_width?.includes("%")) {
86
- return width * (1 - sidebarWidth / 100);
117
+ return Number(width) * (1 - sidebarWidth / 100);
87
118
  }
88
119
 
89
120
  if (Number.isNaN(sidebarWidth)) {
90
- return width * 0.65;
121
+ return Number(width) * 0.65;
91
122
  }
92
123
 
93
- return width - sidebarWidth;
94
- };
95
-
96
- export const defaultAspectRatioHeight = (width: number): number =>
97
- (width / 16) * 9;
98
-
99
- export const defaultAspectRatioWidth = (height: number): number =>
100
- (height / 9) * 16;
101
-
102
- const getEdges = (
103
- isTablet: boolean,
104
- docked: boolean,
105
- isInlineModal: boolean
106
- ) => {
107
- if (isTablet) {
108
- return docked ? ["right", "left"] : ["top"];
109
- }
110
-
111
- // mobile
112
- if (isInlineModal && docked) {
113
- return ["bottom"];
114
- }
115
-
116
- if (!isInlineModal && Platform.OS === "android") {
117
- return [];
118
- }
119
-
120
- return ["top"];
124
+ return Number(width) - sidebarWidth;
121
125
  };
122
126
 
123
127
  export const PlayerWrapper = (props: Props) => {
@@ -131,6 +135,7 @@ export const PlayerWrapper = (props: Props) => {
131
135
  children,
132
136
  isTabletPortrait,
133
137
  configuration,
138
+ pip,
134
139
  } = props;
135
140
 
136
141
  const isTablet = useIsTablet();
@@ -141,80 +146,99 @@ export const PlayerWrapper = (props: Props) => {
141
146
 
142
147
  const tabletWidth = getTabletWidth(configuration, style);
143
148
 
144
- const { width: screenWidth } = useDimensions("screen");
145
-
146
- const containerDimensions: Dimensions = React.useMemo(
149
+ const baseDimensions: DimensionsT = React.useMemo(
147
150
  () => ({
148
151
  width:
149
- isInlineModal && !docked && isTabletLandscape
150
- ? tabletWidth
151
- : style.width,
152
- height:
153
- isInlineModal && !docked
154
- ? defaultAspectRatioHeight(
155
- isTabletLandscape ? tabletWidth : screenWidth
156
- )
157
- : style.height,
152
+ isInlineModal && !docked && isTabletLandscape ? tabletWidth : "100%",
153
+ height: undefined,
158
154
  }),
159
- [isInlineModal, docked, isTabletLandscape, tabletWidth, style, screenWidth]
155
+ [isInlineModal, tabletWidth, docked]
160
156
  );
161
157
 
162
- const playerDimensions: Dimensions = React.useMemo(
158
+ const playerDimensions: DimensionsT = React.useMemo(
163
159
  () => ({
164
- width:
165
- isInlineModal && docked
166
- ? defaultAspectRatioWidth(containerDimensions.height)
167
- : containerDimensions.width,
168
- height: containerDimensions.height,
160
+ ...baseDimensions,
161
+ width: isInlineModal && docked ? undefined : baseDimensions.width,
162
+ aspectRatio: !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9,
163
+ }),
164
+ [baseDimensions, isInlineModal, pip]
165
+ );
166
+
167
+ const containerDimensions: DimensionsT = React.useMemo(
168
+ () => ({
169
+ ...baseDimensions,
170
+ aspectRatio:
171
+ isInlineModal && docked ? undefined : playerDimensions.aspectRatio,
169
172
  }),
170
- [isInlineModal, docked, containerDimensions]
173
+ [baseDimensions, isInlineModal, docked, playerDimensions.aspectRatio]
171
174
  );
172
175
 
173
176
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
174
177
 
175
178
  const childrenStyles = React.useMemo(
176
179
  () => ({ ...playerDimensions, ...playerDimesionsHack }),
177
- [playerDimensions, playerDimesionsHack]
180
+ [containerDimensions, playerDimesionsHack]
178
181
  );
179
182
 
180
183
  return (
181
184
  <WrapperView
182
- edges={getEdges(isTablet, docked, isInlineModal) as readonly Edge[]}
185
+ edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
183
186
  style={[
184
- directionStyles(isTabletLandscape),
185
187
  safeAreaStyles(configuration, isTablet),
186
188
  style,
187
189
  playerDimesionsHack,
188
190
  ]}
189
191
  >
190
- <ScreenContextProvider pathname={"videoModal"}>
191
- <PathnameContext.Provider value={"videoModal"}>
192
- <View
193
- testID={`${entry?.id}-player-container`}
194
- style={[
195
- defaultStyles.playerContainer,
196
- containerDimensions,
197
- containerStyle,
198
- isInlineModal && !docked && !isTabletLandscape
199
- ? defaultStyles.inlinePlayerContainerDimensions
200
- : {},
201
- playerDimesionsHack,
202
- ]}
203
- >
204
- {children(childrenStyles)}
205
- </View>
206
- {isInlineModal && !docked ? (
207
- <PlayerDetails
208
- configuration={configuration}
209
- style={defaultStyles.playerDetails}
210
- entry={entry}
211
- isTabletLandscape={isTabletLandscape}
212
- />
213
- ) : (
214
- <View style={defaultStyles.playerDetails} />
215
- )}
216
- </PathnameContext.Provider>
217
- </ScreenContextProvider>
192
+ <AnimationComponent
193
+ animationType={ComponentAnimationType.moveUpComponent}
194
+ additionalData={{ saveArea: true }}
195
+ style={directionStyles(isTabletLandscape)}
196
+ >
197
+ <ScreenContextProvider pathname={"videoModal"}>
198
+ <PathnameContext.Provider value={"videoModal"}>
199
+ <View
200
+ testID={`${entry?.id}-player-container`}
201
+ style={[
202
+ defaultStyles.playerContainer,
203
+ containerDimensions,
204
+ containerStyle,
205
+ playerDimesionsHack,
206
+ ]}
207
+ >
208
+ <AnimationComponent
209
+ animationType={ComponentAnimationType.moveUpComponent}
210
+ style={isTabletLandscape ? defaultStyles.flex : undefined}
211
+ additionalData={{
212
+ useLayoutMeasure: isTabletLandscape,
213
+ disableAnimatedComponent: !isTabletLandscape,
214
+ resetAnimationValue: isTabletLandscape && docked,
215
+ }}
216
+ >
217
+ <AnimatedVideoPlayerComponent>
218
+ {children(childrenStyles)}
219
+ </AnimatedVideoPlayerComponent>
220
+ </AnimationComponent>
221
+ </View>
222
+ <AnimatedScrollModal>
223
+ {isInlineModal ? (
224
+ <AnimationComponent
225
+ animationType={ComponentAnimationType.componentFade}
226
+ style={defaultStyles.flex}
227
+ >
228
+ <PlayerDetails
229
+ configuration={configuration}
230
+ style={defaultStyles.playerDetails}
231
+ entry={entry}
232
+ isTabletLandscape={isTabletLandscape}
233
+ />
234
+ </AnimationComponent>
235
+ ) : (
236
+ <View style={defaultStyles.playerDetails} />
237
+ )}
238
+ </AnimatedScrollModal>
239
+ </PathnameContext.Provider>
240
+ </ScreenContextProvider>
241
+ </AnimationComponent>
218
242
  </WrapperView>
219
243
  );
220
244
  };