@applicaster/zapp-react-native-ui-components 14.0.0-rc.9 → 14.0.0-rc.90

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 (178) hide show
  1. package/Components/AnimatedInOut/index.tsx +68 -23
  2. package/Components/AudioPlayer/index.tsx +15 -0
  3. package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
  4. package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -2
  5. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  6. package/Components/AudioPlayer/mobile/index.tsx +18 -0
  7. package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +3 -2
  8. package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
  9. package/Components/AudioPlayer/tv/Layout.tsx +168 -0
  10. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +7 -1
  11. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +6 -2
  12. package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +6 -2
  13. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
  14. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
  15. package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
  16. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -2
  17. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -2
  18. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
  19. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +11 -5
  20. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +17 -58
  21. package/Components/AudioPlayer/types.ts +40 -0
  22. package/Components/BaseFocusable/index.tsx +23 -12
  23. package/Components/Cell/Cell.tsx +91 -64
  24. package/Components/Cell/CellWithFocusable.tsx +3 -0
  25. package/Components/Cell/FocusableWrapper.tsx +44 -0
  26. package/Components/Cell/TvOSCellComponent.tsx +92 -17
  27. package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
  28. package/Components/Cell/index.js +7 -3
  29. package/Components/ComponentResolver/index.ts +1 -1
  30. package/Components/FeedLoader/FeedLoader.tsx +7 -16
  31. package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
  32. package/Components/FeedLoader/index.js +2 -8
  33. package/Components/Focusable/Focusable.tsx +12 -3
  34. package/Components/Focusable/FocusableTvOS.tsx +5 -5
  35. package/Components/Focusable/FocusableiOS.tsx +2 -2
  36. package/Components/Focusable/Touchable.tsx +5 -3
  37. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  38. package/Components/Focusable/index.android.tsx +19 -11
  39. package/Components/Focusable/index.tsx +1 -1
  40. package/Components/FocusableGroup/FocusableTvOS.tsx +1 -1
  41. package/Components/FocusableList/FocusableItem.tsx +4 -3
  42. package/Components/FocusableList/FocusableListItemWrapper.tsx +2 -1
  43. package/Components/FocusableList/hooks/useCellState.android.ts +13 -3
  44. package/Components/FocusableList/index.tsx +20 -9
  45. package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
  46. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
  47. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -21
  48. package/Components/HandlePlayable/HandlePlayable.tsx +39 -74
  49. package/Components/HandlePlayable/const.ts +3 -0
  50. package/Components/HandlePlayable/utils.ts +74 -0
  51. package/Components/Layout/TV/LayoutBackground.tsx +1 -1
  52. package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
  53. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +6 -2
  54. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
  55. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -39
  56. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
  57. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
  58. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +65 -17
  59. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +21 -3
  60. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +6 -3
  61. package/Components/MasterCell/DefaultComponents/Text/index.tsx +26 -6
  62. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
  63. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
  64. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
  65. package/Components/MasterCell/elementMapper.tsx +1 -2
  66. package/Components/MasterCell/index.tsx +1 -1
  67. package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
  68. package/Components/MasterCell/utils/index.ts +11 -5
  69. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
  70. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
  71. package/Components/OfflineHandler/__tests__/index.test.tsx +26 -35
  72. package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
  73. package/Components/PlayerContainer/PlayerContainer.tsx +45 -47
  74. package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
  75. package/Components/PlayerContainer/index.ts +1 -1
  76. package/Components/PlayerImageBackground/index.tsx +4 -23
  77. package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -43
  78. package/Components/River/ComponentsMap/ContextProviders/ComponentsMapHeightContext.ts +8 -0
  79. package/Components/River/ComponentsMap/ContextProviders/ComponentsMapRefContext.ts +8 -0
  80. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +378 -0
  81. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
  82. package/Components/River/RefreshControl.tsx +11 -17
  83. package/Components/River/TV/River.tsx +2 -17
  84. package/Components/River/TV/index.tsx +3 -1
  85. package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
  86. package/Components/River/TV/withRiverDataLoader.tsx +17 -0
  87. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  88. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  89. package/Components/River/__tests__/river.test.js +12 -26
  90. package/Components/River/index.tsx +1 -1
  91. package/Components/Screen/TV/hooks/useInitialFocus.ts +14 -4
  92. package/Components/Screen/__tests__/Screen.test.tsx +28 -29
  93. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
  94. package/Components/Screen/__tests__/navigationHandler.test.ts +133 -22
  95. package/Components/Screen/index.tsx +22 -5
  96. package/Components/Screen/navigationHandler.ts +20 -2
  97. package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
  98. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
  99. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
  100. package/Components/ScreenRevealManager/index.ts +1 -0
  101. package/Components/ScreenRevealManager/utils/index.ts +23 -0
  102. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +109 -0
  103. package/Components/Tabs/TV/Tabs.android.tsx +1 -3
  104. package/Components/Tabs/Tabs.tsx +2 -3
  105. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
  106. package/Components/TextInputTv/index.tsx +11 -0
  107. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
  108. package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
  109. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
  110. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  111. package/Components/VideoLive/animationUtils.ts +3 -3
  112. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +120 -133
  113. package/Components/VideoModal/ModalAnimation/index.ts +2 -13
  114. package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
  115. package/Components/VideoModal/PlayerDetails.tsx +29 -7
  116. package/Components/VideoModal/PlayerWrapper.tsx +25 -215
  117. package/Components/VideoModal/VideoModal.tsx +4 -22
  118. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
  119. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +2 -7
  120. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  121. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +9 -1
  122. package/Components/VideoModal/hooks/index.ts +0 -2
  123. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +40 -15
  124. package/Components/VideoModal/hooks/useModalSize.ts +23 -2
  125. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +2 -2
  126. package/Components/VideoModal/hooks/utils/index.ts +4 -0
  127. package/Components/VideoModal/playerWrapperStyle.ts +70 -0
  128. package/Components/VideoModal/playerWrapperUtils.ts +91 -0
  129. package/Components/VideoModal/utils.ts +13 -0
  130. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
  131. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
  132. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  133. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  134. package/Contexts/CellFocusedStateContext/index.tsx +27 -0
  135. package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
  136. package/Contexts/ScreenContext/index.tsx +46 -6
  137. package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
  138. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  139. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
  140. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
  141. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
  142. package/Decorators/RiverFeedLoader/index.tsx +22 -4
  143. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +6 -10
  144. package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
  145. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
  146. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
  147. package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
  148. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
  149. package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
  150. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
  151. package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
  152. package/Decorators/ZappPipesDataConnector/index.tsx +26 -293
  153. package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
  154. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
  155. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +266 -0
  156. package/Decorators/ZappPipesDataConnector/types.ts +29 -0
  157. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
  158. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +157 -0
  159. package/events/index.ts +3 -0
  160. package/package.json +5 -10
  161. package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
  162. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
  163. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
  164. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
  165. package/Components/AudioPlayer/index.ts +0 -1
  166. package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
  167. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
  168. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -421
  169. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
  170. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
  171. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
  172. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
  173. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
  174. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +0 -0
  175. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
  176. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
  177. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
  178. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
@@ -4,13 +4,15 @@ import {
4
4
  Dimensions,
5
5
  Easing,
6
6
  StyleProp,
7
- ViewStyle,
8
7
  StyleSheet,
8
+ ViewStyle,
9
9
  } from "react-native";
10
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
11
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
12
12
  import { useSafeAreaInsets } from "react-native-safe-area-context";
13
13
  import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
14
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
15
+ import { useDelayedPlayerDetails } from "./hooks";
14
16
 
15
17
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
16
18
 
@@ -26,6 +28,10 @@ type Props = {
26
28
  isTabletLandscape?: boolean;
27
29
  isAudioPlayer?: boolean;
28
30
  isTablet?: boolean;
31
+ inline?: any;
32
+ docked?: boolean;
33
+ isModal?: boolean;
34
+ pip?: boolean;
29
35
  };
30
36
 
31
37
  const containerStyle = ({
@@ -42,16 +48,31 @@ export const PlayerDetails = ({
42
48
  configuration,
43
49
  isTabletLandscape = false,
44
50
  isAudioPlayer,
45
- isTablet = false,
51
+ inline,
52
+ docked,
53
+ isModal,
54
+ pip,
46
55
  }: Props) => {
56
+ const isInlineModal = inline && isModal;
57
+
58
+ // Mounting the PlayerDetails component is a resource-intensive process.
59
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
60
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
61
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
62
+ const isShowPlayerDetails = useDelayedPlayerDetails({
63
+ isInline: isInlineModal,
64
+ isDocked: docked,
65
+ isPip: pip,
66
+ });
67
+
68
+ const isTablet = useIsTablet();
47
69
  const screenData = useTargetScreenData(entry);
48
70
  const insets = useSafeAreaInsets();
49
71
 
50
- const extraTabletStyles = !isAudioPlayer
51
- ? isTabletLandscape
72
+ const extraTabletStyles =
73
+ !isAudioPlayer && isTabletLandscape
52
74
  ? { marginTop: -insets.top, paddingTop: insets.top + 20 }
53
- : { marginTop: -8, paddingTop: -8 }
54
- : {};
75
+ : null;
55
76
 
56
77
  // Animation setup
57
78
  const translateY = useRef(new Animated.Value(50)).current;
@@ -79,7 +100,7 @@ export const PlayerDetails = ({
79
100
  }
80
101
  }, [isAudioPlayer]);
81
102
 
82
- if (isNilOrEmpty(screenData?.ui_components)) {
103
+ if (isNilOrEmpty(screenData?.ui_components) || !isShowPlayerDetails) {
83
104
  return null;
84
105
  }
85
106
 
@@ -107,6 +128,7 @@ export const PlayerDetails = ({
107
128
  riverId={screenData.id}
108
129
  feed={screenData?.data?.source}
109
130
  riverComponents={screenData.ui_components}
131
+ isScreenWrappedInContainer
110
132
  />
111
133
  ) : null}
112
134
  </Animated.View>
@@ -1,38 +1,11 @@
1
1
  import * as React from "react";
2
- import {
3
- Dimensions,
4
- Platform,
5
- StyleSheet,
6
- View,
7
- ViewStyle,
8
- } from "react-native";
2
+ import { View, ViewStyle } from "react-native";
9
3
  import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
4
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
5
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
12
- import { PlayerDetails } from "./PlayerDetails";
13
6
  import { playerDimensionsHack } from "./utils";
14
- import { useDelayedPlayerDetails } from "./hooks";
15
-
16
- import {
17
- AnimatedScrollModal,
18
- AnimatedVideoPlayerComponent,
19
- AnimationComponent,
20
- ComponentAnimationType,
21
- } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
22
-
23
- const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
24
-
25
- type DimensionsT = {
26
- width: number | string;
27
- height: number | string | undefined;
28
- aspectRatio?: number;
29
- };
30
-
31
- type Configuration = {
32
- [key: string]: any;
33
- tablet_landscape_sidebar_width?: string;
34
- tablet_landscape_player_container_background_color?: string;
35
- };
7
+ import { DimensionsT, Configuration, getEdges } from "./playerWrapperUtils";
8
+ import { defaultStyles, useStyle } from "./playerWrapperStyle";
36
9
 
37
10
  type Props = {
38
11
  entry: ZappEntry;
@@ -44,91 +17,9 @@ type Props = {
44
17
  isModal?: boolean;
45
18
  fullscreen?: boolean;
46
19
  isTabletPortrait?: boolean;
47
- children: (playerDimensions: DimensionsT) => React.ReactNode;
48
20
  configuration: Configuration;
49
- };
50
-
51
- const defaultStyles = StyleSheet.create({
52
- playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
53
- playerDetails: { flex: 1, paddingTop: 20 },
54
- flex: { flex: 1 },
55
- });
56
-
57
- const orientationStyles = StyleSheet.create({
58
- landscape: { flexDirection: "row" },
59
- portrait: { flexDirection: "column" },
60
- });
61
-
62
- const directionStyles = (isTabletLandscape: boolean): ViewStyle => {
63
- if (isTabletLandscape) {
64
- return orientationStyles.landscape;
65
- }
66
-
67
- return orientationStyles.portrait;
68
- };
69
-
70
- const getScreenAspectRatio = () => {
71
- const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
72
- const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
73
-
74
- return longEdge / shortEdge;
75
- };
76
-
77
- const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
78
- if (isTablet) {
79
- return ["top"];
80
- }
81
-
82
- if (!isInlineModal && Platform.OS === "android") {
83
- return [];
84
- }
85
-
86
- return ["top"];
87
- };
88
-
89
- const isPercentage = (value: string | number): boolean => {
90
- if (typeof value === "string") {
91
- return value.includes("%");
92
- }
93
-
94
- return false;
95
- };
96
-
97
- const getPercentageOf = (percent: string, value: number) => {
98
- const percentageValue = parseFloat(percent.replace("%", ""));
99
-
100
- if (isNaN(percentageValue)) {
101
- return value;
102
- }
103
-
104
- return (value * percentageValue) / 100;
105
- };
106
-
107
- const getTabletWidth = (
108
- configuration: Configuration,
109
- dimensions: DimensionsT
110
- ) => {
111
- const tablet_landscape_sidebar_width =
112
- configuration?.tablet_landscape_sidebar_width;
113
21
 
114
- const { width } = dimensions;
115
- let widthValue = Number(width);
116
-
117
- if (isPercentage(width)) {
118
- widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
119
- }
120
-
121
- const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
122
-
123
- if (tablet_landscape_sidebar_width?.includes("%")) {
124
- return widthValue * (1 - sidebarWidth / 100);
125
- }
126
-
127
- if (Number.isNaN(sidebarWidth)) {
128
- return widthValue * 0.65;
129
- }
130
-
131
- return widthValue - sidebarWidth;
22
+ playerContent: (styles: ViewStyle) => React.ReactNode;
132
23
  };
133
24
 
134
25
  const PlayerWrapperComponent = (props: Props) => {
@@ -137,125 +28,44 @@ const PlayerWrapperComponent = (props: Props) => {
137
28
  style,
138
29
  containerStyle,
139
30
  inline,
140
- docked,
141
31
  isModal,
142
- children,
143
32
  isTabletPortrait,
144
33
  configuration,
145
- fullscreen,
146
34
  pip,
35
+ playerContent,
147
36
  } = props;
148
37
 
149
- const isTablet = useIsTablet();
150
-
151
- const isInlineModal = inline && isModal;
152
-
153
- // Mounting the PlayerDetails component is a resource-intensive process.
154
- // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
155
- // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
156
- // This helps to avoid blocking the rotation and any animations related to the rotation.
157
- const isShowPlayerDetails = useDelayedPlayerDetails({
158
- isInline: isInlineModal,
159
- isDocked: docked,
160
- isPip: pip,
38
+ const styles = useStyle({
39
+ style,
40
+ inline,
41
+ isModal,
42
+ isTabletPortrait,
43
+ configuration,
44
+ pip,
161
45
  });
162
46
 
163
- const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
164
-
165
- const tabletWidth = getTabletWidth(configuration, style);
166
-
167
- const baseDimensions: DimensionsT = React.useMemo(
168
- () => ({
169
- width:
170
- isInlineModal && !docked && isTabletLandscape ? tabletWidth : "100%",
171
- height: undefined,
172
- }),
173
- [isInlineModal, tabletWidth, docked]
174
- );
175
-
176
- const playerDimensions: DimensionsT = React.useMemo(
177
- () => ({
178
- ...baseDimensions,
179
- width: isInlineModal && docked ? undefined : baseDimensions.width,
180
- aspectRatio: !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9,
181
- }),
182
- [baseDimensions, isInlineModal, pip]
183
- );
47
+ const isTablet = useIsTablet();
184
48
 
185
- const containerDimensions: DimensionsT = React.useMemo(
186
- () => ({
187
- ...baseDimensions,
188
- aspectRatio:
189
- isInlineModal && docked ? undefined : playerDimensions.aspectRatio,
190
- }),
191
- [baseDimensions, isInlineModal, docked, playerDimensions.aspectRatio]
192
- );
49
+ const isInlineModal = inline && isModal;
193
50
 
194
51
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
195
52
 
196
- const childrenStyles = React.useMemo(
197
- () => ({ ...playerDimensions, ...playerDimensionsHack }),
198
- [containerDimensions, playerDimensionsHack]
199
- );
200
-
201
- const wrapperViewStyle: ViewStyle = {
202
- backgroundColor:
203
- isTablet && !fullscreen
204
- ? configuration?.tablet_landscape_player_container_background_color
205
- : "transparent",
206
- };
207
-
208
53
  return (
209
54
  <WrapperView
210
55
  edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
211
- style={[wrapperViewStyle, style, playerDimensionsHack]}
56
+ style={playerDimensionsHack}
212
57
  >
213
- <AnimationComponent
214
- animationType={ComponentAnimationType.moveUpComponent}
215
- additionalData={{ saveArea: true }}
216
- style={[directionStyles(isTabletLandscape), defaultStyles.flex]}
58
+ <View
59
+ testID={`${entry?.id}-player-container`}
60
+ style={[
61
+ defaultStyles.playerContainer,
62
+ playerDimensionsHack,
63
+ styles.containerDimensions,
64
+ containerStyle,
65
+ ]}
217
66
  >
218
- <View
219
- testID={`${entry?.id}-player-container`}
220
- style={[
221
- defaultStyles.playerContainer,
222
- containerDimensions,
223
- containerStyle,
224
- playerDimensionsHack,
225
- ]}
226
- >
227
- <AnimationComponent
228
- animationType={ComponentAnimationType.moveUpComponent}
229
- style={isTabletLandscape ? defaultStyles.flex : undefined}
230
- additionalData={{
231
- useLayoutMeasure: isTabletLandscape,
232
- disableAnimatedComponent: !isTabletLandscape,
233
- resetAnimationValue: isTabletLandscape && docked,
234
- }}
235
- >
236
- <AnimatedVideoPlayerComponent>
237
- {children(childrenStyles)}
238
- </AnimatedVideoPlayerComponent>
239
- </AnimationComponent>
240
- </View>
241
-
242
- <AnimatedScrollModal>
243
- {isShowPlayerDetails ? (
244
- <AnimationComponent
245
- animationType={ComponentAnimationType.componentFade}
246
- style={defaultStyles.flex}
247
- >
248
- <PlayerDetails
249
- configuration={configuration}
250
- style={defaultStyles.playerDetails}
251
- entry={entry}
252
- isTabletLandscape={isTabletLandscape}
253
- isTablet={isTablet}
254
- />
255
- </AnimationComponent>
256
- ) : null}
257
- </AnimatedScrollModal>
258
- </AnimationComponent>
67
+ {playerContent(styles.childrenStyles)}
68
+ </View>
259
69
  </WrapperView>
260
70
  );
261
71
  };
@@ -17,11 +17,7 @@ import {
17
17
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
18
18
 
19
19
  import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
20
- import {
21
- useModalSize,
22
- useBackgroundColor,
23
- useInitialPlayerState,
24
- } from "./hooks";
20
+ import { useModalSize, useInitialPlayerState } from "./hooks";
25
21
 
26
22
  import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
27
23
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
@@ -33,8 +29,6 @@ import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
29
  import { Spinner } from "../Spinner";
34
30
  import { OpaqueLayer } from "./OpaqueLayer";
35
31
 
36
- import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
37
-
38
32
  const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
39
33
 
40
34
  const styles = StyleSheet.create({
@@ -65,7 +59,6 @@ const VideoModalComponent = () => {
65
59
 
66
60
  const modalSize = useModalSize();
67
61
  const isFirstRender = useIsInitialRender();
68
- const backgroundColor = useBackgroundColor();
69
62
 
70
63
  const {
71
64
  closeVideoModal,
@@ -145,20 +138,9 @@ const VideoModalComponent = () => {
145
138
  {mode === "FULLSCREEN" && <OpaqueLayer />}
146
139
 
147
140
  {itemIdHooksFinished === item?.id ? (
148
- <AnimatedPlayerModalWrapper
149
- style={[
150
- styles.container,
151
- {
152
- backgroundColor,
153
- },
154
- ]}
155
- >
156
- <HandlePlayable
157
- item={item}
158
- isModal={mode !== "PIP"}
159
- mode={mode}
160
- />
161
- </AnimatedPlayerModalWrapper>
141
+ <View pointerEvents="box-none" style={styles.container}>
142
+ <HandlePlayable item={item} isModal mode={mode} />
143
+ </View>
162
144
  ) : (
163
145
  <View style={styles.loaderContainer}>
164
146
  <Spinner />
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import renderer from "react-test-renderer";
2
+ import { render } from "@testing-library/react-native";
3
3
 
4
4
  const props = {
5
5
  entry: {},
@@ -42,16 +42,16 @@ const { PlayerDetails } = require("../PlayerDetails");
42
42
 
43
43
  describe("PlayerDetails", () => {
44
44
  it("renders properly", () => {
45
- const element = renderer.create(<PlayerDetails {...props} />);
45
+ const { toJSON } = render(<PlayerDetails {...props} />);
46
46
 
47
- expect(element).toMatchSnapshot();
47
+ expect(toJSON()).toMatchSnapshot();
48
48
  });
49
49
 
50
50
  it("renders properly on tablet in landscape orientation", () => {
51
- const element = renderer.create(
51
+ const { toJSON } = render(
52
52
  <PlayerDetails {...props} isTabletLandscape={true} />
53
53
  );
54
54
 
55
- expect(element).toMatchSnapshot();
55
+ expect(toJSON()).toMatchSnapshot();
56
56
  });
57
57
  });
@@ -13,6 +13,7 @@ const props = {
13
13
  tablet_landscape_sidebar_width: "35%",
14
14
  tablet_landscape_player_container_background_color: "red",
15
15
  },
16
+ playerContent: jest.fn(() => <></>),
16
17
  };
17
18
 
18
19
  const mockUseIsDeviceTablet = jest.fn();
@@ -45,6 +46,7 @@ jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
45
46
 
46
47
  jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
47
48
  isTV: jest.fn(() => false),
49
+ isAndroidPlatform: jest.fn(() => false),
48
50
  isApplePlatform: jest.fn(() => true),
49
51
  platformSelect: jest.fn((props) => props.android),
50
52
  }));
@@ -122,13 +124,6 @@ describe("PlayerWrapper", () => {
122
124
  </PlayerWrapper>
123
125
  );
124
126
 
125
- const expectDimensions = {
126
- ...dimensions,
127
- width: undefined,
128
- aspectRatio: 16 / 9,
129
- };
130
-
131
127
  expect(element).toMatchSnapshot();
132
- expect(children).toHaveBeenCalledWith(expectDimensions);
133
128
  });
134
129
  });