@applicaster/zapp-react-native-ui-components 12.0.0-rc.6 → 12.0.0-rc.61

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 (111) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
  2. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
  3. package/Components/AudioPlayer/helpers.tsx +1 -0
  4. package/Components/Cell/Cell.tsx +2 -2
  5. package/Components/Cell/CellWithFocusable.tsx +21 -14
  6. package/Components/Cell/TvOSCellComponent.tsx +2 -2
  7. package/Components/ErrorScreen/index.tsx +1 -1
  8. package/Components/FocusableCell/index.tsx +7 -7
  9. package/Components/FocusableList/FocusableChild.ts +24 -14
  10. package/Components/FocusableList/FocusableItem.tsx +1 -1
  11. package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
  12. package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
  13. package/Components/FocusableList/index.tsx +26 -25
  14. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
  15. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
  16. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  17. package/Components/HandlePlayable/HandlePlayable.tsx +1 -1
  18. package/Components/HookRenderer/index.tsx +1 -6
  19. package/Components/Image/Image.android.tsx +3 -26
  20. package/Components/Image/Image.tsx +18 -2
  21. package/Components/Image/utils/index.ts +39 -0
  22. package/Components/Layout/TV/__tests__/index.test.tsx +1 -34
  23. package/Components/Layout/TV/index.tsx +20 -36
  24. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +0 -1
  25. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
  26. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
  27. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
  28. package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
  29. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  30. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
  31. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
  32. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  33. package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
  34. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  35. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
  36. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  37. package/Components/MasterCell/utils/index.ts +16 -5
  38. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  39. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  40. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  41. package/Components/ModalComponent/Button/Item.tsx +82 -0
  42. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  43. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  44. package/Components/ModalComponent/Button/assets.ts +4 -0
  45. package/Components/ModalComponent/Button/index.tsx +111 -0
  46. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  47. package/Components/ModalComponent/Header/Title.tsx +70 -0
  48. package/Components/ModalComponent/Header/assets.ts +4 -0
  49. package/Components/ModalComponent/Header/index.tsx +71 -0
  50. package/Components/ModalComponent/Header/utils.ts +79 -0
  51. package/Components/ModalComponent/index.tsx +38 -0
  52. package/Components/ModalComponent/utils.ts +126 -0
  53. package/Components/PlayerContainer/PlayerContainer.tsx +61 -30
  54. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
  55. package/Components/PlayerImageBackground/index.tsx +34 -8
  56. package/Components/River/ComponentsMap/ComponentsMap.tsx +91 -2
  57. package/Components/River/RefreshControl.tsx +55 -1
  58. package/Components/River/River.tsx +8 -5
  59. package/Components/River/TV/River.tsx +2 -2
  60. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
  61. package/Components/River/__tests__/componentsMap.test.js +7 -0
  62. package/Components/River/useScreenConfiguration.ts +5 -6
  63. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  64. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  65. package/Components/RouteManager/index.tsx +5 -3
  66. package/Components/Screen/__tests__/Screen.test.tsx +48 -36
  67. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
  68. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  69. package/Components/Screen/index.tsx +103 -44
  70. package/Components/Screen/navigationHandler.ts +0 -82
  71. package/Components/Screen/orientationHandler.ts +1 -1
  72. package/Components/ScreenResolver/index.tsx +1 -1
  73. package/Components/Tabs/TV/styles.ts +1 -1
  74. package/Components/TrackedView/index.tsx +6 -3
  75. package/Components/VideoLive/LiveImageManager.ts +42 -13
  76. package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
  77. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
  78. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +18 -28
  79. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
  80. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +342 -0
  81. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +151 -0
  82. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +438 -0
  83. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +154 -0
  84. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  85. package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
  86. package/Components/VideoModal/PlayerDetails.tsx +3 -0
  87. package/Components/VideoModal/PlayerWrapper.tsx +69 -44
  88. package/Components/VideoModal/VideoModal.tsx +25 -42
  89. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
  90. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +5 -1
  91. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +246 -166
  92. package/Components/VideoModal/hooks/useModalSize.ts +13 -4
  93. package/Components/VideoModal/utils.ts +3 -3
  94. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
  95. package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +1 -1
  96. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
  97. package/Components/Viewport/ViewportTracker/index.tsx +1 -0
  98. package/Components/Viewport/utils.js +1 -1
  99. package/Components/ZappUIComponent/index.tsx +22 -12
  100. package/Components/index.js +2 -0
  101. package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
  102. package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
  103. package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
  104. package/Contexts/ScreenContext/index.tsx +95 -29
  105. package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
  106. package/Decorators/RiverResolver/index.tsx +0 -4
  107. package/Decorators/index.tsx +0 -4
  108. package/events/index.ts +1 -0
  109. package/package.json +5 -6
  110. package/Components/VideoModal/hooks/usePosition.ts +0 -50
  111. /package/Contexts/{index.js → index.ts} +0 -0
@@ -0,0 +1,299 @@
1
+ /* eslint-disable padding-line-between-statements */
2
+
3
+ import { PlayerAnimationStateEnum } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
4
+
5
+ export enum ComponentAnimationType {
6
+ bottomBar = "bottomBar",
7
+ player = "player",
8
+ componentFade = "componentFade",
9
+ componentAppears = "componentAppears",
10
+ moveUpComponent = "moveUpComponent",
11
+ moveComponentHorizontal = "moveComponentHorizontal",
12
+ audioPlayerPaddingHorizontal = "audioPlayerPaddingHorizontal",
13
+ }
14
+
15
+ export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
16
+
17
+ export const defaultAspectRatioWidth = (height: number): number =>
18
+ (height / 9) * 16;
19
+
20
+ export const getAnimationStyle = (component, animatedValue) => {
21
+ switch (component) {
22
+ case ComponentAnimationType.bottomBar: {
23
+ return { zIndex: 99, transform: [{ translateY: animatedValue }] };
24
+ }
25
+
26
+ case ComponentAnimationType.player: {
27
+ return { width: animatedValue.x, height: animatedValue.y };
28
+ }
29
+
30
+ case ComponentAnimationType.componentFade:
31
+ case ComponentAnimationType.componentAppears: {
32
+ return { opacity: animatedValue };
33
+ }
34
+
35
+ case ComponentAnimationType.moveUpComponent: {
36
+ return { transform: [{ translateY: animatedValue }] };
37
+ }
38
+
39
+ case ComponentAnimationType.audioPlayerPaddingHorizontal:
40
+ case ComponentAnimationType.moveComponentHorizontal: {
41
+ return { transform: [{ translateX: animatedValue }] };
42
+ }
43
+
44
+ default:
45
+ return null;
46
+ }
47
+ };
48
+
49
+ export const getAnimationDefaultValue = (component, bottomTabBarHeight) => {
50
+ switch (component) {
51
+ case ComponentAnimationType.bottomBar: {
52
+ return bottomTabBarHeight;
53
+ }
54
+
55
+ case ComponentAnimationType.player: {
56
+ return { x: 0, y: 0 };
57
+ }
58
+
59
+ case ComponentAnimationType.componentFade: {
60
+ return 1;
61
+ }
62
+
63
+ case ComponentAnimationType.audioPlayerPaddingHorizontal:
64
+ case ComponentAnimationType.moveComponentHorizontal:
65
+ case ComponentAnimationType.componentAppears:
66
+ case ComponentAnimationType.moveUpComponent: {
67
+ return 0;
68
+ }
69
+ }
70
+ };
71
+
72
+ export const calculateAnimationValue = (animationType, dragPosition, data) => {
73
+ const {
74
+ isAudioItem,
75
+ bottomTabBarHeight,
76
+ minimisedHeight,
77
+ minimisedWidth,
78
+ defaultValue,
79
+ moveUpValue,
80
+ moveComponentHorizontalValue,
81
+ isTablet,
82
+ isTabletLandscape,
83
+ isRTL,
84
+ fromMiniPlayer,
85
+ inlineAudioPlayer,
86
+ } = data;
87
+
88
+ switch (animationType) {
89
+ case ComponentAnimationType.bottomBar: {
90
+ if (fromMiniPlayer) {
91
+ return dragPosition < bottomTabBarHeight
92
+ ? dragPosition
93
+ : bottomTabBarHeight;
94
+ }
95
+
96
+ return dragPosition < bottomTabBarHeight
97
+ ? bottomTabBarHeight - dragPosition
98
+ : 0;
99
+ }
100
+
101
+ case ComponentAnimationType.player: {
102
+ const value =
103
+ isAudioItem && !inlineAudioPlayer
104
+ ? isTabletLandscape
105
+ ? fromMiniPlayer
106
+ ? { forWidth: 4, forHeight: 4.5 }
107
+ : { forWidth: 3, forHeight: 3 }
108
+ : { forWidth: 2, forHeight: 2 }
109
+ : isTabletLandscape
110
+ ? { forWidth: 8, forHeight: 6.5 }
111
+ : { forWidth: 3.5, forHeight: 2 };
112
+
113
+ const minWidth =
114
+ isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
115
+
116
+ if (fromMiniPlayer) {
117
+ const calculationWidth =
118
+ dragPosition * value.forWidth < minWidth
119
+ ? minWidth
120
+ : dragPosition * value.forWidth;
121
+ const calculationHeight =
122
+ dragPosition * value.forHeight < minimisedHeight
123
+ ? minimisedHeight
124
+ : dragPosition * value.forHeight;
125
+
126
+ return {
127
+ x:
128
+ calculationWidth < defaultValue.x
129
+ ? calculationWidth
130
+ : defaultValue.x,
131
+ y:
132
+ calculationHeight < defaultValue.y
133
+ ? calculationHeight
134
+ : defaultValue.y,
135
+ };
136
+ }
137
+
138
+ const calculationWidth = defaultValue.x - dragPosition * value.forWidth;
139
+
140
+ const calculationHeight = defaultValue.y - dragPosition * value.forHeight;
141
+
142
+ return {
143
+ x: calculationWidth > minWidth ? calculationWidth : minWidth,
144
+ y:
145
+ calculationHeight > minimisedHeight
146
+ ? calculationHeight
147
+ : minimisedHeight,
148
+ };
149
+ }
150
+
151
+ case ComponentAnimationType.componentFade: {
152
+ if (fromMiniPlayer) {
153
+ const calculation = dragPosition / (isTablet ? 200 : 150);
154
+
155
+ return calculation < 1 ? calculation : 1;
156
+ }
157
+
158
+ const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
159
+
160
+ return calculation > 0 ? calculation : 0;
161
+ }
162
+
163
+ case ComponentAnimationType.componentAppears: {
164
+ if (fromMiniPlayer) {
165
+ const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
166
+
167
+ return calculation > 0 ? calculation : 0;
168
+ }
169
+
170
+ const calculation = dragPosition / (isTablet ? 200 : 150);
171
+
172
+ return calculation < 1 ? calculation : 1;
173
+ }
174
+
175
+ case ComponentAnimationType.moveUpComponent: {
176
+ if (fromMiniPlayer) {
177
+ const calculation =
178
+ moveUpValue + dragPosition / (isTabletLandscape ? 1 : 4);
179
+
180
+ return calculation < 0 ? calculation : 0;
181
+ }
182
+
183
+ const calculation = 0 - dragPosition / (isTabletLandscape ? 1 : 2);
184
+
185
+ return calculation > moveUpValue ? calculation : moveUpValue;
186
+ }
187
+
188
+ case ComponentAnimationType.moveComponentHorizontal: {
189
+ if (fromMiniPlayer) {
190
+ const calculation = isRTL
191
+ ? moveComponentHorizontalValue - dragPosition * 2
192
+ : moveComponentHorizontalValue + dragPosition * 2;
193
+ const condition = isRTL ? calculation > 0 : calculation < 0;
194
+
195
+ return condition ? calculation : 0;
196
+ }
197
+
198
+ const calculation = isRTL ? dragPosition * 2 : -(dragPosition * 2);
199
+ const condition = isRTL
200
+ ? calculation < moveComponentHorizontalValue
201
+ : calculation > moveComponentHorizontalValue;
202
+
203
+ return condition ? calculation : moveComponentHorizontalValue;
204
+ }
205
+
206
+ case ComponentAnimationType.audioPlayerPaddingHorizontal: {
207
+ const padding = isRTL
208
+ ? AUDIO_PLAYER_HORIZONTAL_PADDING
209
+ : -AUDIO_PLAYER_HORIZONTAL_PADDING;
210
+
211
+ if (fromMiniPlayer) {
212
+ const calculation = isRTL
213
+ ? padding - dragPosition / 5
214
+ : padding + dragPosition / 5;
215
+ const condition = isRTL ? calculation > 0 : calculation < 0;
216
+
217
+ return condition ? calculation : 0;
218
+ }
219
+
220
+ const calculation = isRTL ? dragPosition / 5 : -(dragPosition / 5);
221
+ const condition = isRTL ? calculation < padding : calculation > padding;
222
+
223
+ return condition ? calculation : padding;
224
+ }
225
+ }
226
+ };
227
+
228
+ export const gestureListenerHelper = (data) => {
229
+ const {
230
+ listenerValue,
231
+ preparedValue,
232
+ animationType,
233
+ animatedValue,
234
+ calculationData,
235
+ modalSnapPoint,
236
+ startAnimationDistance,
237
+ startComponentsAnimation,
238
+ setStartComponentsAnimation,
239
+ getAnimationValue,
240
+ } = data;
241
+
242
+ if (calculationData.fromMiniPlayer) {
243
+ if (listenerValue <= 0) {
244
+ if (
245
+ preparedValue >= 0 &&
246
+ preparedValue <= modalSnapPoint - startAnimationDistance
247
+ ) {
248
+ !startComponentsAnimation && setStartComponentsAnimation(true);
249
+
250
+ animatedValue.setValue(
251
+ calculateAnimationValue(animationType, preparedValue, calculationData)
252
+ );
253
+ } else {
254
+ animatedValue.setValue(calculationData.defaultValue);
255
+ startComponentsAnimation && setStartComponentsAnimation(false);
256
+ }
257
+ } else {
258
+ const value = getAnimationValue(
259
+ animationType,
260
+ PlayerAnimationStateEnum.minimize
261
+ ).toValue;
262
+
263
+ animatedValue.setValue(value);
264
+ }
265
+ } else {
266
+ if (preparedValue >= startAnimationDistance) {
267
+ !startComponentsAnimation && setStartComponentsAnimation(true);
268
+ const value = Math.round(preparedValue - startAnimationDistance);
269
+
270
+ animatedValue.setValue(
271
+ calculateAnimationValue(animationType, value, calculationData)
272
+ );
273
+ } else {
274
+ animatedValue.setValue(calculationData.defaultValue);
275
+ startComponentsAnimation && setStartComponentsAnimation(false);
276
+ }
277
+ }
278
+ };
279
+
280
+ export const setScrollModalAnimatedValue = (
281
+ animatedValue,
282
+ value,
283
+ setLastSnap
284
+ ) => {
285
+ setLastSnap(value);
286
+ animatedValue.setValue(value);
287
+ };
288
+
289
+ export const resetScrollAnimatedValues = (
290
+ lastScrollY,
291
+ lastScrollYValue,
292
+ dragScrollY,
293
+ dragVideoPlayerY
294
+ ) => {
295
+ lastScrollY.setValue(0);
296
+ lastScrollYValue.current = 0;
297
+ dragScrollY.setValue(0);
298
+ dragVideoPlayerY.setValue(0);
299
+ };
@@ -23,6 +23,8 @@ const containerStyle = ({
23
23
  backgroundColor: modal_background_color,
24
24
  });
25
25
 
26
+ // const audioMarginStyle = { marginTop: 0, marginBottom: 0 };
27
+
26
28
  export const PlayerDetails = ({
27
29
  entry,
28
30
  style,
@@ -75,6 +77,7 @@ export const PlayerDetails = ({
75
77
  transform: [{ translateY }],
76
78
  opacity,
77
79
  },
80
+ // isAudioPlayer && audioMarginStyle,
78
81
  ]}
79
82
  >
80
83
  {screenData && (
@@ -9,15 +9,22 @@ import {
9
9
  import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
10
 
11
11
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
12
- import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device";
12
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
13
13
  import { PlayerDetails } from "./PlayerDetails";
14
14
  import { playerDimesionsHack } from "./utils";
15
15
  import { PathnameContext } from "../../Contexts/PathnameContext";
16
16
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
17
17
 
18
+ import {
19
+ AnimationComponent,
20
+ ComponentAnimationType,
21
+ AnimatedScrollModal,
22
+ AnimatedVideoPlayerComponent,
23
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
24
+
18
25
  type DimensionsT = {
19
26
  width: number | string;
20
- height: number | string;
27
+ height: number | string | undefined;
21
28
  aspectRatio?: number;
22
29
  };
23
30
 
@@ -33,6 +40,7 @@ type Props = {
33
40
  containerStyle?: ViewStyle;
34
41
  inline?: boolean;
35
42
  docked?: boolean;
43
+ pip?: boolean;
36
44
  isModal?: boolean;
37
45
  fullscreen?: boolean;
38
46
  isTabletPortrait?: boolean;
@@ -43,6 +51,7 @@ type Props = {
43
51
  const defaultStyles = StyleSheet.create({
44
52
  playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
45
53
  playerDetails: { flex: 1, paddingTop: 20 },
54
+ flex: { flex: 1 },
46
55
  });
47
56
 
48
57
  const orientationStyles = StyleSheet.create({
@@ -81,18 +90,9 @@ const safeAreaStyles = (
81
90
  };
82
91
  };
83
92
 
84
- const getEdges = (
85
- isTablet: boolean,
86
- docked: boolean,
87
- isInlineModal: boolean
88
- ) => {
93
+ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
89
94
  if (isTablet) {
90
- return docked ? ["right", "left"] : ["top"];
91
- }
92
-
93
- // mobile
94
- if (isInlineModal && docked) {
95
- return ["bottom"];
95
+ return ["top"];
96
96
  }
97
97
 
98
98
  if (!isInlineModal && Platform.OS === "android") {
@@ -135,6 +135,7 @@ export const PlayerWrapper = (props: Props) => {
135
135
  children,
136
136
  isTabletPortrait,
137
137
  configuration,
138
+ pip,
138
139
  } = props;
139
140
 
140
141
  const isTablet = useIsTablet();
@@ -149,18 +150,18 @@ export const PlayerWrapper = (props: Props) => {
149
150
  () => ({
150
151
  width:
151
152
  isInlineModal && !docked && isTabletLandscape ? tabletWidth : "100%",
152
- height: isInlineModal && docked ? style.height : undefined,
153
+ height: undefined,
153
154
  }),
154
- [isInlineModal, tabletWidth, style.height, docked]
155
+ [isInlineModal, tabletWidth, docked]
155
156
  );
156
157
 
157
158
  const playerDimensions: DimensionsT = React.useMemo(
158
159
  () => ({
159
160
  ...baseDimensions,
160
161
  width: isInlineModal && docked ? undefined : baseDimensions.width,
161
- aspectRatio: !isInlineModal ? getScreenAspectRatio() : 16 / 9,
162
+ aspectRatio: !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9,
162
163
  }),
163
- [baseDimensions, isInlineModal]
164
+ [baseDimensions, isInlineModal, pip]
164
165
  );
165
166
 
166
167
  const containerDimensions: DimensionsT = React.useMemo(
@@ -181,39 +182,63 @@ export const PlayerWrapper = (props: Props) => {
181
182
 
182
183
  return (
183
184
  <WrapperView
184
- edges={getEdges(isTablet, docked, isInlineModal) as readonly Edge[]}
185
+ edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
185
186
  style={[
186
- directionStyles(isTabletLandscape),
187
187
  safeAreaStyles(configuration, isTablet),
188
188
  style,
189
189
  playerDimesionsHack,
190
190
  ]}
191
191
  >
192
- <ScreenContextProvider pathname={"videoModal"}>
193
- <PathnameContext.Provider value={"videoModal"}>
194
- <View
195
- testID={`${entry?.id}-player-container`}
196
- style={[
197
- defaultStyles.playerContainer,
198
- containerDimensions,
199
- containerStyle,
200
- playerDimesionsHack,
201
- ]}
202
- >
203
- {children(childrenStyles)}
204
- </View>
205
- {isInlineModal && !docked ? (
206
- <PlayerDetails
207
- configuration={configuration}
208
- style={defaultStyles.playerDetails}
209
- entry={entry}
210
- isTabletLandscape={isTabletLandscape}
211
- />
212
- ) : (
213
- <View style={defaultStyles.playerDetails} />
214
- )}
215
- </PathnameContext.Provider>
216
- </ScreenContextProvider>
192
+ <AnimationComponent
193
+ animationType={ComponentAnimationType.moveUpComponent}
194
+ additionalData={{ saveArea: true }}
195
+ style={directionStyles(isTabletLandscape)}
196
+ >
197
+ <ScreenContextProvider pathname={"videoModal"}>
198
+ <PathnameContext.Provider value={"videoModal"}>
199
+ <View
200
+ testID={`${entry?.id}-player-container`}
201
+ style={[
202
+ defaultStyles.playerContainer,
203
+ containerDimensions,
204
+ containerStyle,
205
+ playerDimesionsHack,
206
+ ]}
207
+ >
208
+ <AnimationComponent
209
+ animationType={ComponentAnimationType.moveUpComponent}
210
+ style={isTabletLandscape ? defaultStyles.flex : undefined}
211
+ additionalData={{
212
+ useLayoutMeasure: isTabletLandscape,
213
+ disableAnimatedComponent: !isTabletLandscape,
214
+ resetAnimationValue: isTabletLandscape && docked,
215
+ }}
216
+ >
217
+ <AnimatedVideoPlayerComponent>
218
+ {children(childrenStyles)}
219
+ </AnimatedVideoPlayerComponent>
220
+ </AnimationComponent>
221
+ </View>
222
+ <AnimatedScrollModal>
223
+ {isInlineModal ? (
224
+ <AnimationComponent
225
+ animationType={ComponentAnimationType.componentFade}
226
+ style={defaultStyles.flex}
227
+ >
228
+ <PlayerDetails
229
+ configuration={configuration}
230
+ style={defaultStyles.playerDetails}
231
+ entry={entry}
232
+ isTabletLandscape={isTabletLandscape}
233
+ />
234
+ </AnimationComponent>
235
+ ) : (
236
+ <View style={defaultStyles.playerDetails} />
237
+ )}
238
+ </AnimatedScrollModal>
239
+ </PathnameContext.Provider>
240
+ </ScreenContextProvider>
241
+ </AnimationComponent>
217
242
  </WrapperView>
218
243
  );
219
244
  };
@@ -4,9 +4,7 @@ import { StyleSheet, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
7
- MenuTypes,
8
7
  useNavigation,
9
- useNavigationType,
10
8
  useZappHooksForEntry,
11
9
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
10
  import { useIsInitialRender } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
@@ -16,12 +14,12 @@ import {
16
14
  allowedOrientationsForScreen,
17
15
  ORIENTATIONS,
18
16
  } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
17
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
19
18
 
20
19
  import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
21
20
  import { useModalSize } from "./hooks/useModalSize";
22
21
  import { useBackgroundColor } from "./hooks/useBackgroundColor";
23
22
  import { useInitialPlayerState } from "./hooks/useInitialPlayerState";
24
- import { usePosition } from "./hooks/usePosition";
25
23
  import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
26
24
  import { Spinner } from "../Spinner";
27
25
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
@@ -31,6 +29,8 @@ import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/con
31
29
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
30
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
31
 
32
+ import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
33
+
34
34
  const styles = StyleSheet.create({
35
35
  container: {
36
36
  top: 0,
@@ -59,22 +59,9 @@ const VideoModalComponent = () => {
59
59
  const onVideoModalHookSuccessAnalyticsEvent = useVideoModalAnalytics();
60
60
 
61
61
  const modalSize = useModalSize();
62
-
63
62
  const isFirstRender = useIsInitialRender();
64
-
65
63
  const backgroundColor = useBackgroundColor();
66
64
 
67
- const { top, height, bottom } = usePosition();
68
-
69
- const navType = useNavigationType();
70
- const isBottomBarsNavigation = navType === MenuTypes.bottomTabBar;
71
- const heightWithSafeArea = height ? height + bottom : null;
72
-
73
- const dockedHeight =
74
- isBottomBarsNavigation && height ? height : heightWithSafeArea;
75
-
76
- const dockedBottom = isBottomBarsNavigation ? bottom : 0;
77
-
78
65
  const {
79
66
  closeVideoModal,
80
67
  setVideoModalItem,
@@ -83,8 +70,6 @@ const VideoModalComponent = () => {
83
70
  maximiseVideoModal,
84
71
  } = useNavigation();
85
72
 
86
- const docked = mode === "MINIMIZED";
87
-
88
73
  const logTimestamp = useProfilerLogging();
89
74
 
90
75
  useInitialPlayerState(fullscreenVideoModal, maximiseVideoModal, item);
@@ -105,9 +90,10 @@ const VideoModalComponent = () => {
105
90
  }, [item?.id]);
106
91
 
107
92
  const isLandscape = modalSize.width > modalSize.height;
93
+ const isTablet = useIsTablet();
108
94
 
109
95
  React.useEffect(() => {
110
- if (isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
96
+ if (!isTablet && isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
111
97
  fullscreenVideoModal();
112
98
  }
113
99
  }, [isLandscape]);
@@ -143,35 +129,32 @@ const VideoModalComponent = () => {
143
129
  const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
144
130
 
145
131
  return (
146
- <View
147
- style={[
148
- styles.container,
149
- {
150
- top,
151
- height: dockedHeight,
152
- bottom: dockedBottom,
153
- backgroundColor,
154
- },
155
- ]}
156
- >
157
- <ScreenContextProvider pathname={pathname}>
158
- <PathnameContext.Provider value={pathname}>
159
- {itemIdHooksFinished === item?.id ? (
132
+ <ScreenContextProvider pathname={pathname}>
133
+ <PathnameContext.Provider value={pathname}>
134
+ {itemIdHooksFinished === item?.id ? (
135
+ <AnimatedPlayerModalWrapper
136
+ style={[
137
+ styles.container,
138
+ {
139
+ backgroundColor,
140
+ },
141
+ ]}
142
+ >
160
143
  <HandlePlayable
161
144
  item={item}
162
145
  isModal={mode !== "PIP"}
163
- modalHeight={docked ? height : modalSize.height}
146
+ modalHeight={modalSize.height}
164
147
  modalWidth={modalSize.width}
165
148
  mode={mode}
166
149
  />
167
- ) : (
168
- <View style={styles.loaderContainer}>
169
- <Spinner />
170
- </View>
171
- )}
172
- </PathnameContext.Provider>
173
- </ScreenContextProvider>
174
- </View>
150
+ </AnimatedPlayerModalWrapper>
151
+ ) : (
152
+ <View style={styles.loaderContainer}>
153
+ <Spinner />
154
+ </View>
155
+ )}
156
+ </PathnameContext.Provider>
157
+ </ScreenContextProvider>
175
158
  );
176
159
  };
177
160
 
@@ -8,8 +8,6 @@ const props = {
8
8
  configuration: { modal_background_color: "transparent" },
9
9
  };
10
10
 
11
- jest.mock("react-native");
12
-
13
11
  jest.mock("react-native-safe-area-context", () => ({
14
12
  useSafeAreaInsets: jest.fn(() => ({
15
13
  top: 20,
@@ -21,6 +21,8 @@ const useIsTablet = jest.fn();
21
21
 
22
22
  jest.mock("react-native");
23
23
 
24
+ jest.mock("react-native-gesture-handler");
25
+
24
26
  jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
25
27
 
26
28
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
@@ -38,6 +40,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
38
40
  }));
39
41
 
40
42
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
43
+ isNavBarVisible: jest.fn(() => true),
41
44
  useRoute: jest.fn(() => ({
42
45
  pathname: "/river/testId",
43
46
  })),
@@ -45,6 +48,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
45
48
  canGoBack: () => false,
46
49
  currentRoute: "/river/testId",
47
50
  data: { screen: { id: "testId" } },
51
+ videoModalState: { visible: false },
48
52
  })),
49
53
  }));
50
54
 
@@ -94,7 +98,7 @@ describe("PlayerWrapper", () => {
94
98
  useIsTablet.mockReturnValue(false);
95
99
 
96
100
  const children = jest.fn(() => {});
97
- const dimensions = { height: 50, width: props.style.width };
101
+ const dimensions = { height: undefined, width: props.style.width };
98
102
 
99
103
  const element = renderWithProviders(
100
104
  <PlayerWrapper