@applicaster/zapp-react-native-ui-components 13.0.0-rc.14 → 13.0.0-rc.141

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 (226) 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/index.tsx +15 -0
  4. package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
  5. package/Components/AudioPlayer/mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap +66 -0
  6. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  7. package/Components/AudioPlayer/mobile/index.tsx +18 -0
  8. package/Components/AudioPlayer/tv/Artwork.tsx +40 -0
  9. package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +37 -79
  10. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +2 -1
  11. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +12 -9
  12. package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +12 -9
  13. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +5 -8
  14. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +6 -6
  15. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +11 -6
  16. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
  17. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +3 -3
  18. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +3 -3
  19. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +3 -3
  20. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +3 -5
  21. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +9 -7
  22. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +3 -5
  23. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +3 -5
  24. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +3 -5
  25. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -5
  26. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +14 -63
  27. package/Components/AudioPlayer/types.ts +40 -0
  28. package/Components/BaseFocusable/index.ios.ts +1 -1
  29. package/Components/BaseFocusable/index.tsx +67 -31
  30. package/Components/Cell/Cell.tsx +14 -14
  31. package/Components/Cell/CellWithFocusable.tsx +50 -59
  32. package/Components/Cell/CellWrapper.tsx +18 -0
  33. package/Components/Cell/TvOSCellComponent.tsx +20 -26
  34. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  35. package/Components/Cell/index.js +3 -1
  36. package/Components/Cell/styles.ts +17 -0
  37. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  38. package/Components/CellRendererResolver/index.ts +2 -1
  39. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  40. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  41. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  42. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  43. package/Components/ErrorScreen/index.tsx +14 -6
  44. package/Components/Focusable/Focusable.tsx +1 -54
  45. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  46. package/Components/Focusable/Touchable.tsx +19 -20
  47. package/Components/Focusable/index.android.tsx +10 -3
  48. package/Components/FocusableCell/index.tsx +1 -1
  49. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  50. package/Components/FocusableGroup/index.tsx +0 -3
  51. package/Components/FocusableList/index.tsx +26 -10
  52. package/Components/FocusableScrollView/index.tsx +43 -13
  53. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  54. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  55. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -3
  56. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  57. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  58. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  59. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  60. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  61. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  62. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
  63. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  64. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  65. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  66. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  67. package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
  68. package/Components/Layout/TV/index.tsx +6 -20
  69. package/Components/Layout/TV/index.web.tsx +4 -1
  70. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  71. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  72. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  73. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
  74. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  75. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  76. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  77. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  78. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  79. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  80. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  81. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  82. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  83. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  84. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  85. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  86. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  87. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  88. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  89. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  90. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  91. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  92. package/Components/MasterCell/utils/index.ts +9 -135
  93. package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
  94. package/Components/ModalComponent/Button/Item.tsx +6 -5
  95. package/Components/ModalComponent/Button/assets.ts +1 -1
  96. package/Components/ModalComponent/Button/index.tsx +45 -62
  97. package/Components/ModalComponent/Header/index.tsx +12 -11
  98. package/Components/ModalComponent/utils.ts +55 -7
  99. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  100. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  101. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  102. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  103. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  104. package/Components/OfflineHandler/utils/index.ts +1 -1
  105. package/Components/PlayerContainer/PlayerContainer.tsx +76 -66
  106. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  107. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  108. package/Components/PlayerImageBackground/index.tsx +2 -2
  109. package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -68
  110. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  111. package/Components/River/RefreshControl.tsx +1 -1
  112. package/Components/River/RiverFooter.tsx +39 -9
  113. package/Components/River/RiverItem.tsx +44 -4
  114. package/Components/River/TV/index.tsx +6 -1
  115. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +115 -46
  116. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  117. package/Components/River/__tests__/componentsMap.test.js +64 -17
  118. package/Components/River/__tests__/river.test.js +75 -40
  119. package/Components/RouteManager/TestId.tsx +1 -5
  120. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -5
  121. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  122. package/Components/RouteManager/__tests__/testId.test.js +4 -6
  123. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  124. package/Components/Screen/TV/index.web.tsx +5 -6
  125. package/Components/Screen/__tests__/Screen.test.tsx +53 -31
  126. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +6 -6
  127. package/Components/Screen/hooks.ts +53 -0
  128. package/Components/Screen/index.tsx +16 -42
  129. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  130. package/Components/Tabs/Tab.tsx +12 -9
  131. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  132. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  133. package/Components/TextInputTv/index.tsx +6 -5
  134. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  135. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  136. package/Components/TrackedView/index.tsx +1 -0
  137. package/Components/Transitioner/AnimationManager.js +15 -15
  138. package/Components/Transitioner/Scene.tsx +53 -24
  139. package/Components/Transitioner/Transitioner.tsx +3 -3
  140. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  141. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  142. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  143. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  144. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  145. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  146. package/Components/Transitioner/index.js +8 -4
  147. package/Components/VideoLive/LiveImageManager.ts +27 -1
  148. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  149. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  150. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
  151. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  152. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
  153. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  154. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -23
  155. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +16 -15
  156. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  157. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  158. package/Components/VideoModal/ModalAnimation/index.ts +4 -1
  159. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  160. package/Components/VideoModal/ModalAnimation/utils.ts +32 -2
  161. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  162. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  163. package/Components/VideoModal/PlayerWrapper.tsx +51 -57
  164. package/Components/VideoModal/VideoModal.tsx +17 -11
  165. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  166. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  167. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  168. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +74 -104
  169. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +51 -0
  170. package/Components/VideoModal/hooks/index.ts +7 -0
  171. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +38 -0
  172. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  173. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  174. package/Components/VideoModal/utils.ts +6 -9
  175. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  176. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  177. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  178. package/Components/Viewport/__tests__/utils.test.js +5 -4
  179. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  180. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  181. package/Components/ZappUIComponent/index.tsx +4 -17
  182. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  183. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  184. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  185. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  186. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  187. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  188. package/Contexts/ScreenContext/index.tsx +6 -12
  189. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  190. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  191. package/Decorators/Navigator/index.tsx +1 -1
  192. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  193. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  194. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  195. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  196. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  197. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  198. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  199. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  200. package/Decorators/RiverResolver/index.tsx +6 -8
  201. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  202. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  203. package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
  204. package/package.json +13 -11
  205. package/tsconfig.json +2 -3
  206. package/.babelrc +0 -8
  207. package/Components/AudioPlayer/Artwork.tsx +0 -35
  208. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -123
  209. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -50
  210. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -27
  211. package/Components/AudioPlayer/index.ts +0 -1
  212. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  213. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  214. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  215. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  216. package/Components/Cell/CellStyles/colors.js +0 -40
  217. package/Components/Cell/CellStyles/index.js +0 -15
  218. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  219. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  220. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  221. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  222. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  223. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  224. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  225. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
  226. /package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
@@ -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
  );
@@ -91,19 +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 && (!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
+ tabletLandscapePlayerTopPosition,
111
+ });
107
112
 
108
113
  const moveComponentHorizontalValue = additionalData.moveValue
109
114
  ? isRTL
@@ -118,7 +123,10 @@ export const AnimationView = ({
118
123
  (animationType, state) => {
119
124
  const defaultConfig = {
120
125
  toValue: 0,
121
- duration: state === PlayerAnimationStateEnum.minimize ? 150 : 100,
126
+ duration:
127
+ state === PlayerAnimationStateEnum.minimize
128
+ ? DURATION_TO_MINIMIZE
129
+ : DEFAULT_DURATION_FOR_ANIMATION,
122
130
  useNativeDriver: true,
123
131
  };
124
132
 
@@ -227,6 +235,8 @@ export const AnimationView = ({
227
235
  isAudioItem,
228
236
  moveUpValue,
229
237
  moveComponentHorizontalValue,
238
+ isRTL,
239
+ inlineAudioPlayer,
230
240
  ]
231
241
  );
232
242
 
@@ -245,7 +255,7 @@ export const AnimationView = ({
245
255
  default:
246
256
  return getAnimationValue(
247
257
  animationType,
248
- PlayerAnimationStateEnum.maximaze
258
+ PlayerAnimationStateEnum.maximize
249
259
  ).toValue;
250
260
  }
251
261
  }, [defaultValue, videoModalState]);
@@ -277,6 +287,11 @@ export const AnimationView = ({
277
287
  moveUpValue,
278
288
  moveComponentHorizontalValue,
279
289
  videoModalMode,
290
+ isAudioItem,
291
+ isTablet,
292
+ isTabletLandscape,
293
+ isRTL,
294
+ inlineAudioPlayer,
280
295
  ]
281
296
  );
282
297
 
@@ -305,7 +320,7 @@ export const AnimationView = ({
305
320
  }
306
321
 
307
322
  if (
308
- videoModalMode === "MAXIMIZED" &&
323
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
309
324
  defaultValue.x !== screenWidth &&
310
325
  width &&
311
326
  height
@@ -331,7 +346,13 @@ export const AnimationView = ({
331
346
  animatedValue.setValue(value);
332
347
  }
333
348
  }
334
- }, [videoModalState]);
349
+ }, [
350
+ animatedValue,
351
+ animationType,
352
+ getAnimationValue,
353
+ playerAnimationState,
354
+ videoModalState,
355
+ ]);
335
356
 
336
357
  React.useEffect(() => {
337
358
  if (
@@ -343,7 +364,7 @@ export const AnimationView = ({
343
364
  animatedValue,
344
365
  getAnimationValue(animationType, playerAnimationState)
345
366
  ).start();
346
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
367
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
347
368
  animatedValue.setValue(defaultValue);
348
369
  }
349
370
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -404,7 +425,7 @@ export const AnimationView = ({
404
425
 
405
426
  return (
406
427
  <Animated.View
407
- onLayout={additionalData.useLayoutMeasure && measureView}
428
+ onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
408
429
  ref={animationComponentRef}
409
430
  style={[
410
431
  ...preparedStyles,
@@ -426,6 +447,10 @@ export const AnimationComponent = (props: Props) => {
426
447
  videoModalState: { visible },
427
448
  } = useNavigation();
428
449
 
450
+ if (additionalData?.disableAnimatedComponent) {
451
+ return <>{props.children}</>;
452
+ }
453
+
429
454
  const useAnimation =
430
455
  visible && !additionalData.disableAnimatedComponent && !isTV();
431
456
 
@@ -434,8 +459,8 @@ export const AnimationComponent = (props: Props) => {
434
459
  const Component = useAnimation
435
460
  ? AnimationView
436
461
  : style
437
- ? View
438
- : React.Fragment;
462
+ ? View
463
+ : React.Fragment;
439
464
 
440
465
  if (
441
466
  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,13 @@ 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",
20
+ appear_as_docked = "appear_as_docked",
22
21
  }
23
22
 
24
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
25
24
 
26
25
  export type ModalAnimationContextT = {
27
26
  isActiveGesture: boolean;
@@ -48,7 +47,7 @@ export type ModalAnimationContextT = {
48
47
  progressBarHeight: number;
49
48
  };
50
49
 
51
- const ReactContext = React.createContext<ModalAnimationContextT>({
50
+ export const ReactContext = React.createContext<ModalAnimationContextT>({
52
51
  isActiveGesture: false,
53
52
  playerAnimationState: null,
54
53
  setPlayerAnimationState: () => null,
@@ -73,10 +72,6 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
73
72
  progressBarHeight: 0,
74
73
  });
75
74
 
76
- export function useModalAnimationContext() {
77
- return useContext<ModalAnimationContextT>(ReactContext);
78
- }
79
-
80
75
  const Provider = ({ children }: { children: React.ReactNode }) => {
81
76
  const [playerAnimationState, setPlayerAnimationState] =
82
77
  React.useState<PlayerAnimationStateT>(null);
@@ -101,6 +96,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
101
96
  setStartComponentsAnimation(false);
102
97
  }, []);
103
98
 
99
+ useEffect(() => {
100
+ // Reset player animation state when video modal is closed
101
+ if (!visible) {
102
+ resetPlayerAnimationState();
103
+ }
104
+ }, [visible, resetPlayerAnimationState]);
105
+
104
106
  // Animated values
105
107
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
106
108
  const dragScrollY = React.useRef(new Animated.Value(0)).current;
@@ -124,11 +126,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
124
126
  If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
125
127
  Because of this we need to minus bottom SafeArea offset.
126
128
  */
129
+
127
130
  const minValue =
128
131
  height -
129
- minimisedHeight -
130
- (bottomTabBarHeight || bottomSafeArea) -
131
- progressBarHeight;
132
+ (minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
132
133
 
133
134
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
134
135
  // 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,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
+ };
@@ -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,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
  };