@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1700735421 → 13.0.0-alpha.1711912250

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 (75) hide show
  1. package/Components/AnimatedInOut/index.tsx +3 -5
  2. package/Components/AudioPlayer/AudioPlayer.tsx +5 -9
  3. package/Components/AudioPlayer/helpers.tsx +1 -2
  4. package/Components/Cell/Cell.tsx +3 -13
  5. package/Components/Cell/CellWithFocusable.tsx +21 -15
  6. package/Components/Cell/CellWrapper.tsx +18 -0
  7. package/Components/Cell/styles.ts +17 -0
  8. package/Components/CellRendererResolver/index.ts +2 -1
  9. package/Components/ErrorScreen/index.tsx +8 -0
  10. package/Components/FocusableCell/index.tsx +1 -1
  11. package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
  12. package/Components/FocusableGroup/index.tsx +0 -1
  13. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  14. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
  15. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  16. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  17. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  18. package/Components/Layout/TV/ScreenContainer.tsx +0 -1
  19. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  20. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  21. package/Components/Layout/TV/index.tsx +6 -20
  22. package/Components/Layout/TV/index.web.tsx +4 -1
  23. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  24. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  25. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  26. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  27. package/Components/MasterCell/elementMapper.tsx +2 -1
  28. package/Components/MasterCell/utils/behaviorProvider.ts +4 -1
  29. package/Components/MasterCell/utils/index.ts +6 -6
  30. package/Components/ModalComponent/BottomSheetModalContent.tsx +49 -41
  31. package/Components/ModalComponent/Button/Item.tsx +6 -5
  32. package/Components/ModalComponent/Button/assets.ts +1 -1
  33. package/Components/ModalComponent/Button/index.tsx +45 -62
  34. package/Components/ModalComponent/Header/index.tsx +9 -8
  35. package/Components/ModalComponent/utils.ts +55 -7
  36. package/Components/OfflineHandler/utils/index.ts +1 -1
  37. package/Components/PlayerContainer/PlayerContainer.tsx +34 -7
  38. package/Components/PlayerImageBackground/index.tsx +4 -24
  39. package/Components/River/ComponentsMap/ComponentsMap.tsx +15 -3
  40. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  41. package/Components/River/RiverItem.tsx +8 -3
  42. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +7 -1
  43. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  44. package/Components/Screen/TV/index.web.tsx +5 -6
  45. package/Components/Screen/__tests__/Screen.test.tsx +22 -14
  46. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
  47. package/Components/Screen/hooks.ts +3 -6
  48. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  49. package/Components/VideoLive/animationUtils.ts +3 -3
  50. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  51. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +35 -19
  52. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  53. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +38 -14
  54. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +11 -3
  55. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  56. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  57. package/Components/VideoModal/ModalAnimation/index.ts +2 -0
  58. package/Components/VideoModal/ModalAnimation/utils.ts +30 -0
  59. package/Components/VideoModal/PlayerDetails.tsx +9 -4
  60. package/Components/VideoModal/PlayerWrapper.tsx +35 -22
  61. package/Components/VideoModal/VideoModal.tsx +19 -4
  62. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  63. package/Components/VideoModal/utils.ts +3 -4
  64. package/Components/ZappUIComponent/index.tsx +4 -4
  65. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  66. package/Decorators/RiverResolver/index.tsx +5 -7
  67. package/Decorators/ZappPipesDataConnector/index.tsx +2 -1
  68. package/package.json +6 -6
  69. package/.babelrc +0 -8
  70. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  71. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  72. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  73. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  74. package/Components/Cell/CellStyles/colors.js +0 -40
  75. package/Components/Cell/CellStyles/index.js +0 -15
@@ -23,10 +23,12 @@ import {
23
23
  setScrollModalAnimatedValue,
24
24
  } from "./utils";
25
25
 
26
+ import { DURATION_TO_MINIMIZE } from "./const";
27
+
26
28
  const getAnimatedConfig = (toValue) => {
27
29
  return {
28
30
  toValue,
29
- duration: 200,
31
+ duration: DURATION_TO_MINIMIZE,
30
32
  useNativeDriver: true,
31
33
  };
32
34
  };
@@ -70,14 +72,19 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
70
72
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
71
73
  useNavigation();
72
74
 
73
- const { mode: videoModalMode, item: videoModalItem } = videoModalState;
75
+ const {
76
+ mode: videoModalMode,
77
+ previousMode: previousVideoModalMode,
78
+ item: videoModalItem,
79
+ } = videoModalState;
80
+
74
81
  const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
75
82
  const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
76
83
  const previousItemId = usePrevious(videoModalItem?.id);
77
84
 
78
85
  const isNotMinimizeMaximazeAnimation =
79
86
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
80
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
87
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
81
88
 
82
89
  const isEnablePanGesture =
83
90
  enableGesture &&
@@ -121,7 +128,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
121
128
  const preparedTranslationY =
122
129
  Math.abs(translationY) - lastScrollYValue.current;
123
130
 
124
- if (videoModalMode === "MAXIMIZED") {
131
+ if (isMaximizedModal) {
125
132
  const endOffsetY =
126
133
  lastSnap + preparedTranslationY + dragToss * velocityY + 150;
127
134
 
@@ -143,8 +150,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
143
150
  translateYOffset.flattenOffset();
144
151
  dragScrollY.setValue(0);
145
152
 
146
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
147
- } else {
153
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
154
+ } else if (destSnapPoint !== modalSnapPoints[0] && isMaximizedModal) {
148
155
  setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
149
156
  }
150
157
  } else {
@@ -158,7 +165,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
158
165
 
159
166
  dragScrollY.setValue(0);
160
167
 
161
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
168
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
162
169
  } else {
163
170
  resetPlayerAnimationState();
164
171
  }
@@ -168,7 +175,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
168
175
  resetPlayerAnimationState();
169
176
  }
170
177
  },
171
- [lastSnap, modalSnapPoints, playerAnimationState, videoModalMode]
178
+ [
179
+ lastSnap,
180
+ modalSnapPoints,
181
+ playerAnimationState,
182
+ isMinimizedModal,
183
+ isMaximizedModal,
184
+ ]
172
185
  );
173
186
 
174
187
  const onScroll = React.useCallback(({ nativeEvent }) => {
@@ -219,17 +232,18 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
219
232
  }, []);
220
233
 
221
234
  React.useEffect(() => {
222
- const { mode, previousMode, item } = videoModalState;
223
-
224
235
  if (
225
- mode === "MAXIMIZED" &&
236
+ videoModalMode === "MAXIMIZED" &&
226
237
  !enableGesture &&
227
238
  scrollPosition.current === 0
228
239
  ) {
229
240
  setIEnableGesture(true);
230
241
  }
231
242
 
232
- if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
243
+ if (
244
+ videoModalMode === "MINIMIZED" &&
245
+ previousVideoModalMode === "MAXIMIZED"
246
+ ) {
233
247
  // set animation to the minimize values if moving from the player to another screen
234
248
  if (playerAnimationState === null) {
235
249
  setScrollModalAnimatedValue(
@@ -247,14 +261,16 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
247
261
  }
248
262
  } else if (
249
263
  playerAnimationState === null &&
250
- ((previousItemId === item?.id &&
251
- mode === "MAXIMIZED" &&
252
- (previousMode === "MINIMIZED" || previousMode === "MAXIMIZED")) ||
253
- (previousItemId !== item?.id && mode !== "FULLSCREEN"))
264
+ ((previousItemId === videoModalItem?.id &&
265
+ videoModalMode === "MAXIMIZED" &&
266
+ (previousVideoModalMode === "MINIMIZED" ||
267
+ previousVideoModalMode === "MAXIMIZED")) ||
268
+ (previousItemId !== videoModalItem?.id &&
269
+ videoModalMode !== "FULLSCREEN"))
254
270
  ) {
255
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
271
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
256
272
  }
257
- }, [videoModalState]);
273
+ }, [videoModalMode, previousVideoModalMode, videoModalItem]);
258
274
 
259
275
  React.useEffect(() => {
260
276
  if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
@@ -296,7 +312,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
296
312
 
297
313
  resetPlayerAnimationState();
298
314
  });
299
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
315
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
300
316
  Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
301
317
  maximiseVideoModal();
302
318
  setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
50
50
 
51
51
  const isNotMinimizeMaximazeAnimation =
52
52
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
53
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
53
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
54
54
 
55
55
  const isEnablePanGesture =
56
56
  !isLanguageOverlayVisible &&
@@ -89,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
89
89
  setLastSnap(destSnapPoint);
90
90
 
91
91
  if (destSnapPoint === modalSnapPoints[0]) {
92
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
92
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
93
93
  } else {
94
94
  lastScrollY.setValue(0);
95
95
  lastScrollYValue.current = 0;
@@ -105,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
105
105
  modalSnapPoints[1] - preparedTranslationY
106
106
  );
107
107
 
108
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
108
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
109
109
  } else {
110
110
  resetPlayerAnimationState();
111
111
  }
@@ -24,8 +24,11 @@ import {
24
24
  gestureListenerHelper,
25
25
  getAnimationDefaultValue,
26
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;
@@ -91,20 +94,21 @@ export const AnimationView = ({
91
94
  const isAudioItem = React.useMemo(
92
95
  () =>
93
96
  videoModalItem?.content?.type?.includes?.("audio") ||
94
- videoModalItem?.type?.value === "audio",
97
+ videoModalItem?.type?.value?.includes?.("audio"),
95
98
  [videoModalItem]
96
99
  );
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
+ tabletLandscapePlayerTopPosition,
111
+ });
108
112
 
109
113
  const moveComponentHorizontalValue = additionalData.moveValue
110
114
  ? isRTL
@@ -119,7 +123,10 @@ export const AnimationView = ({
119
123
  (animationType, state) => {
120
124
  const defaultConfig = {
121
125
  toValue: 0,
122
- duration: state === PlayerAnimationStateEnum.minimize ? 150 : 100,
126
+ duration:
127
+ state === PlayerAnimationStateEnum.minimize
128
+ ? DURATION_TO_MINIMIZE
129
+ : DEFAULT_DURATION_FOR_ANIMATION,
123
130
  useNativeDriver: true,
124
131
  };
125
132
 
@@ -228,6 +235,8 @@ export const AnimationView = ({
228
235
  isAudioItem,
229
236
  moveUpValue,
230
237
  moveComponentHorizontalValue,
238
+ isRTL,
239
+ inlineAudioPlayer,
231
240
  ]
232
241
  );
233
242
 
@@ -246,7 +255,7 @@ export const AnimationView = ({
246
255
  default:
247
256
  return getAnimationValue(
248
257
  animationType,
249
- PlayerAnimationStateEnum.maximaze
258
+ PlayerAnimationStateEnum.maximize
250
259
  ).toValue;
251
260
  }
252
261
  }, [defaultValue, videoModalState]);
@@ -278,6 +287,11 @@ export const AnimationView = ({
278
287
  moveUpValue,
279
288
  moveComponentHorizontalValue,
280
289
  videoModalMode,
290
+ isAudioItem,
291
+ isTablet,
292
+ isTabletLandscape,
293
+ isRTL,
294
+ inlineAudioPlayer,
281
295
  ]
282
296
  );
283
297
 
@@ -306,7 +320,7 @@ export const AnimationView = ({
306
320
  }
307
321
 
308
322
  if (
309
- videoModalMode === "MAXIMIZED" &&
323
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
310
324
  defaultValue.x !== screenWidth &&
311
325
  width &&
312
326
  height
@@ -332,7 +346,13 @@ export const AnimationView = ({
332
346
  animatedValue.setValue(value);
333
347
  }
334
348
  }
335
- }, [videoModalState]);
349
+ }, [
350
+ animatedValue,
351
+ animationType,
352
+ getAnimationValue,
353
+ playerAnimationState,
354
+ videoModalState,
355
+ ]);
336
356
 
337
357
  React.useEffect(() => {
338
358
  if (
@@ -344,7 +364,7 @@ export const AnimationView = ({
344
364
  animatedValue,
345
365
  getAnimationValue(animationType, playerAnimationState)
346
366
  ).start();
347
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
367
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
348
368
  animatedValue.setValue(defaultValue);
349
369
  }
350
370
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -427,6 +447,10 @@ export const AnimationComponent = (props: Props) => {
427
447
  videoModalState: { visible },
428
448
  } = useNavigation();
429
449
 
450
+ if (additionalData?.disableAnimatedComponent) {
451
+ return <>{props.children}</>;
452
+ }
453
+
430
454
  const useAnimation =
431
455
  visible && !additionalData.disableAnimatedComponent && !isTV();
432
456
 
@@ -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,13 @@ 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
+ appear_as_docked = "appear_as_docked",
20
21
  }
21
22
 
22
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
24
 
24
25
  export type ModalAnimationContextT = {
25
26
  isActiveGesture: boolean;
@@ -95,6 +96,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
95
96
  setStartComponentsAnimation(false);
96
97
  }, []);
97
98
 
99
+ useEffect(() => {
100
+ // Reset player animation state when video modal is closed
101
+ if (!visible) {
102
+ resetPlayerAnimationState();
103
+ }
104
+ }, [visible, resetPlayerAnimationState]);
105
+
98
106
  // Animated values
99
107
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
100
108
  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,32 @@ 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
+ tabletLandscapePlayerTopPosition,
313
+ }) => {
314
+ if (additionalData.saveArea) {
315
+ return -insets.top + (isAudioItem ? 0 : progressBarHeight);
316
+ }
317
+
318
+ if (isAudioItem) {
319
+ // for any layouts in audioPlayer
320
+ return -1 * toNumberWithDefaultZero(additionalData?.marginTop);
321
+ }
322
+
323
+ if (isTablet) {
324
+ if (isTabletLandscape) {
325
+ return -tabletLandscapePlayerTopPosition + progressBarHeight;
326
+ } else {
327
+ return -130;
328
+ }
329
+ }
330
+
331
+ return -50 + progressBarHeight;
332
+ };
@@ -10,6 +10,7 @@ import {
10
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
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
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
13
14
 
14
15
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
15
16
 
@@ -22,9 +23,9 @@ type Props = {
22
23
  entry: ZappEntry;
23
24
  style: StyleProp<ViewStyle>;
24
25
  configuration: Configuration;
25
- isTabletLandscape: boolean;
26
+ isTabletLandscape?: boolean;
26
27
  isAudioPlayer?: boolean;
27
- isTablet: boolean;
28
+ isTablet?: boolean;
28
29
  };
29
30
 
30
31
  const containerStyle = ({
@@ -39,9 +40,9 @@ export const PlayerDetails = ({
39
40
  entry,
40
41
  style,
41
42
  configuration,
42
- isTabletLandscape,
43
+ isTabletLandscape = false,
43
44
  isAudioPlayer,
44
- isTablet,
45
+ isTablet = false,
45
46
  }: Props) => {
46
47
  const screenData = useTargetScreenData(entry);
47
48
  const insets = useSafeAreaInsets();
@@ -78,6 +79,10 @@ export const PlayerDetails = ({
78
79
  }
79
80
  }, [isAudioPlayer]);
80
81
 
82
+ if (isNilOrEmpty(screenData?.ui_components)) {
83
+ return null;
84
+ }
85
+
81
86
  return (
82
87
  <Animated.View
83
88
  style={[
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
74
74
  return longEdge / shortEdge;
75
75
  };
76
76
 
77
- const safeAreaStyles = (
78
- configuration: Configuration,
79
- isTablet: boolean
80
- ): ViewStyle => {
81
- const tablet_landscape_player_container_background_color =
82
- configuration?.tablet_landscape_player_container_background_color;
83
-
84
- return {
85
- backgroundColor: isTablet
86
- ? tablet_landscape_player_container_background_color
87
- : "transparent",
88
- };
89
- };
90
-
91
77
  const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
92
78
  if (isTablet) {
93
79
  return ["top"];
@@ -100,6 +86,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
100
86
  return ["top"];
101
87
  };
102
88
 
89
+ const isPercentage = (value: string | number): boolean => {
90
+ if (typeof value === "string") {
91
+ return value.includes("%");
92
+ }
93
+
94
+ return false;
95
+ };
96
+
97
+ const getPercentageOf = (percent: string, value: number) => {
98
+ const percentageValue = parseFloat(percent.replace("%", ""));
99
+
100
+ if (isNaN(percentageValue)) {
101
+ return value;
102
+ }
103
+
104
+ return (value * percentageValue) / 100;
105
+ };
106
+
103
107
  const getTabletWidth = (
104
108
  configuration: Configuration,
105
109
  dimensions: DimensionsT
@@ -108,18 +112,23 @@ const getTabletWidth = (
108
112
  configuration?.tablet_landscape_sidebar_width;
109
113
 
110
114
  const { width } = dimensions;
115
+ let widthValue = Number(width);
116
+
117
+ if (isPercentage(width)) {
118
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
119
+ }
111
120
 
112
121
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
113
122
 
114
123
  if (tablet_landscape_sidebar_width?.includes("%")) {
115
- return Number(width) * (1 - sidebarWidth / 100);
124
+ return widthValue * (1 - sidebarWidth / 100);
116
125
  }
117
126
 
118
127
  if (Number.isNaN(sidebarWidth)) {
119
- return Number(width) * 0.65;
128
+ return widthValue * 0.65;
120
129
  }
121
130
 
122
- return Number(width) - sidebarWidth;
131
+ return widthValue - sidebarWidth;
123
132
  };
124
133
 
125
134
  const PlayerWrapperComponent = (props: Props) => {
@@ -133,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
133
142
  children,
134
143
  isTabletPortrait,
135
144
  configuration,
145
+ fullscreen,
136
146
  pip,
137
147
  } = props;
138
148
 
@@ -188,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
188
198
  [containerDimensions, playerDimensionsHack]
189
199
  );
190
200
 
201
+ const wrapperViewStyle: ViewStyle = {
202
+ backgroundColor:
203
+ isTablet && !fullscreen
204
+ ? configuration?.tablet_landscape_player_container_background_color
205
+ : "transparent",
206
+ };
207
+
191
208
  return (
192
209
  <WrapperView
193
210
  edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
194
- style={[
195
- safeAreaStyles(configuration, isTablet),
196
- style,
197
- playerDimensionsHack,
198
- ]}
211
+ style={[wrapperViewStyle, style, playerDimensionsHack]}
199
212
  >
200
213
  <AnimationComponent
201
214
  animationType={ComponentAnimationType.moveUpComponent}
@@ -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>