@applicaster/zapp-react-native-ui-components 13.0.0-alpha.7330390362 → 13.0.0-alpha.7620873141

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 (147) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  3. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  6. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  8. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  9. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  11. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  12. package/Components/AudioPlayer/helpers.tsx +1 -0
  13. package/Components/BaseFocusable/index.tsx +1 -2
  14. package/Components/Cell/Cell.tsx +4 -13
  15. package/Components/Cell/CellWithFocusable.tsx +22 -15
  16. package/Components/Cell/CellWrapper.tsx +18 -0
  17. package/Components/Cell/TvOSCellComponent.tsx +20 -22
  18. package/Components/Cell/index.js +3 -1
  19. package/Components/Cell/styles.ts +17 -0
  20. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  21. package/Components/CellRendererResolver/index.ts +2 -1
  22. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  23. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  24. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  25. package/Components/ErrorScreen/index.tsx +14 -6
  26. package/Components/Focusable/Focusable.tsx +1 -0
  27. package/Components/Focusable/FocusableTvOS.tsx +5 -1
  28. package/Components/Focusable/index.android.tsx +10 -3
  29. package/Components/FocusableCell/index.tsx +1 -1
  30. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  31. package/Components/FocusableGroup/index.tsx +0 -3
  32. package/Components/FocusableList/index.tsx +26 -9
  33. package/Components/FocusableScrollView/index.tsx +43 -13
  34. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  35. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  36. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  37. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  38. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  39. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  40. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
  41. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
  42. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  43. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  44. package/Components/Layout/TV/index.tsx +6 -20
  45. package/Components/Layout/TV/index.web.tsx +4 -1
  46. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  47. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +0 -6
  48. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -9
  49. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  50. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  51. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  52. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  53. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  54. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  55. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  56. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  57. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  58. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  59. package/Components/MasterCell/utils/index.ts +8 -134
  60. package/Components/ModalComponent/BottomSheetModalContent.tsx +45 -19
  61. package/Components/ModalComponent/Button/Item.tsx +6 -5
  62. package/Components/ModalComponent/Button/assets.ts +1 -1
  63. package/Components/ModalComponent/Button/index.tsx +30 -43
  64. package/Components/ModalComponent/utils.ts +55 -7
  65. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  66. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  67. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  68. package/Components/OfflineHandler/utils/index.ts +1 -1
  69. package/Components/PlayerContainer/PlayerContainer.tsx +40 -14
  70. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  71. package/Components/PlayerImageBackground/index.tsx +1 -1
  72. package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
  73. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  74. package/Components/River/RiverItem.tsx +2 -1
  75. package/Components/River/TV/index.tsx +6 -1
  76. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  77. package/Components/River/__tests__/river.test.js +75 -40
  78. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  79. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  80. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  81. package/Components/Screen/TV/index.web.tsx +5 -6
  82. package/Components/Screen/hooks.ts +3 -6
  83. package/Components/Screen/index.tsx +4 -4
  84. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  85. package/Components/Tabs/Tab.tsx +5 -3
  86. package/Components/TextInputTv/index.tsx +2 -1
  87. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  88. package/Components/TrackedView/index.tsx +1 -0
  89. package/Components/Transitioner/AnimationManager.js +15 -15
  90. package/Components/Transitioner/Scene.tsx +1 -1
  91. package/Components/Transitioner/Transitioner.tsx +3 -3
  92. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  93. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
  94. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  95. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  96. package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
  97. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  98. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  99. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +46 -30
  100. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  101. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +45 -20
  102. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +10 -3
  103. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  104. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  105. package/Components/VideoModal/ModalAnimation/index.ts +2 -0
  106. package/Components/VideoModal/ModalAnimation/utils.ts +36 -0
  107. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  108. package/Components/VideoModal/PlayerWrapper.tsx +28 -5
  109. package/Components/VideoModal/VideoModal.tsx +19 -4
  110. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  111. package/Components/VideoModal/utils.ts +3 -4
  112. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  113. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  114. package/Components/Viewport/__tests__/utils.test.js +5 -4
  115. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  116. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  117. package/Components/ZappUIComponent/index.tsx +4 -17
  118. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  119. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  120. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  121. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  122. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  123. package/Contexts/ScreenContext/index.tsx +3 -10
  124. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  125. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  126. package/Decorators/Navigator/index.tsx +1 -1
  127. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  128. package/Decorators/RiverResolver/index.tsx +6 -8
  129. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  130. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  131. package/package.json +7 -11
  132. package/tsconfig.json +2 -3
  133. package/.babelrc +0 -8
  134. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  135. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  136. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  137. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  138. package/Components/Cell/CellStyles/colors.js +0 -40
  139. package/Components/Cell/CellStyles/index.js +0 -15
  140. package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
  141. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  142. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  143. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  144. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  145. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  146. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  147. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -4,28 +4,31 @@ import { Animated, View } from "react-native";
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
5
 
6
6
  import {
7
- useModalAnimationContext,
8
7
  PlayerAnimationStateEnum,
8
+ useModalAnimationContext,
9
9
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
10
10
 
11
11
  import {
12
+ useDimensions,
12
13
  useGetBottomTabBarHeight,
13
14
  useNavigation,
14
- useDimensions,
15
15
  } from "@applicaster/zapp-react-native-utils/reactHooks";
16
16
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
17
17
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
18
18
  import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
19
19
 
20
20
  import {
21
- gestureListenerHelper,
22
- getAnimationStyle,
21
+ AUDIO_PLAYER_HORIZONTAL_PADDING,
22
+ ComponentAnimationType,
23
23
  defaultAspectRatioWidth,
24
+ gestureListenerHelper,
24
25
  getAnimationDefaultValue,
25
- ComponentAnimationType,
26
- AUDIO_PLAYER_HORIZONTAL_PADDING,
26
+ getAnimationStyle,
27
+ getMoveUpValue,
27
28
  } from "./utils";
28
29
 
30
+ import { DURATION_TO_MINIMIZE, DEFAULT_DURATION_FOR_ANIMATION } from "./const";
31
+
29
32
  type Props = {
30
33
  animationType: string;
31
34
  children: React.ReactNode;
@@ -97,14 +100,16 @@ export const AnimationView = ({
97
100
 
98
101
  const inlineAudioPlayer = additionalData.inlineAudioPlayer;
99
102
 
100
- const moveUpValue = additionalData.saveArea
101
- ? -insets.top + (isAudioItem ? 0 : progressBarHeight)
102
- : isTablet
103
- ? isTabletLandscape &&
104
- (!isAudioItem || (isAudioItem && inlineAudioPlayer))
105
- ? -tabletLandscapePlayerTopPosition + progressBarHeight
106
- : -130
107
- : -50 + progressBarHeight;
103
+ const moveUpValue = getMoveUpValue({
104
+ additionalData,
105
+ insets,
106
+ isAudioItem,
107
+ progressBarHeight,
108
+ isTablet,
109
+ isTabletLandscape,
110
+ inlineAudioPlayer,
111
+ tabletLandscapePlayerTopPosition,
112
+ });
108
113
 
109
114
  const moveComponentHorizontalValue = additionalData.moveValue
110
115
  ? isRTL
@@ -119,7 +124,10 @@ export const AnimationView = ({
119
124
  (animationType, state) => {
120
125
  const defaultConfig = {
121
126
  toValue: 0,
122
- duration: state === PlayerAnimationStateEnum.minimize ? 150 : 100,
127
+ duration:
128
+ state === PlayerAnimationStateEnum.minimize
129
+ ? DURATION_TO_MINIMIZE
130
+ : DEFAULT_DURATION_FOR_ANIMATION,
123
131
  useNativeDriver: true,
124
132
  };
125
133
 
@@ -228,6 +236,8 @@ export const AnimationView = ({
228
236
  isAudioItem,
229
237
  moveUpValue,
230
238
  moveComponentHorizontalValue,
239
+ isRTL,
240
+ inlineAudioPlayer,
231
241
  ]
232
242
  );
233
243
 
@@ -246,7 +256,7 @@ export const AnimationView = ({
246
256
  default:
247
257
  return getAnimationValue(
248
258
  animationType,
249
- PlayerAnimationStateEnum.maximaze
259
+ PlayerAnimationStateEnum.maximize
250
260
  ).toValue;
251
261
  }
252
262
  }, [defaultValue, videoModalState]);
@@ -278,6 +288,11 @@ export const AnimationView = ({
278
288
  moveUpValue,
279
289
  moveComponentHorizontalValue,
280
290
  videoModalMode,
291
+ isAudioItem,
292
+ isTablet,
293
+ isTabletLandscape,
294
+ isRTL,
295
+ inlineAudioPlayer,
281
296
  ]
282
297
  );
283
298
 
@@ -306,7 +321,7 @@ export const AnimationView = ({
306
321
  }
307
322
 
308
323
  if (
309
- videoModalMode === "MAXIMIZED" &&
324
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
310
325
  defaultValue.x !== screenWidth &&
311
326
  width &&
312
327
  height
@@ -332,7 +347,13 @@ export const AnimationView = ({
332
347
  animatedValue.setValue(value);
333
348
  }
334
349
  }
335
- }, [videoModalState]);
350
+ }, [
351
+ animatedValue,
352
+ animationType,
353
+ getAnimationValue,
354
+ playerAnimationState,
355
+ videoModalState,
356
+ ]);
336
357
 
337
358
  React.useEffect(() => {
338
359
  if (
@@ -344,7 +365,7 @@ export const AnimationView = ({
344
365
  animatedValue,
345
366
  getAnimationValue(animationType, playerAnimationState)
346
367
  ).start();
347
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
368
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
348
369
  animatedValue.setValue(defaultValue);
349
370
  }
350
371
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -405,7 +426,7 @@ export const AnimationView = ({
405
426
 
406
427
  return (
407
428
  <Animated.View
408
- onLayout={additionalData.useLayoutMeasure && measureView}
429
+ onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
409
430
  ref={animationComponentRef}
410
431
  style={[
411
432
  ...preparedStyles,
@@ -427,6 +448,10 @@ export const AnimationComponent = (props: Props) => {
427
448
  videoModalState: { visible },
428
449
  } = useNavigation();
429
450
 
451
+ if (additionalData?.disableAnimatedComponent) {
452
+ return <>{props.children}</>;
453
+ }
454
+
430
455
  const useAnimation =
431
456
  visible && !additionalData.disableAnimatedComponent && !isTV();
432
457
 
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
4
  import {
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
14
14
 
15
15
  export enum PlayerAnimationStateEnum {
16
16
  minimize = "minimize",
17
- maximaze = "maximaze",
17
+ maximize = "maximize",
18
18
  drag_player = "drag_player",
19
19
  drag_scroll = "drag_scroll",
20
20
  }
21
21
 
22
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
22
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
23
 
24
24
  export type ModalAnimationContextT = {
25
25
  isActiveGesture: boolean;
@@ -95,6 +95,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
95
95
  setStartComponentsAnimation(false);
96
96
  }, []);
97
97
 
98
+ useEffect(() => {
99
+ // Reset player animation state when video modal is closed
100
+ if (!visible) {
101
+ resetPlayerAnimationState();
102
+ }
103
+ }, [visible, resetPlayerAnimationState]);
104
+
98
105
  // Animated values
99
106
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
100
107
  const dragScrollY = React.useRef(new Animated.Value(0)).current;
@@ -0,0 +1,108 @@
1
+ import { getMoveUpValue } from "../utils";
2
+
3
+ describe("getMoveUpValue", () => {
4
+ it("returns correct value when additionalData.saveArea is true and isAudioItem is false", () => {
5
+ const result = getMoveUpValue({
6
+ additionalData: { saveArea: true },
7
+ insets: { top: 20 },
8
+ isAudioItem: false,
9
+ progressBarHeight: 10,
10
+ isTablet: false,
11
+ isTabletLandscape: false,
12
+ inlineAudioPlayer: false,
13
+ tabletLandscapePlayerTopPosition: 100,
14
+ });
15
+
16
+ expect(result).toBe(-20 + 10);
17
+ });
18
+
19
+ it("returns correct value when additionalData.saveArea is true and isAudioItem is true", () => {
20
+ const result = getMoveUpValue({
21
+ additionalData: { saveArea: true },
22
+ insets: { top: 15 },
23
+ isAudioItem: true,
24
+ progressBarHeight: 5,
25
+ isTablet: false,
26
+ isTabletLandscape: false,
27
+ inlineAudioPlayer: false,
28
+ tabletLandscapePlayerTopPosition: 100,
29
+ });
30
+
31
+ expect(result).toBe(-15 + 0);
32
+ });
33
+
34
+ it("returns correct value for audio item (tablet or not)", () => {
35
+ const result = getMoveUpValue({
36
+ additionalData: { marginTop: 30 },
37
+ insets: { top: 0 },
38
+ isAudioItem: true,
39
+ progressBarHeight: 0,
40
+ isTablet: false,
41
+ isTabletLandscape: false,
42
+ inlineAudioPlayer: false,
43
+ tabletLandscapePlayerTopPosition: 0,
44
+ });
45
+
46
+ expect(result).toBe(-30);
47
+ });
48
+
49
+ it("returns correct value for tablet landscape with inline audio player", () => {
50
+ const result = getMoveUpValue({
51
+ additionalData: {},
52
+ insets: { top: 0 },
53
+ isAudioItem: true,
54
+ progressBarHeight: 8,
55
+ isTablet: true,
56
+ isTabletLandscape: true,
57
+ inlineAudioPlayer: true,
58
+ tabletLandscapePlayerTopPosition: 50,
59
+ });
60
+
61
+ expect(result).toBe(-0);
62
+ });
63
+
64
+ it("returns correct value for tablet landscape without audio item", () => {
65
+ const result = getMoveUpValue({
66
+ additionalData: {},
67
+ insets: { top: 0 },
68
+ isAudioItem: false,
69
+ progressBarHeight: 12,
70
+ isTablet: true,
71
+ isTabletLandscape: true,
72
+ inlineAudioPlayer: false,
73
+ tabletLandscapePlayerTopPosition: 60,
74
+ });
75
+
76
+ expect(result).toBe(-60 + 12);
77
+ });
78
+
79
+ it("returns -130 for tablet portrait (not landscape)", () => {
80
+ const result = getMoveUpValue({
81
+ additionalData: {},
82
+ insets: { top: 0 },
83
+ isAudioItem: false,
84
+ progressBarHeight: 0,
85
+ isTablet: true,
86
+ isTabletLandscape: false,
87
+ inlineAudioPlayer: false,
88
+ tabletLandscapePlayerTopPosition: 0,
89
+ });
90
+
91
+ expect(result).toBe(-130);
92
+ });
93
+
94
+ it("returns -50 + progressBarHeight for mobile audio player in docked mode", () => {
95
+ const result = getMoveUpValue({
96
+ additionalData: {},
97
+ insets: { top: 0 },
98
+ isAudioItem: false,
99
+ progressBarHeight: 7,
100
+ isTablet: false,
101
+ isTabletLandscape: false,
102
+ inlineAudioPlayer: false,
103
+ tabletLandscapePlayerTopPosition: 0,
104
+ });
105
+
106
+ expect(result).toBe(-50 + 7);
107
+ });
108
+ });
@@ -0,0 +1,5 @@
1
+ export const DURATION_TO_MINIMIZE = 200; // old value 200
2
+
3
+ export const DURATION_TO_MAXIMIZE = 0;
4
+
5
+ export const DEFAULT_DURATION_FOR_ANIMATION = 200; // old value 100
@@ -14,3 +14,5 @@ export { useModalAnimationContext } from "./useModalAnimationContext";
14
14
  export { AnimationComponent } from "./AnimationComponent";
15
15
 
16
16
  export { ComponentAnimationType, defaultAspectRatioWidth } from "./utils";
17
+
18
+ export { DURATION_TO_MINIMIZE, DURATION_TO_MAXIMIZE } from "./const";
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable padding-line-between-statements */
2
2
 
3
3
  import { PlayerAnimationStateEnum } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
4
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
4
5
 
5
6
  export enum ComponentAnimationType {
6
7
  bottomBar = "bottomBar",
@@ -300,3 +301,38 @@ export const resetScrollAnimatedValues = (
300
301
  dragScrollY.setValue(0);
301
302
  dragVideoPlayerY.setValue(0);
302
303
  };
304
+
305
+ export const getMoveUpValue = ({
306
+ additionalData,
307
+ insets,
308
+ isAudioItem,
309
+ progressBarHeight,
310
+ isTablet,
311
+ isTabletLandscape,
312
+ inlineAudioPlayer,
313
+ tabletLandscapePlayerTopPosition,
314
+ }) => {
315
+ if (additionalData.saveArea) {
316
+ return -insets.top + (isAudioItem ? 0 : progressBarHeight);
317
+ }
318
+
319
+ if (isAudioItem) {
320
+ // for any layouts in audioPlayer
321
+ return -1 * toNumberWithDefaultZero(additionalData?.marginTop);
322
+ }
323
+
324
+ if (isTablet) {
325
+ if (
326
+ isTabletLandscape &&
327
+ (!isAudioItem || (isAudioItem && inlineAudioPlayer))
328
+ ) {
329
+ return -tabletLandscapePlayerTopPosition + progressBarHeight;
330
+ }
331
+
332
+ // for audioPlayer(tablet/isTabletPortrait) in docked mode
333
+ return -130;
334
+ }
335
+
336
+ // for audioPlayer(mobile) in docked mode
337
+ return -50 + progressBarHeight;
338
+ };
@@ -1,14 +1,16 @@
1
1
  import React, { useEffect, useRef } from "react";
2
2
  import {
3
- StyleProp,
4
- ViewStyle,
5
3
  Animated,
6
- Easing,
7
4
  Dimensions,
5
+ Easing,
6
+ StyleProp,
7
+ ViewStyle,
8
+ StyleSheet,
8
9
  } from "react-native";
9
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
10
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
11
12
  import { useSafeAreaInsets } from "react-native-safe-area-context";
13
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
12
14
 
13
15
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
14
16
 
@@ -21,9 +23,9 @@ type Props = {
21
23
  entry: ZappEntry;
22
24
  style: StyleProp<ViewStyle>;
23
25
  configuration: Configuration;
24
- isTabletLandscape: boolean;
26
+ isTabletLandscape?: boolean;
25
27
  isAudioPlayer?: boolean;
26
- isTablet: boolean;
28
+ isTablet?: boolean;
27
29
  };
28
30
 
29
31
  const containerStyle = ({
@@ -38,9 +40,9 @@ export const PlayerDetails = ({
38
40
  entry,
39
41
  style,
40
42
  configuration,
41
- isTabletLandscape,
43
+ isTabletLandscape = false,
42
44
  isAudioPlayer,
43
- isTablet,
45
+ isTablet = false,
44
46
  }: Props) => {
45
47
  const screenData = useTargetScreenData(entry);
46
48
  const insets = useSafeAreaInsets();
@@ -77,6 +79,10 @@ export const PlayerDetails = ({
77
79
  }
78
80
  }, [isAudioPlayer]);
79
81
 
82
+ if (isNilOrEmpty(screenData?.ui_components)) {
83
+ return null;
84
+ }
85
+
80
86
  return (
81
87
  <Animated.View
82
88
  style={[
@@ -90,17 +96,19 @@ export const PlayerDetails = ({
90
96
  {
91
97
  // workaround for avoid wrong text-height after going back to portrait rotation
92
98
  // we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
93
- width: isTablet ? undefined : SCREEN_WIDTH,
99
+ width: isTablet
100
+ ? undefined
101
+ : (StyleSheet.flatten(style)?.width ?? SCREEN_WIDTH),
94
102
  },
95
103
  ]}
96
104
  >
97
- {screenData && (
105
+ {screenData ? (
98
106
  <ComponentsMap
99
107
  riverId={screenData.id}
100
108
  feed={screenData?.data?.source}
101
109
  riverComponents={screenData.ui_components}
102
110
  />
103
- )}
111
+ ) : null}
104
112
  </Animated.View>
105
113
  );
106
114
  };
@@ -100,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
100
100
  return ["top"];
101
101
  };
102
102
 
103
+ const isPercentage = (value: string | number): boolean => {
104
+ if (typeof value === "string") {
105
+ return value.includes("%");
106
+ }
107
+
108
+ return false;
109
+ };
110
+
111
+ const getPercentageOf = (percent: string, value: number) => {
112
+ const percentageValue = parseFloat(percent.replace("%", ""));
113
+
114
+ if (isNaN(percentageValue)) {
115
+ return value;
116
+ }
117
+
118
+ return (value * percentageValue) / 100;
119
+ };
120
+
103
121
  const getTabletWidth = (
104
122
  configuration: Configuration,
105
123
  dimensions: DimensionsT
@@ -108,18 +126,23 @@ const getTabletWidth = (
108
126
  configuration?.tablet_landscape_sidebar_width;
109
127
 
110
128
  const { width } = dimensions;
129
+ let widthValue = Number(width);
130
+
131
+ if (isPercentage(width)) {
132
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
133
+ }
111
134
 
112
135
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
113
136
 
114
137
  if (tablet_landscape_sidebar_width?.includes("%")) {
115
- return Number(width) * (1 - sidebarWidth / 100);
138
+ return widthValue * (1 - sidebarWidth / 100);
116
139
  }
117
140
 
118
141
  if (Number.isNaN(sidebarWidth)) {
119
- return Number(width) * 0.65;
142
+ return widthValue * 0.65;
120
143
  }
121
144
 
122
- return Number(width) - sidebarWidth;
145
+ return widthValue - sidebarWidth;
123
146
  };
124
147
 
125
148
  const PlayerWrapperComponent = (props: Props) => {
@@ -227,7 +250,7 @@ const PlayerWrapperComponent = (props: Props) => {
227
250
  </View>
228
251
 
229
252
  <AnimatedScrollModal>
230
- {isShowPlayerDetails && (
253
+ {isShowPlayerDetails ? (
231
254
  <AnimationComponent
232
255
  animationType={ComponentAnimationType.componentFade}
233
256
  style={defaultStyles.flex}
@@ -240,7 +263,7 @@ const PlayerWrapperComponent = (props: Props) => {
240
263
  isTablet={isTablet}
241
264
  />
242
265
  </AnimationComponent>
243
- )}
266
+ ) : null}
244
267
  </AnimatedScrollModal>
245
268
  </AnimationComponent>
246
269
  </WrapperView>
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { equals } from "ramda";
3
- import { StyleSheet, StatusBar } from "react-native";
3
+ import { StyleSheet, StatusBar, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
30
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
31
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { Spinner } from "../Spinner";
33
34
  import { OpaqueLayer } from "./OpaqueLayer";
34
35
 
35
36
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
36
37
 
38
+ const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
39
+
37
40
  const styles = StyleSheet.create({
38
41
  container: {
39
42
  top: 0,
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
42
45
  bottom: 0,
43
46
  position: "absolute",
44
47
  },
48
+ loaderContainer: {
49
+ top: 0,
50
+ left: 0,
51
+ right: 0,
52
+ bottom: 0,
53
+ position: "absolute",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ backgroundColor: LOADER_BACKGROUND_COLOR,
57
+ },
45
58
  });
46
59
 
47
60
  const VideoModalComponent = () => {
@@ -131,7 +144,7 @@ const VideoModalComponent = () => {
131
144
  {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
145
  {mode === "FULLSCREEN" && <OpaqueLayer />}
133
146
 
134
- {itemIdHooksFinished === item?.id && (
147
+ {itemIdHooksFinished === item?.id ? (
135
148
  <AnimatedPlayerModalWrapper
136
149
  style={[
137
150
  styles.container,
@@ -143,11 +156,13 @@ const VideoModalComponent = () => {
143
156
  <HandlePlayable
144
157
  item={item}
145
158
  isModal={mode !== "PIP"}
146
- modalHeight={modalSize.height}
147
- modalWidth={modalSize.width}
148
159
  mode={mode}
149
160
  />
150
161
  </AnimatedPlayerModalWrapper>
162
+ ) : (
163
+ <View style={styles.loaderContainer}>
164
+ <Spinner />
165
+ </View>
151
166
  )}
152
167
  </ScreenContextProvider>
153
168
  </PathnameContext.Provider>
@@ -1,43 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PlayerDetails renders properly 1`] = `
4
- <View
5
- collapsable={false}
6
- style={
7
- {
8
- "backgroundColor": "transparent",
9
- "flex": 1,
10
- "marginTop": -8,
11
- "paddingTop": -8,
12
- "width": 750,
13
- }
14
- }
15
- >
16
- <View
17
- feed="test-source"
18
- riverComponents={[]}
19
- riverId="test-id"
20
- />
21
- </View>
22
- `;
3
+ exports[`PlayerDetails renders properly 1`] = `null`;
23
4
 
24
- exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
25
- <View
26
- collapsable={false}
27
- style={
28
- {
29
- "backgroundColor": "transparent",
30
- "flex": 1,
31
- "marginTop": -20,
32
- "paddingTop": 40,
33
- "width": 750,
34
- }
35
- }
36
- >
37
- <View
38
- feed="test-source"
39
- riverComponents={[]}
40
- riverId="test-id"
41
- />
42
- </View>
43
- `;
5
+ exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
@@ -1,5 +1,4 @@
1
- import * as R from "ramda";
2
-
1
+ import { mergeRight } from "ramda";
3
2
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
3
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
@@ -25,10 +24,10 @@ export const useConfiguration = () => {
25
24
 
26
25
  const playerPluginConfig = playerManager.getPluginConfiguration();
27
26
 
28
- const config = R.mergeRight(playerPluginConfig, {
27
+ const config = mergeRight(playerPluginConfig, {
28
+ ...pluginConfiguration,
29
29
  ...targetScreenConfiguration?.general,
30
30
  ...targetScreenConfiguration?.styles,
31
- ...pluginConfiguration,
32
31
  });
33
32
 
34
33
  const {