@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3755455151 → 13.0.0-alpha.3829509172

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 (146) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  3. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  6. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  8. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  9. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  11. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  12. package/Components/AudioPlayer/helpers.tsx +1 -0
  13. package/Components/BaseFocusable/index.ios.ts +1 -1
  14. package/Components/BaseFocusable/index.tsx +2 -3
  15. package/Components/Cell/Cell.tsx +8 -3
  16. package/Components/Cell/CellWithFocusable.tsx +44 -59
  17. package/Components/Cell/TvOSCellComponent.tsx +20 -26
  18. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  19. package/Components/Cell/index.js +3 -1
  20. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  21. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  22. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  23. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  24. package/Components/ErrorScreen/index.tsx +6 -6
  25. package/Components/Focusable/Focusable.tsx +1 -0
  26. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  27. package/Components/Focusable/Touchable.tsx +19 -20
  28. package/Components/Focusable/index.android.tsx +10 -3
  29. package/Components/FocusableCell/index.tsx +1 -1
  30. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  31. package/Components/FocusableGroup/index.tsx +0 -3
  32. package/Components/FocusableList/index.tsx +26 -10
  33. package/Components/FocusableScrollView/index.tsx +43 -13
  34. package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
  35. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  36. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  37. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  38. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  39. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
  40. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
  41. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  42. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  43. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  44. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  45. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  46. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  47. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  48. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  49. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  50. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  51. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  52. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  53. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  54. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  55. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  56. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  57. package/Components/MasterCell/utils/index.ts +9 -135
  58. package/Components/ModalComponent/Button/index.tsx +6 -6
  59. package/Components/ModalComponent/Header/index.tsx +3 -3
  60. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  61. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  62. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  63. package/Components/PlayerContainer/PlayerContainer.tsx +20 -20
  64. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  65. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  66. package/Components/PlayerImageBackground/index.tsx +1 -1
  67. package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
  68. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  69. package/Components/River/RiverFooter.tsx +39 -9
  70. package/Components/River/RiverItem.tsx +37 -2
  71. package/Components/River/TV/index.tsx +6 -1
  72. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
  73. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  74. package/Components/River/__tests__/componentsMap.test.js +17 -5
  75. package/Components/River/__tests__/river.test.js +75 -40
  76. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  77. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  78. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  79. package/Components/Screen/TV/index.web.tsx +5 -6
  80. package/Components/Screen/hooks.ts +53 -0
  81. package/Components/Screen/index.tsx +16 -42
  82. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  83. package/Components/Tabs/Tab.tsx +11 -9
  84. package/Components/TextInputTv/index.tsx +4 -3
  85. package/Components/TrackedView/index.tsx +1 -0
  86. package/Components/Transitioner/AnimationManager.js +15 -15
  87. package/Components/Transitioner/Scene.tsx +53 -24
  88. package/Components/Transitioner/Transitioner.tsx +3 -3
  89. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  90. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -49
  91. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  92. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  93. package/Components/Transitioner/index.js +8 -4
  94. package/Components/VideoLive/LiveImageManager.ts +27 -1
  95. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  96. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
  97. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -5
  98. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  99. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +49 -31
  100. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  101. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +32 -18
  102. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -5
  103. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  104. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  105. package/Components/VideoModal/PlayerDetails.tsx +9 -6
  106. package/Components/VideoModal/PlayerWrapper.tsx +17 -36
  107. package/Components/VideoModal/VideoModal.tsx +16 -25
  108. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
  109. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
  110. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  111. package/Components/VideoModal/hooks/index.ts +7 -0
  112. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  113. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  114. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  115. package/Components/VideoModal/utils.ts +1 -1
  116. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  117. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  118. package/Components/Viewport/__tests__/utils.test.js +5 -4
  119. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  120. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  121. package/Components/ZappUIComponent/index.tsx +3 -16
  122. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  123. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  124. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  125. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  126. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  127. package/Contexts/ScreenContext/index.tsx +6 -12
  128. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  129. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  130. package/Decorators/Navigator/index.tsx +1 -1
  131. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  132. package/Decorators/RiverResolver/index.tsx +6 -8
  133. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  134. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  135. package/Decorators/ZappPipesDataConnector/index.tsx +6 -2
  136. package/package.json +7 -12
  137. package/tsconfig.json +2 -3
  138. package/.babelrc +0 -8
  139. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  140. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  141. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  142. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  143. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  144. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  145. package/Decorators/Navigator/__tests__/react-router-native-mock.js +0 -11
  146. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,26 +1,26 @@
1
1
  import React from "react";
2
- import { Animated, StyleSheet, View, Platform } from "react-native";
2
+ import { Animated, Platform, StyleSheet, View } from "react-native";
3
3
 
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import {
6
+ GestureHandlerRootView,
6
7
  NativeViewGestureHandler,
7
8
  PanGestureHandler,
8
9
  State,
9
10
  TapGestureHandler,
10
- GestureHandlerRootView,
11
11
  } from "react-native-gesture-handler";
12
12
 
13
13
  import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
14
14
  import {
15
- useModalAnimationContext,
16
15
  PlayerAnimationStateEnum,
16
+ useModalAnimationContext,
17
17
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
18
18
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
19
19
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
20
20
 
21
21
  import {
22
- setScrollModalAnimatedValue,
23
22
  resetScrollAnimatedValues,
23
+ setScrollModalAnimatedValue,
24
24
  } from "./utils";
25
25
 
26
26
  const getAnimatedConfig = (toValue) => {
@@ -62,25 +62,34 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
62
62
  } = useModalAnimationContext();
63
63
 
64
64
  const [enableGesture, setIEnableGesture] = React.useState<boolean>(true);
65
- const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
65
+
66
+ const { isLanguageOverlayVisible, isSeekBarTouch } = React.useContext(
67
+ PlayerContainerContext
68
+ );
66
69
 
67
70
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
68
71
  useNavigation();
69
72
 
70
- const { mode: videoModalMode, item: videoModalItem } = videoModalState;
71
- const isMaximazedModal = videoModalMode === "MAXIMIZED";
72
- const isMinimizedModal = videoModalMode === "MINIMIZED";
73
+ const {
74
+ mode: videoModalMode,
75
+ previousMode: previousVideoModalMode,
76
+ item: videoModalItem,
77
+ } = videoModalState;
78
+
79
+ const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
80
+ const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
73
81
  const previousItemId = usePrevious(videoModalItem?.id);
74
82
 
75
83
  const isNotMinimizeMaximazeAnimation =
76
84
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
77
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
85
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
78
86
 
79
87
  const isEnablePanGesture =
80
88
  enableGesture &&
81
89
  !isLanguageOverlayVisible &&
82
90
  isNotMinimizeMaximazeAnimation &&
83
- (isMaximazedModal || isMinimizedModal);
91
+ !isSeekBarTouch &&
92
+ (isMaximizedModal || isMinimizedModal);
84
93
 
85
94
  const isAudioItem = React.useMemo(
86
95
  () =>
@@ -117,7 +126,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
117
126
  const preparedTranslationY =
118
127
  Math.abs(translationY) - lastScrollYValue.current;
119
128
 
120
- if (videoModalMode === "MAXIMIZED") {
129
+ if (isMaximizedModal) {
121
130
  const endOffsetY =
122
131
  lastSnap + preparedTranslationY + dragToss * velocityY + 150;
123
132
 
@@ -133,14 +142,14 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
133
142
 
134
143
  setLastSnap(destSnapPoint);
135
144
 
136
- if (destSnapPoint === modalSnapPoints[0]) {
145
+ if (destSnapPoint === modalSnapPoints[0] && isMinimizedModal) {
137
146
  translateYOffset.extractOffset();
138
147
  translateYOffset.setValue(preparedTranslationY);
139
148
  translateYOffset.flattenOffset();
140
149
  dragScrollY.setValue(0);
141
150
 
142
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
143
- } else {
151
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
152
+ } else if (destSnapPoint !== modalSnapPoints[0] && isMaximizedModal) {
144
153
  setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
145
154
  }
146
155
  } else {
@@ -154,7 +163,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
154
163
 
155
164
  dragScrollY.setValue(0);
156
165
 
157
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
166
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
158
167
  } else {
159
168
  resetPlayerAnimationState();
160
169
  }
@@ -164,7 +173,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
164
173
  resetPlayerAnimationState();
165
174
  }
166
175
  },
167
- [lastSnap, modalSnapPoints, playerAnimationState, videoModalMode]
176
+ [
177
+ lastSnap,
178
+ modalSnapPoints,
179
+ playerAnimationState,
180
+ isMinimizedModal,
181
+ isMaximizedModal,
182
+ ]
168
183
  );
169
184
 
170
185
  const onScroll = React.useCallback(({ nativeEvent }) => {
@@ -215,17 +230,18 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
215
230
  }, []);
216
231
 
217
232
  React.useEffect(() => {
218
- const { mode, previousMode, item } = videoModalState;
219
-
220
233
  if (
221
- mode === "MAXIMIZED" &&
234
+ videoModalMode === "MAXIMIZED" &&
222
235
  !enableGesture &&
223
236
  scrollPosition.current === 0
224
237
  ) {
225
238
  setIEnableGesture(true);
226
239
  }
227
240
 
228
- if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
241
+ if (
242
+ videoModalMode === "MINIMIZED" &&
243
+ previousVideoModalMode === "MAXIMIZED"
244
+ ) {
229
245
  // set animation to the minimize values if moving from the player to another screen
230
246
  if (playerAnimationState === null) {
231
247
  setScrollModalAnimatedValue(
@@ -243,14 +259,16 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
243
259
  }
244
260
  } else if (
245
261
  playerAnimationState === null &&
246
- ((previousItemId === item?.id &&
247
- mode === "MAXIMIZED" &&
248
- (previousMode === "MINIMIZED" || previousMode === "MAXIMIZED")) ||
249
- (previousItemId !== item?.id && mode !== "FULLSCREEN"))
262
+ ((previousItemId === videoModalItem?.id &&
263
+ videoModalMode === "MAXIMIZED" &&
264
+ (previousVideoModalMode === "MINIMIZED" ||
265
+ previousVideoModalMode === "MAXIMIZED")) ||
266
+ (previousItemId !== videoModalItem?.id &&
267
+ videoModalMode !== "FULLSCREEN"))
250
268
  ) {
251
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
269
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
252
270
  }
253
- }, [videoModalState]);
271
+ }, [videoModalMode, previousVideoModalMode, videoModalItem]);
254
272
 
255
273
  React.useEffect(() => {
256
274
  if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
@@ -292,7 +310,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
292
310
 
293
311
  resetPlayerAnimationState();
294
312
  });
295
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
313
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
296
314
  Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
297
315
  maximiseVideoModal();
298
316
  setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
@@ -342,6 +360,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
342
360
  []
343
361
  );
344
362
 
363
+ const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
364
+
345
365
  return (
346
366
  <Wrapper style={generalStyles.container}>
347
367
  <TapGestureHandler
@@ -355,7 +375,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
355
375
  enabled={isEnablePanGesture}
356
376
  ref={panHandlerRef}
357
377
  simultaneousHandlers={[scrollRef, tapHandlerRef]}
358
- shouldCancelWhenOutside={isMaximazedModal}
378
+ shouldCancelWhenOutside={isMaximizedModal}
359
379
  onGestureEvent={onGestureEvent}
360
380
  onHandlerStateChange={onHandlerStateChange}
361
381
  activeOffsetY={[-5, 5]}
@@ -367,9 +387,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
367
387
  simultaneousHandlers={panHandlerRef}
368
388
  >
369
389
  <Animated.ScrollView
370
- scrollEnabled={
371
- isMaximazedModal && isNotMinimizeMaximazeAnimation
372
- }
390
+ scrollEnabled={scrollEnabled}
373
391
  bounces={false}
374
392
  onScrollBeginDrag={onRegisterLastScroll}
375
393
  onScroll={onScroll}
@@ -41,17 +41,21 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
41
41
  videoModalState: { mode: videoModalMode },
42
42
  } = useNavigation();
43
43
 
44
- const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
44
+ const { isLanguageOverlayVisible, isSeekBarTouch } = React.useContext(
45
+ PlayerContainerContext
46
+ );
47
+
45
48
  const isMaximazedModal = videoModalMode === "MAXIMIZED";
46
49
  const isMinimizedModal = videoModalMode === "MINIMIZED";
47
50
 
48
51
  const isNotMinimizeMaximazeAnimation =
49
52
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
50
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
53
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
51
54
 
52
55
  const isEnablePanGesture =
53
56
  !isLanguageOverlayVisible &&
54
57
  isNotMinimizeMaximazeAnimation &&
58
+ !isSeekBarTouch &&
55
59
  (isMaximazedModal || isMinimizedModal);
56
60
 
57
61
  const onGestureEvent = Animated.event(
@@ -85,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
85
89
  setLastSnap(destSnapPoint);
86
90
 
87
91
  if (destSnapPoint === modalSnapPoints[0]) {
88
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
92
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
89
93
  } else {
90
94
  lastScrollY.setValue(0);
91
95
  lastScrollYValue.current = 0;
@@ -101,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
101
105
  modalSnapPoints[1] - preparedTranslationY
102
106
  );
103
107
 
104
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
108
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
105
109
  } else {
106
110
  resetPlayerAnimationState();
107
111
  }
@@ -4,26 +4,26 @@ 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
27
  } from "./utils";
28
28
 
29
29
  type Props = {
@@ -77,7 +77,7 @@ export const AnimationView = ({
77
77
  const measureView = React.useCallback(() => {
78
78
  if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
79
79
  animationComponentRef.current.measure(
80
- (x, y, width, height, pageX, pageY) => {
80
+ (_x, _y, _width, _height, _pageX, pageY) => {
81
81
  setTabletLandscapePlayerTopPosition(pageY - 20);
82
82
  }
83
83
  );
@@ -100,10 +100,11 @@ export const AnimationView = ({
100
100
  const moveUpValue = additionalData.saveArea
101
101
  ? -insets.top + (isAudioItem ? 0 : progressBarHeight)
102
102
  : isTablet
103
- ? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
104
- ? -tabletLandscapePlayerTopPosition + progressBarHeight
105
- : -130
106
- : -50 + progressBarHeight;
103
+ ? isTabletLandscape &&
104
+ (!isAudioItem || (isAudioItem && inlineAudioPlayer))
105
+ ? -tabletLandscapePlayerTopPosition + progressBarHeight
106
+ : -130
107
+ : -50 + progressBarHeight;
107
108
 
108
109
  const moveComponentHorizontalValue = additionalData.moveValue
109
110
  ? isRTL
@@ -227,6 +228,8 @@ export const AnimationView = ({
227
228
  isAudioItem,
228
229
  moveUpValue,
229
230
  moveComponentHorizontalValue,
231
+ isRTL,
232
+ inlineAudioPlayer,
230
233
  ]
231
234
  );
232
235
 
@@ -245,7 +248,7 @@ export const AnimationView = ({
245
248
  default:
246
249
  return getAnimationValue(
247
250
  animationType,
248
- PlayerAnimationStateEnum.maximaze
251
+ PlayerAnimationStateEnum.maximize
249
252
  ).toValue;
250
253
  }
251
254
  }, [defaultValue, videoModalState]);
@@ -277,6 +280,11 @@ export const AnimationView = ({
277
280
  moveUpValue,
278
281
  moveComponentHorizontalValue,
279
282
  videoModalMode,
283
+ isAudioItem,
284
+ isTablet,
285
+ isTabletLandscape,
286
+ isRTL,
287
+ inlineAudioPlayer,
280
288
  ]
281
289
  );
282
290
 
@@ -305,7 +313,7 @@ export const AnimationView = ({
305
313
  }
306
314
 
307
315
  if (
308
- videoModalMode === "MAXIMIZED" &&
316
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
309
317
  defaultValue.x !== screenWidth &&
310
318
  width &&
311
319
  height
@@ -331,7 +339,13 @@ export const AnimationView = ({
331
339
  animatedValue.setValue(value);
332
340
  }
333
341
  }
334
- }, [videoModalState]);
342
+ }, [
343
+ animatedValue,
344
+ animationType,
345
+ getAnimationValue,
346
+ playerAnimationState,
347
+ videoModalState,
348
+ ]);
335
349
 
336
350
  React.useEffect(() => {
337
351
  if (
@@ -343,7 +357,7 @@ export const AnimationView = ({
343
357
  animatedValue,
344
358
  getAnimationValue(animationType, playerAnimationState)
345
359
  ).start();
346
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
360
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
347
361
  animatedValue.setValue(defaultValue);
348
362
  }
349
363
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -404,7 +418,7 @@ export const AnimationView = ({
404
418
 
405
419
  return (
406
420
  <Animated.View
407
- onLayout={additionalData.useLayoutMeasure && measureView}
421
+ onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
408
422
  ref={animationComponentRef}
409
423
  style={[
410
424
  ...preparedStyles,
@@ -434,8 +448,8 @@ export const AnimationComponent = (props: Props) => {
434
448
  const Component = useAnimation
435
449
  ? AnimationView
436
450
  : style
437
- ? View
438
- : React.Fragment;
451
+ ? View
452
+ : React.Fragment;
439
453
 
440
454
  if (
441
455
  additionalData.extraAnimation &&
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
14
14
 
15
15
  export enum PlayerAnimationStateEnum {
16
16
  minimize = "minimize",
17
- maximaze = "maximaze",
17
+ maximize = "maximize",
18
18
  drag_player = "drag_player",
19
19
  drag_scroll = "drag_scroll",
20
20
  }
21
21
 
22
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
22
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
23
 
24
24
  export type ModalAnimationContextT = {
25
25
  isActiveGesture: boolean;
@@ -118,11 +118,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
118
118
  If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
119
119
  Because of this we need to minus bottom SafeArea offset.
120
120
  */
121
+
121
122
  const minValue =
122
123
  height -
123
- minimisedHeight -
124
- (bottomTabBarHeight || bottomSafeArea) -
125
- progressBarHeight;
124
+ (minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
126
125
 
127
126
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
128
127
  // Last snap state which will helps us to make smooth responder to scrollview animation
@@ -108,8 +108,8 @@ export const calculateAnimationValue = (animationType, dragPosition, data) => {
108
108
  : { forWidth: 3, forHeight: 3 }
109
109
  : { forWidth: 2, forHeight: 2 }
110
110
  : isTabletLandscape
111
- ? { forWidth: 8, forHeight: 6.5 }
112
- : { forWidth: 3.5, forHeight: 2 };
111
+ ? { forWidth: 8, forHeight: 6.5 }
112
+ : { forWidth: 3.5, forHeight: 2 };
113
113
 
114
114
  const minWidth =
115
115
  isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
@@ -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";
@@ -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,
@@ -121,34 +122,6 @@ const getTabletWidth = (
121
122
  return Number(width) - sidebarWidth;
122
123
  };
123
124
 
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;
147
- }
148
-
149
- return true;
150
- };
151
-
152
125
  const PlayerWrapperComponent = (props: Props) => {
153
126
  const {
154
127
  entry,
@@ -167,7 +140,15 @@ const PlayerWrapperComponent = (props: Props) => {
167
140
 
168
141
  const isInlineModal = inline && isModal;
169
142
 
170
- // const style = getStyles(baseStyle, !isTablet, isInlineModal, pip);
143
+ // Mounting the PlayerDetails component is a resource-intensive process.
144
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
145
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
146
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
147
+ const isShowPlayerDetails = useDelayedPlayerDetails({
148
+ isInline: isInlineModal,
149
+ isDocked: docked,
150
+ isPip: pip,
151
+ });
171
152
 
172
153
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
173
154
 
@@ -203,8 +184,8 @@ const PlayerWrapperComponent = (props: Props) => {
203
184
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
204
185
 
205
186
  const childrenStyles = React.useMemo(
206
- () => ({ ...playerDimensions, ...playerDimesionsHack }),
207
- [containerDimensions, playerDimesionsHack]
187
+ () => ({ ...playerDimensions, ...playerDimensionsHack }),
188
+ [containerDimensions, playerDimensionsHack]
208
189
  );
209
190
 
210
191
  return (
@@ -213,7 +194,7 @@ const PlayerWrapperComponent = (props: Props) => {
213
194
  style={[
214
195
  safeAreaStyles(configuration, isTablet),
215
196
  style,
216
- playerDimesionsHack,
197
+ playerDimensionsHack,
217
198
  ]}
218
199
  >
219
200
  <AnimationComponent
@@ -227,7 +208,7 @@ const PlayerWrapperComponent = (props: Props) => {
227
208
  defaultStyles.playerContainer,
228
209
  containerDimensions,
229
210
  containerStyle,
230
- playerDimesionsHack,
211
+ playerDimensionsHack,
231
212
  ]}
232
213
  >
233
214
  <AnimationComponent
@@ -246,7 +227,7 @@ const PlayerWrapperComponent = (props: Props) => {
246
227
  </View>
247
228
 
248
229
  <AnimatedScrollModal>
249
- {showDetails(!isTablet, docked, isInlineModal, pip) && (
230
+ {isShowPlayerDetails ? (
250
231
  <AnimationComponent
251
232
  animationType={ComponentAnimationType.componentFade}
252
233
  style={defaultStyles.flex}
@@ -259,7 +240,7 @@ const PlayerWrapperComponent = (props: Props) => {
259
240
  isTablet={isTablet}
260
241
  />
261
242
  </AnimationComponent>
262
- )}
243
+ ) : null}
263
244
  </AnimatedScrollModal>
264
245
  </AnimationComponent>
265
246
  </WrapperView>