@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5033140607 → 13.0.0-alpha.5049772260

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 (211) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  3. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  4. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  5. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  6. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  7. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +56 -113
  8. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +39 -23
  9. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  10. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  11. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  12. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  13. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  14. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  15. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  16. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  17. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  18. package/Components/AudioPlayer/helpers.tsx +1 -0
  19. package/Components/BaseFocusable/index.ios.ts +1 -1
  20. package/Components/BaseFocusable/index.tsx +67 -31
  21. package/Components/Cell/Cell.tsx +18 -22
  22. package/Components/Cell/CellWithFocusable.tsx +51 -60
  23. package/Components/Cell/CellWrapper.tsx +18 -0
  24. package/Components/Cell/TvOSCellComponent.tsx +23 -30
  25. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  26. package/Components/Cell/index.js +3 -1
  27. package/Components/Cell/styles.ts +17 -0
  28. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  29. package/Components/CellRendererResolver/index.ts +2 -1
  30. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  31. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  32. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  33. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  34. package/Components/ErrorScreen/index.tsx +14 -6
  35. package/Components/Focusable/Focusable.tsx +1 -54
  36. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  37. package/Components/Focusable/Touchable.tsx +19 -20
  38. package/Components/Focusable/index.android.tsx +10 -3
  39. package/Components/FocusableCell/index.tsx +1 -1
  40. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  41. package/Components/FocusableGroup/index.tsx +0 -3
  42. package/Components/FocusableList/index.tsx +26 -10
  43. package/Components/FocusableScrollView/index.tsx +43 -13
  44. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  45. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
  46. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
  47. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +28 -0
  48. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  49. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  50. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  51. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  52. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  53. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
  54. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  55. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  56. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  57. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  58. package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
  59. package/Components/Layout/TV/index.tsx +6 -20
  60. package/Components/Layout/TV/index.web.tsx +4 -1
  61. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  62. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  63. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  64. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
  65. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  66. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  67. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  68. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  69. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  70. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  71. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  72. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  73. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  74. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  75. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  76. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  77. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  78. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  79. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  80. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  81. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  82. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  83. package/Components/MasterCell/utils/index.ts +9 -135
  84. package/Components/ModalComponent/BottomSheetModalContent.tsx +45 -19
  85. package/Components/ModalComponent/Button/Item.tsx +6 -5
  86. package/Components/ModalComponent/Button/assets.ts +1 -1
  87. package/Components/ModalComponent/Button/index.tsx +30 -43
  88. package/Components/ModalComponent/Header/index.tsx +3 -3
  89. package/Components/ModalComponent/utils.ts +55 -7
  90. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  91. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  92. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  93. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  94. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  95. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  96. package/Components/OfflineHandler/utils/index.ts +1 -1
  97. package/Components/PlayerContainer/PlayerContainer.tsx +45 -25
  98. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  99. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  100. package/Components/PlayerImageBackground/index.tsx +1 -1
  101. package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
  102. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  103. package/Components/River/RefreshControl.tsx +1 -1
  104. package/Components/River/RiverFooter.tsx +39 -9
  105. package/Components/River/RiverItem.tsx +39 -3
  106. package/Components/River/TV/index.tsx +6 -1
  107. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
  108. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  109. package/Components/River/__tests__/componentsMap.test.js +64 -17
  110. package/Components/River/__tests__/river.test.js +75 -40
  111. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +12 -5
  112. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  113. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  114. package/Components/Screen/TV/index.web.tsx +5 -6
  115. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  116. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  117. package/Components/Screen/hooks.ts +53 -0
  118. package/Components/Screen/index.tsx +16 -42
  119. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  120. package/Components/Tabs/Tab.tsx +12 -9
  121. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  122. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  123. package/Components/TextInputTv/index.tsx +6 -5
  124. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  125. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  126. package/Components/TrackedView/index.tsx +1 -0
  127. package/Components/Transitioner/AnimationManager.js +15 -15
  128. package/Components/Transitioner/Scene.tsx +53 -24
  129. package/Components/Transitioner/Transitioner.tsx +3 -3
  130. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  131. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  132. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  133. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  134. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  135. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  136. package/Components/Transitioner/index.js +8 -4
  137. package/Components/VideoLive/LiveImageManager.ts +27 -1
  138. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  139. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  140. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
  141. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  142. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
  143. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  144. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -22
  145. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +15 -15
  146. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  147. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  148. package/Components/VideoModal/ModalAnimation/index.ts +4 -1
  149. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  150. package/Components/VideoModal/ModalAnimation/utils.ts +38 -2
  151. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  152. package/Components/VideoModal/PlayerDetails.tsx +13 -10
  153. package/Components/VideoModal/PlayerWrapper.tsx +43 -39
  154. package/Components/VideoModal/VideoModal.tsx +17 -11
  155. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  156. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  157. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  158. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  159. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  160. package/Components/VideoModal/hooks/index.ts +7 -0
  161. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  162. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  163. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  164. package/Components/VideoModal/utils.ts +6 -9
  165. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  166. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  167. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  168. package/Components/Viewport/__tests__/utils.test.js +5 -4
  169. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  170. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  171. package/Components/ZappUIComponent/index.tsx +4 -17
  172. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  173. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  174. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  175. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  176. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  177. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  178. package/Contexts/ScreenContext/index.tsx +6 -12
  179. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  180. package/Decorators/Analytics/{index.js → index.tsx} +11 -11
  181. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  182. package/Decorators/Navigator/index.tsx +1 -1
  183. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  184. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  185. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  186. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  187. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  188. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  189. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  190. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  191. package/Decorators/RiverResolver/index.tsx +6 -8
  192. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  193. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  194. package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
  195. package/package.json +13 -11
  196. package/tsconfig.json +2 -3
  197. package/.babelrc +0 -8
  198. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  199. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  200. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  201. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  202. package/Components/Cell/CellStyles/colors.js +0 -40
  203. package/Components/Cell/CellStyles/index.js +0 -15
  204. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  205. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  206. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  207. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  208. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  209. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  210. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  211. 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;
@@ -77,7 +80,7 @@ export const AnimationView = ({
77
80
  const measureView = React.useCallback(() => {
78
81
  if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
79
82
  animationComponentRef.current.measure(
80
- (x, y, width, height, pageX, pageY) => {
83
+ (_x, _y, _width, _height, _pageX, pageY) => {
81
84
  setTabletLandscapePlayerTopPosition(pageY - 20);
82
85
  }
83
86
  );
@@ -97,13 +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 && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
104
- ? -tabletLandscapePlayerTopPosition + progressBarHeight
105
- : -130
106
- : -50 + progressBarHeight;
103
+ const moveUpValue = getMoveUpValue({
104
+ additionalData,
105
+ insets,
106
+ isAudioItem,
107
+ progressBarHeight,
108
+ isTablet,
109
+ isTabletLandscape,
110
+ inlineAudioPlayer,
111
+ tabletLandscapePlayerTopPosition,
112
+ });
107
113
 
108
114
  const moveComponentHorizontalValue = additionalData.moveValue
109
115
  ? isRTL
@@ -118,7 +124,10 @@ export const AnimationView = ({
118
124
  (animationType, state) => {
119
125
  const defaultConfig = {
120
126
  toValue: 0,
121
- duration: state === PlayerAnimationStateEnum.minimize ? 150 : 100,
127
+ duration:
128
+ state === PlayerAnimationStateEnum.minimize
129
+ ? DURATION_TO_MINIMIZE
130
+ : DEFAULT_DURATION_FOR_ANIMATION,
122
131
  useNativeDriver: true,
123
132
  };
124
133
 
@@ -227,6 +236,8 @@ export const AnimationView = ({
227
236
  isAudioItem,
228
237
  moveUpValue,
229
238
  moveComponentHorizontalValue,
239
+ isRTL,
240
+ inlineAudioPlayer,
230
241
  ]
231
242
  );
232
243
 
@@ -245,7 +256,7 @@ export const AnimationView = ({
245
256
  default:
246
257
  return getAnimationValue(
247
258
  animationType,
248
- PlayerAnimationStateEnum.maximaze
259
+ PlayerAnimationStateEnum.maximize
249
260
  ).toValue;
250
261
  }
251
262
  }, [defaultValue, videoModalState]);
@@ -277,6 +288,11 @@ export const AnimationView = ({
277
288
  moveUpValue,
278
289
  moveComponentHorizontalValue,
279
290
  videoModalMode,
291
+ isAudioItem,
292
+ isTablet,
293
+ isTabletLandscape,
294
+ isRTL,
295
+ inlineAudioPlayer,
280
296
  ]
281
297
  );
282
298
 
@@ -305,7 +321,7 @@ export const AnimationView = ({
305
321
  }
306
322
 
307
323
  if (
308
- videoModalMode === "MAXIMIZED" &&
324
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
309
325
  defaultValue.x !== screenWidth &&
310
326
  width &&
311
327
  height
@@ -331,7 +347,13 @@ export const AnimationView = ({
331
347
  animatedValue.setValue(value);
332
348
  }
333
349
  }
334
- }, [videoModalState]);
350
+ }, [
351
+ animatedValue,
352
+ animationType,
353
+ getAnimationValue,
354
+ playerAnimationState,
355
+ videoModalState,
356
+ ]);
335
357
 
336
358
  React.useEffect(() => {
337
359
  if (
@@ -343,7 +365,7 @@ export const AnimationView = ({
343
365
  animatedValue,
344
366
  getAnimationValue(animationType, playerAnimationState)
345
367
  ).start();
346
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
368
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
347
369
  animatedValue.setValue(defaultValue);
348
370
  }
349
371
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -404,7 +426,7 @@ export const AnimationView = ({
404
426
 
405
427
  return (
406
428
  <Animated.View
407
- onLayout={additionalData.useLayoutMeasure && measureView}
429
+ onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
408
430
  ref={animationComponentRef}
409
431
  style={[
410
432
  ...preparedStyles,
@@ -426,6 +448,10 @@ export const AnimationComponent = (props: Props) => {
426
448
  videoModalState: { visible },
427
449
  } = useNavigation();
428
450
 
451
+ if (additionalData?.disableAnimatedComponent) {
452
+ return <>{props.children}</>;
453
+ }
454
+
429
455
  const useAnimation =
430
456
  visible && !additionalData.disableAnimatedComponent && !isTV();
431
457
 
@@ -434,8 +460,8 @@ export const AnimationComponent = (props: Props) => {
434
460
  const Component = useAnimation
435
461
  ? AnimationView
436
462
  : style
437
- ? View
438
- : React.Fragment;
463
+ ? View
464
+ : React.Fragment;
439
465
 
440
466
  if (
441
467
  additionalData.extraAnimation &&
@@ -1,14 +1,12 @@
1
- import React, { useContext } from "react";
1
+ import React, { useEffect } from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
4
  import {
5
5
  useSafeAreaInsets,
6
6
  useSafeAreaFrame,
7
7
  } from "react-native-safe-area-context";
8
- import {
9
- useGetBottomTabBarHeight,
10
- useNavigation,
11
- } from "@applicaster/zapp-react-native-utils/reactHooks";
8
+ import { useGetBottomTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useGetBottomTabBarHeight";
9
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
12
10
  import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
13
11
 
14
12
  import { PROGRESS_BAR_HEIGHT } from "./utils";
@@ -16,12 +14,12 @@ import { useConfiguration } from "../utils";
16
14
 
17
15
  export enum PlayerAnimationStateEnum {
18
16
  minimize = "minimize",
19
- maximaze = "maximaze",
17
+ maximize = "maximize",
20
18
  drag_player = "drag_player",
21
19
  drag_scroll = "drag_scroll",
22
20
  }
23
21
 
24
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
22
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
25
23
 
26
24
  export type ModalAnimationContextT = {
27
25
  isActiveGesture: boolean;
@@ -48,7 +46,7 @@ export type ModalAnimationContextT = {
48
46
  progressBarHeight: number;
49
47
  };
50
48
 
51
- const ReactContext = React.createContext<ModalAnimationContextT>({
49
+ export const ReactContext = React.createContext<ModalAnimationContextT>({
52
50
  isActiveGesture: false,
53
51
  playerAnimationState: null,
54
52
  setPlayerAnimationState: () => null,
@@ -73,10 +71,6 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
73
71
  progressBarHeight: 0,
74
72
  });
75
73
 
76
- export function useModalAnimationContext() {
77
- return useContext<ModalAnimationContextT>(ReactContext);
78
- }
79
-
80
74
  const Provider = ({ children }: { children: React.ReactNode }) => {
81
75
  const [playerAnimationState, setPlayerAnimationState] =
82
76
  React.useState<PlayerAnimationStateT>(null);
@@ -101,6 +95,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
101
95
  setStartComponentsAnimation(false);
102
96
  }, []);
103
97
 
98
+ useEffect(() => {
99
+ // Reset player animation state when video modal is closed
100
+ if (!visible) {
101
+ resetPlayerAnimationState();
102
+ }
103
+ }, [visible, resetPlayerAnimationState]);
104
+
104
105
  // Animated values
105
106
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
106
107
  const dragScrollY = React.useRef(new Animated.Value(0)).current;
@@ -124,11 +125,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
124
125
  If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
125
126
  Because of this we need to minus bottom SafeArea offset.
126
127
  */
128
+
127
129
  const minValue =
128
130
  height -
129
- minimisedHeight -
130
- (bottomTabBarHeight || bottomSafeArea) -
131
- progressBarHeight;
131
+ (minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
132
132
 
133
133
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
134
134
  // Last snap state which will helps us to make smooth responder to scrollview animation
@@ -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
@@ -6,10 +6,13 @@ export { AnimatedVideoPlayerComponent } from "./AnimatedVideoPlayerComponent";
6
6
 
7
7
  export {
8
8
  withModalAnimationProvider,
9
- useModalAnimationContext,
10
9
  PlayerAnimationStateEnum,
11
10
  } from "./ModalAnimationContext";
12
11
 
12
+ export { useModalAnimationContext } from "./useModalAnimationContext";
13
+
13
14
  export { AnimationComponent } from "./AnimationComponent";
14
15
 
15
16
  export { ComponentAnimationType, defaultAspectRatioWidth } from "./utils";
17
+
18
+ export { DURATION_TO_MINIMIZE, DURATION_TO_MAXIMIZE } from "./const";
@@ -0,0 +1,6 @@
1
+ import { useContext } from "react";
2
+ import { ModalAnimationContextT, ReactContext } from "./ModalAnimationContext";
3
+
4
+ export function useModalAnimationContext() {
5
+ return useContext<ModalAnimationContextT>(ReactContext);
6
+ }
@@ -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",
@@ -108,8 +109,8 @@ export const calculateAnimationValue = (animationType, dragPosition, data) => {
108
109
  : { forWidth: 3, forHeight: 3 }
109
110
  : { forWidth: 2, forHeight: 2 }
110
111
  : isTabletLandscape
111
- ? { forWidth: 8, forHeight: 6.5 }
112
- : { forWidth: 3.5, forHeight: 2 };
112
+ ? { forWidth: 8, forHeight: 6.5 }
113
+ : { forWidth: 3.5, forHeight: 2 };
113
114
 
114
115
  const minWidth =
115
116
  isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
@@ -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
+ };
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+
4
+ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
5
+
6
+ import { Spinner } from "../Spinner";
7
+
8
+ const styles = StyleSheet.create({
9
+ container: {
10
+ ...StyleSheet.absoluteFillObject,
11
+ alignItems: "center",
12
+ justifyContent: "center",
13
+ },
14
+ });
15
+
16
+ export const OpaqueLayer = () => {
17
+ const theme = useTheme();
18
+
19
+ return (
20
+ <View
21
+ style={[
22
+ styles.container,
23
+ {
24
+ // we assume that it's non-transparent and we could show spinner always until it will be covered by player
25
+ // this spinner hides all content under modal
26
+ backgroundColor: theme?.app_background_color,
27
+ },
28
+ ]}
29
+ >
30
+ <Spinner />
31
+ </View>
32
+ );
33
+ };
@@ -1,10 +1,11 @@
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";
@@ -21,9 +22,9 @@ type Props = {
21
22
  entry: ZappEntry;
22
23
  style: StyleProp<ViewStyle>;
23
24
  configuration: Configuration;
24
- isTabletLandscape: boolean;
25
+ isTabletLandscape?: boolean;
25
26
  isAudioPlayer?: boolean;
26
- isTablet: boolean;
27
+ isTablet?: boolean;
27
28
  };
28
29
 
29
30
  const containerStyle = ({
@@ -38,9 +39,9 @@ export const PlayerDetails = ({
38
39
  entry,
39
40
  style,
40
41
  configuration,
41
- isTabletLandscape,
42
+ isTabletLandscape = false,
42
43
  isAudioPlayer,
43
- isTablet,
44
+ isTablet = false,
44
45
  }: Props) => {
45
46
  const screenData = useTargetScreenData(entry);
46
47
  const insets = useSafeAreaInsets();
@@ -90,17 +91,19 @@ export const PlayerDetails = ({
90
91
  {
91
92
  // workaround for avoid wrong text-height after going back to portrait rotation
92
93
  // 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,
94
+ width: isTablet
95
+ ? undefined
96
+ : (StyleSheet.flatten(style)?.width ?? SCREEN_WIDTH),
94
97
  },
95
98
  ]}
96
99
  >
97
- {screenData && (
100
+ {screenData ? (
98
101
  <ComponentsMap
99
102
  riverId={screenData.id}
100
103
  feed={screenData?.data?.source}
101
104
  riverComponents={screenData.ui_components}
102
105
  />
103
- )}
106
+ ) : null}
104
107
  </Animated.View>
105
108
  );
106
109
  };
@@ -10,7 +10,8 @@ import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
10
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
11
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
12
12
  import { PlayerDetails } from "./PlayerDetails";
13
- import { playerDimesionsHack } from "./utils";
13
+ import { playerDimensionsHack } from "./utils";
14
+ import { useDelayedPlayerDetails } from "./hooks";
14
15
 
15
16
  import {
16
17
  AnimatedScrollModal,
@@ -99,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
99
100
  return ["top"];
100
101
  };
101
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
+
102
121
  const getTabletWidth = (
103
122
  configuration: Configuration,
104
123
  dimensions: DimensionsT
@@ -107,46 +126,23 @@ const getTabletWidth = (
107
126
  configuration?.tablet_landscape_sidebar_width;
108
127
 
109
128
  const { width } = dimensions;
129
+ let widthValue = Number(width);
130
+
131
+ if (isPercentage(width)) {
132
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
133
+ }
110
134
 
111
135
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
112
136
 
113
137
  if (tablet_landscape_sidebar_width?.includes("%")) {
114
- return Number(width) * (1 - sidebarWidth / 100);
138
+ return widthValue * (1 - sidebarWidth / 100);
115
139
  }
116
140
 
117
141
  if (Number.isNaN(sidebarWidth)) {
118
- return Number(width) * 0.65;
119
- }
120
-
121
- return Number(width) - sidebarWidth;
122
- };
123
-
124
- const showDetails = (
125
- isMobile: boolean,
126
- docked: boolean,
127
- isInlineModal,
128
- pip
129
- ): boolean => {
130
- if (pip) {
131
- return false;
132
- }
133
-
134
- if (!isInlineModal) {
135
- return false;
136
- }
137
-
138
- // for mobile we always show details. Mounting of it very heavy operation.
139
- if (isMobile) {
140
- return true;
141
- }
142
-
143
- // workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
144
- // FIXME - find out the reason of dissapearing of content
145
- if (docked) {
146
- return false;
142
+ return widthValue * 0.65;
147
143
  }
148
144
 
149
- return true;
145
+ return widthValue - sidebarWidth;
150
146
  };
151
147
 
152
148
  const PlayerWrapperComponent = (props: Props) => {
@@ -167,7 +163,15 @@ const PlayerWrapperComponent = (props: Props) => {
167
163
 
168
164
  const isInlineModal = inline && isModal;
169
165
 
170
- // const style = getStyles(baseStyle, !isTablet, isInlineModal, pip);
166
+ // Mounting the PlayerDetails component is a resource-intensive process.
167
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
168
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
169
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
170
+ const isShowPlayerDetails = useDelayedPlayerDetails({
171
+ isInline: isInlineModal,
172
+ isDocked: docked,
173
+ isPip: pip,
174
+ });
171
175
 
172
176
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
173
177
 
@@ -203,8 +207,8 @@ const PlayerWrapperComponent = (props: Props) => {
203
207
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
204
208
 
205
209
  const childrenStyles = React.useMemo(
206
- () => ({ ...playerDimensions, ...playerDimesionsHack }),
207
- [containerDimensions, playerDimesionsHack]
210
+ () => ({ ...playerDimensions, ...playerDimensionsHack }),
211
+ [containerDimensions, playerDimensionsHack]
208
212
  );
209
213
 
210
214
  return (
@@ -213,7 +217,7 @@ const PlayerWrapperComponent = (props: Props) => {
213
217
  style={[
214
218
  safeAreaStyles(configuration, isTablet),
215
219
  style,
216
- playerDimesionsHack,
220
+ playerDimensionsHack,
217
221
  ]}
218
222
  >
219
223
  <AnimationComponent
@@ -227,7 +231,7 @@ const PlayerWrapperComponent = (props: Props) => {
227
231
  defaultStyles.playerContainer,
228
232
  containerDimensions,
229
233
  containerStyle,
230
- playerDimesionsHack,
234
+ playerDimensionsHack,
231
235
  ]}
232
236
  >
233
237
  <AnimationComponent
@@ -246,7 +250,7 @@ const PlayerWrapperComponent = (props: Props) => {
246
250
  </View>
247
251
 
248
252
  <AnimatedScrollModal>
249
- {showDetails(!isTablet, docked, isInlineModal, pip) && (
253
+ {isShowPlayerDetails ? (
250
254
  <AnimationComponent
251
255
  animationType={ComponentAnimationType.componentFade}
252
256
  style={defaultStyles.flex}
@@ -259,7 +263,7 @@ const PlayerWrapperComponent = (props: Props) => {
259
263
  isTablet={isTablet}
260
264
  />
261
265
  </AnimationComponent>
262
- )}
266
+ ) : null}
263
267
  </AnimatedScrollModal>
264
268
  </AnimationComponent>
265
269
  </WrapperView>