@applicaster/zapp-react-native-ui-components 13.0.0-alpha.2040752175 → 13.0.0-alpha.2060875348

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 (173) hide show
  1. package/Components/AnimatedInOut/index.tsx +5 -3
  2. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  3. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  4. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  5. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  6. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  7. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +56 -113
  8. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +39 -23
  9. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  10. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  11. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  12. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  13. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  14. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  15. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  16. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  17. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  18. package/Components/BaseFocusable/index.ios.ts +1 -1
  19. package/Components/BaseFocusable/index.tsx +67 -31
  20. package/Components/Cell/Cell.tsx +15 -9
  21. package/Components/Cell/CellWithFocusable.tsx +44 -59
  22. package/Components/Cell/TvOSCellComponent.tsx +23 -30
  23. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  24. package/Components/Cell/index.js +3 -1
  25. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  26. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  27. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  28. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  29. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  30. package/Components/ErrorScreen/index.tsx +6 -6
  31. package/Components/Focusable/Focusable.tsx +1 -54
  32. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  33. package/Components/Focusable/Touchable.tsx +19 -20
  34. package/Components/Focusable/index.android.tsx +10 -3
  35. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -83
  36. package/Components/FocusableGroup/index.tsx +1 -3
  37. package/Components/FocusableList/index.tsx +26 -10
  38. package/Components/FocusableScrollView/index.tsx +43 -13
  39. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  40. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  41. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  42. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
  43. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  44. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  45. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  46. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  47. package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
  48. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  49. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  50. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  51. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  52. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  53. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  54. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  55. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  56. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  57. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  58. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  59. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  60. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  61. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  62. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  63. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  64. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  65. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  66. package/Components/MasterCell/utils/index.ts +1 -1
  67. package/Components/ModalComponent/Button/index.tsx +6 -6
  68. package/Components/ModalComponent/Header/index.tsx +3 -3
  69. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  70. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  71. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  72. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  73. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  74. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  75. package/Components/PlayerContainer/PlayerContainer.tsx +13 -19
  76. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  77. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  78. package/Components/PlayerImageBackground/index.tsx +23 -3
  79. package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -66
  80. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  81. package/Components/River/RefreshControl.tsx +1 -1
  82. package/Components/River/RiverFooter.tsx +39 -9
  83. package/Components/River/RiverItem.tsx +37 -2
  84. package/Components/River/TV/index.tsx +6 -1
  85. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
  86. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  87. package/Components/River/__tests__/componentsMap.test.js +64 -17
  88. package/Components/River/__tests__/river.test.js +75 -40
  89. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +12 -5
  90. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  91. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  92. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  93. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  94. package/Components/Screen/hooks.ts +56 -0
  95. package/Components/Screen/index.tsx +16 -42
  96. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  97. package/Components/Tabs/Tab.tsx +12 -9
  98. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  99. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  100. package/Components/TextInputTv/index.tsx +6 -5
  101. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  102. package/Components/Transitioner/AnimationManager.js +8 -8
  103. package/Components/Transitioner/Scene.tsx +53 -24
  104. package/Components/Transitioner/Transitioner.tsx +3 -3
  105. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  106. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  107. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  108. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  109. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  110. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  111. package/Components/Transitioner/index.js +8 -4
  112. package/Components/VideoLive/LiveImageManager.ts +27 -1
  113. package/Components/VideoLive/PlayerLiveImageComponent.tsx +32 -24
  114. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  115. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -10
  116. package/Components/VideoLive/animationUtils.ts +7 -4
  117. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +16 -12
  118. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  119. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +15 -14
  120. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +6 -13
  121. package/Components/VideoModal/ModalAnimation/index.ts +2 -1
  122. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  123. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  124. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  125. package/Components/VideoModal/PlayerDetails.tsx +9 -6
  126. package/Components/VideoModal/PlayerWrapper.tsx +17 -36
  127. package/Components/VideoModal/VideoModal.tsx +14 -23
  128. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  129. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  130. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  131. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  132. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  133. package/Components/VideoModal/hooks/index.ts +7 -0
  134. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  135. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  136. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  137. package/Components/VideoModal/utils.ts +3 -5
  138. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  139. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  140. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  141. package/Components/Viewport/__tests__/utils.test.js +5 -4
  142. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  143. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  144. package/Components/ZappUIComponent/index.tsx +3 -16
  145. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  146. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  147. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  148. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  149. package/Contexts/ScreenContext/index.tsx +3 -2
  150. package/Decorators/Analytics/{index.js → index.tsx} +11 -11
  151. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  152. package/Decorators/Navigator/index.tsx +1 -1
  153. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  154. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  155. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  156. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  157. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  158. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  159. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  160. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  161. package/Decorators/RiverResolver/index.tsx +1 -1
  162. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  163. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  164. package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
  165. package/package.json +14 -8
  166. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  167. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  168. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  169. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  170. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  171. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  172. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  173. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,6 +1,7 @@
1
1
  // /// <reference types="@applicaster/applicaster-types" />
2
2
  //
3
3
  import * as React from "react";
4
+ import { useEffect } from "react";
4
5
 
5
6
  import { AppState, AppStateStatus, View } from "react-native";
6
7
  import { TrackedView } from "../TrackedView";
@@ -25,7 +26,6 @@ import { PlayerRole } from "@applicaster/zapp-react-native-utils/appUtils/player
25
26
  import { getAutoplaySettings } from "./utils";
26
27
  import { isString } from "@applicaster/zapp-react-native-utils/stringUtils";
27
28
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
28
- import { useEffect } from "react";
29
29
 
30
30
  const { log_error, log_debug } = loggerLiveImageComponent;
31
31
 
@@ -44,7 +44,10 @@ type Props = {
44
44
  };
45
45
 
46
46
  const PlayerLiveImageComponent = (props: Props) => {
47
- const dimensions = useDimensions("screen", { fullDimensions: true });
47
+ const dimensions = useDimensions("screen", {
48
+ fullDimensions: true,
49
+ updateForInactiveScreens: false,
50
+ });
48
51
 
49
52
  const { item, style, playerId } = props;
50
53
 
@@ -135,13 +138,16 @@ const PlayerLiveImageComponent = (props: Props) => {
135
138
  } else {
136
139
  throw new Error("Player factory item is null");
137
140
  }
138
- }, [playerId, item, playerPluginId, screenConfig]);
141
+ }, [playerId, item.id, playerPluginId, screenConfig]);
139
142
 
140
143
  React.useEffect(() => {
141
144
  liveImageItem.setMode = setModeDebounced;
142
145
  }, [setModeDebounced, liveImageItem]);
143
146
 
144
- const { start, end } = React.useMemo(() => getAutoplaySettings(item), [item]);
147
+ const { start, end } = React.useMemo(
148
+ () => getAutoplaySettings(item),
149
+ [item.id]
150
+ );
145
151
 
146
152
  const controller = liveImageItem.getPlayer();
147
153
  const player = usePlayer(playerId);
@@ -174,7 +180,7 @@ const PlayerLiveImageComponent = (props: Props) => {
174
180
 
175
181
  unregister();
176
182
  };
177
- }, [item, liveImageItem]);
183
+ }, [item.id, liveImageItem]);
178
184
 
179
185
  React.useEffect(() => {
180
186
  if (!player) {
@@ -244,25 +250,27 @@ const PlayerLiveImageComponent = (props: Props) => {
244
250
  }, [item.id]);
245
251
 
246
252
  React.useEffect(() => {
247
- if (playerManager) {
248
- const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
253
+ if (isMeasurement(item) || !playerManager) {
254
+ return;
255
+ }
249
256
 
250
- if (isPlayerRegistered) {
251
- log_error(
252
- `PlayerLiveImageComponent: player ${playerId} already registered`
253
- );
254
- } else {
255
- playerManager.registerPlayer({
256
- id: playerId,
257
- playerController: controller,
258
- });
257
+ const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
259
258
 
260
- return () => {
261
- playerManager.unregisterPlayer(playerId);
262
- };
263
- }
259
+ if (isPlayerRegistered) {
260
+ log_error(
261
+ `PlayerLiveImageComponent: player ${playerId} already registered`
262
+ );
263
+ } else {
264
+ playerManager.registerPlayer({
265
+ id: playerId,
266
+ playerController: controller,
267
+ });
268
+
269
+ return () => {
270
+ playerManager.unregisterPlayer(playerId);
271
+ };
264
272
  }
265
- }, [liveImageItem, playerId, controller]);
273
+ }, [liveImageItem, playerId, controller, item.id]);
266
274
 
267
275
  const onPositionUpdated = React.useCallback(
268
276
  (data) => {
@@ -302,7 +310,7 @@ const PlayerLiveImageComponent = (props: Props) => {
302
310
  LiveImageManager.instance.checkPlayerPosition(liveImageItem);
303
311
  }
304
312
  },
305
- [liveImageItem, dimensions]
313
+ [liveImageItem, dimensions.height, dimensions.width]
306
314
  );
307
315
 
308
316
  const platformSpecificProps = isApplePlatform()
@@ -322,7 +330,7 @@ const PlayerLiveImageComponent = (props: Props) => {
322
330
  onPositionUpdated={onPositionUpdated}
323
331
  >
324
332
  <View ref={trackViewRef}>
325
- {isVideoMode && (
333
+ {isVideoMode ? (
326
334
  <Player
327
335
  autoplay={false}
328
336
  ref={_assignRoot}
@@ -334,7 +342,7 @@ const PlayerLiveImageComponent = (props: Props) => {
334
342
  resizeMode={"cover"}
335
343
  {...platformSpecificProps}
336
344
  />
337
- )}
345
+ ) : null}
338
346
  {
339
347
  <AnimatedInOut
340
348
  visible={isBackgroundImageVisible}
@@ -2,9 +2,9 @@
2
2
  import * as React from "react";
3
3
  import { render } from "@testing-library/react-native";
4
4
  import * as PlayerFactory from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerFactory";
5
- import { Player } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/player";
6
5
  import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
7
6
  import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
7
+ import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
8
8
 
9
9
  import { PlayerLiveImage } from "../PlayerLiveImageComponent";
10
10
  import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
@@ -12,13 +12,13 @@ import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactH
12
12
  import { Provider } from "react-redux";
13
13
  import configureStore from "redux-mock-store";
14
14
 
15
- const seekTo = jest.fn();
15
+ const mock_seekTo = jest.fn();
16
16
 
17
17
  jest.mock(
18
18
  "@applicaster/zapp-react-native-utils/appUtils/playerManager/player",
19
19
  () => ({
20
20
  Player: {
21
- seekTo,
21
+ seekTo: mock_seekTo,
22
22
  },
23
23
  })
24
24
  );
@@ -33,7 +33,7 @@ const mockStore = configureStore();
33
33
 
34
34
  const store = mockStore({ appData: {} });
35
35
 
36
- const Wrapper = ({ children }: { children: React.ReactChildren }) => (
36
+ const Wrapper = ({ children }: { children: React.ReactNode }) => (
37
37
  /* @ts-ignore */
38
38
  <Provider store={store}>
39
39
  <ThemeContext.Provider
@@ -60,10 +60,16 @@ describe("PlayerLiveImageComponent", () => {
60
60
  };
61
61
 
62
62
  beforeAll(() => {
63
- jest.spyOn(PlayerFactory, "playerFactory").mockImplementation(() => ({
64
- controller: new Player({}),
65
- Component: () => null,
66
- }));
63
+ jest.spyOn(PlayerFactory, "playerFactory").mockImplementation(() => {
64
+ const Player = jest.requireActual(
65
+ "@applicaster/zapp-react-native-utils/appUtils/playerManager/player"
66
+ ).Player;
67
+
68
+ return {
69
+ controller: new Player({}),
70
+ Component: () => null,
71
+ };
72
+ });
67
73
 
68
74
  jest.spyOn(navigationHooks, "useIsScreenActive").mockReturnValue(true);
69
75
  });
@@ -113,4 +119,53 @@ describe("PlayerLiveImageComponent", () => {
113
119
 
114
120
  // TODO: implement this test
115
121
  });
122
+
123
+ it("should register the player for normal item", () => {
124
+ render(
125
+ <Wrapper>
126
+ <PlayerLiveImage {...defaultProps} />
127
+ </Wrapper>
128
+ );
129
+
130
+ const isPlayerRegistered = playerManager.isPlayerRegistered(
131
+ defaultProps.playerId
132
+ );
133
+
134
+ expect(isPlayerRegistered).toBe(true);
135
+ });
136
+
137
+ it("should unregister the player for normal item", () => {
138
+ const component = render(
139
+ <Wrapper>
140
+ <PlayerLiveImage {...defaultProps} />
141
+ </Wrapper>
142
+ );
143
+
144
+ component.unmount();
145
+
146
+ const isPlayerRegistered = playerManager.isPlayerRegistered(
147
+ defaultProps.playerId
148
+ );
149
+
150
+ expect(isPlayerRegistered).toBe(false);
151
+ });
152
+
153
+ it("should not register the player for 'pre-measurement' item", () => {
154
+ const props = {
155
+ ...defaultProps,
156
+ item: {
157
+ ...defaultProps.item,
158
+ id: "pre-measurement-1",
159
+ },
160
+ };
161
+
162
+ render(
163
+ <Wrapper>
164
+ <PlayerLiveImage {...props} />
165
+ </Wrapper>
166
+ );
167
+
168
+ const isPlayerRegistered = playerManager.isPlayerRegistered(props.playerId);
169
+ expect(isPlayerRegistered).toBe(false);
170
+ });
116
171
  });
@@ -9,7 +9,7 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
9
9
  <View
10
10
  collapsable={false}
11
11
  style={
12
- Object {
12
+ {
13
13
  "opacity": 1,
14
14
  }
15
15
  }
@@ -19,10 +19,10 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
19
19
  audioMutedByDefault={false}
20
20
  imageKey="image1"
21
21
  item={
22
- Object {
22
+ {
23
23
  "id": "1",
24
24
  "title": "Test",
25
- "type": Object {
25
+ "type": {
26
26
  "value": "",
27
27
  },
28
28
  }
@@ -30,13 +30,8 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
30
30
  onError={[Function]}
31
31
  playerId="player1"
32
32
  resizeMode="cover"
33
- screenConfig={Object {}}
34
- source={
35
- Object {
36
- "uri": "",
37
- }
38
- }
39
- style={Object {}}
33
+ screenConfig={{}}
34
+ style={{}}
40
35
  />
41
36
  </View>
42
37
  </View>
@@ -1,8 +1,10 @@
1
1
  import { Animated, Easing, EasingFunction, StyleProp } from "react-native";
2
2
 
3
- type AnimatedInterpolatedStyle =
4
- | Animated.AnimatedInterpolation
5
- | [{ [Key: string]: Animated.AnimatedInterpolation }];
3
+ type AnimatedInterpolatedStyle = any;
4
+
5
+ // type AnimatedInterpolatedStyle =
6
+ // | Animated.AnimatedInterpolation
7
+ // | [{ [Key: string]: Animated.AnimatedInterpolation }];
6
8
 
7
9
  type AnimationConfig = {
8
10
  duration: number;
@@ -27,11 +29,12 @@ const OUT_DURATION = 1000;
27
29
 
28
30
  const easing = Easing.in(Easing.bezier(0.25, 0.1, 0.25, 1.0));
29
31
 
32
+ // @returns {Animated.AnimatedInterpolation} - Interpolated value
30
33
  const interpolate = (
31
34
  animatedValue: Animated.Value,
32
35
  from: number = 0,
33
36
  to: number = 1
34
- ): Animated.AnimatedInterpolation =>
37
+ ): any =>
35
38
  animatedValue.interpolate({
36
39
  inputRange: [0, 1],
37
40
  outputRange: [from, to],
@@ -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,14 +62,17 @@ 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
73
  const { mode: videoModalMode, item: videoModalItem } = videoModalState;
71
- const isMaximazedModal = videoModalMode === "MAXIMIZED";
72
- const isMinimizedModal = videoModalMode === "MINIMIZED";
74
+ const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
75
+ const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
73
76
  const previousItemId = usePrevious(videoModalItem?.id);
74
77
 
75
78
  const isNotMinimizeMaximazeAnimation =
@@ -80,7 +83,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
80
83
  enableGesture &&
81
84
  !isLanguageOverlayVisible &&
82
85
  isNotMinimizeMaximazeAnimation &&
83
- (isMaximazedModal || isMinimizedModal);
86
+ !isSeekBarTouch &&
87
+ (isMaximizedModal || isMinimizedModal);
84
88
 
85
89
  const isAudioItem = React.useMemo(
86
90
  () =>
@@ -342,6 +346,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
342
346
  []
343
347
  );
344
348
 
349
+ const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
350
+
345
351
  return (
346
352
  <Wrapper style={generalStyles.container}>
347
353
  <TapGestureHandler
@@ -355,7 +361,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
355
361
  enabled={isEnablePanGesture}
356
362
  ref={panHandlerRef}
357
363
  simultaneousHandlers={[scrollRef, tapHandlerRef]}
358
- shouldCancelWhenOutside={isMaximazedModal}
364
+ shouldCancelWhenOutside={isMaximizedModal}
359
365
  onGestureEvent={onGestureEvent}
360
366
  onHandlerStateChange={onHandlerStateChange}
361
367
  activeOffsetY={[-5, 5]}
@@ -367,9 +373,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
367
373
  simultaneousHandlers={panHandlerRef}
368
374
  >
369
375
  <Animated.ScrollView
370
- scrollEnabled={
371
- isMaximazedModal && isNotMinimizeMaximazeAnimation
372
- }
376
+ scrollEnabled={scrollEnabled}
373
377
  bounces={false}
374
378
  onScrollBeginDrag={onRegisterLastScroll}
375
379
  onScroll={onScroll}
@@ -41,7 +41,10 @@ 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
 
@@ -52,6 +55,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
52
55
  const isEnablePanGesture =
53
56
  !isLanguageOverlayVisible &&
54
57
  isNotMinimizeMaximazeAnimation &&
58
+ !isSeekBarTouch &&
55
59
  (isMaximazedModal || isMinimizedModal);
56
60
 
57
61
  const onGestureEvent = Animated.event(
@@ -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
@@ -404,7 +405,7 @@ export const AnimationView = ({
404
405
 
405
406
  return (
406
407
  <Animated.View
407
- onLayout={additionalData.useLayoutMeasure && measureView}
408
+ onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
408
409
  ref={animationComponentRef}
409
410
  style={[
410
411
  ...preparedStyles,
@@ -434,8 +435,8 @@ export const AnimationComponent = (props: Props) => {
434
435
  const Component = useAnimation
435
436
  ? AnimationView
436
437
  : style
437
- ? View
438
- : React.Fragment;
438
+ ? View
439
+ : React.Fragment;
439
440
 
440
441
  if (
441
442
  additionalData.extraAnimation &&
@@ -1,14 +1,12 @@
1
- import React, { useContext } from "react";
1
+ import React from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
4
  import {
5
5
  useSafeAreaInsets,
6
6
  useSafeAreaFrame,
7
7
  } from "react-native-safe-area-context";
8
- import {
9
- useGetBottomTabBarHeight,
10
- useNavigation,
11
- } from "@applicaster/zapp-react-native-utils/reactHooks";
8
+ import { useGetBottomTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useGetBottomTabBarHeight";
9
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
12
10
  import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
13
11
 
14
12
  import { PROGRESS_BAR_HEIGHT } from "./utils";
@@ -48,7 +46,7 @@ export type ModalAnimationContextT = {
48
46
  progressBarHeight: number;
49
47
  };
50
48
 
51
- const ReactContext = React.createContext<ModalAnimationContextT>({
49
+ export const ReactContext = React.createContext<ModalAnimationContextT>({
52
50
  isActiveGesture: false,
53
51
  playerAnimationState: null,
54
52
  setPlayerAnimationState: () => null,
@@ -73,10 +71,6 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
73
71
  progressBarHeight: 0,
74
72
  });
75
73
 
76
- export function useModalAnimationContext() {
77
- return useContext<ModalAnimationContextT>(ReactContext);
78
- }
79
-
80
74
  const Provider = ({ children }: { children: React.ReactNode }) => {
81
75
  const [playerAnimationState, setPlayerAnimationState] =
82
76
  React.useState<PlayerAnimationStateT>(null);
@@ -124,11 +118,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
124
118
  If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
125
119
  Because of this we need to minus bottom SafeArea offset.
126
120
  */
121
+
127
122
  const minValue =
128
123
  height -
129
- minimisedHeight -
130
- (bottomTabBarHeight || bottomSafeArea) -
131
- progressBarHeight;
124
+ (minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
132
125
 
133
126
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
134
127
  // Last snap state which will helps us to make smooth responder to scrollview animation
@@ -6,10 +6,11 @@ export { AnimatedVideoPlayerComponent } from "./AnimatedVideoPlayerComponent";
6
6
 
7
7
  export {
8
8
  withModalAnimationProvider,
9
- useModalAnimationContext,
10
9
  PlayerAnimationStateEnum,
11
10
  } from "./ModalAnimationContext";
12
11
 
12
+ export { useModalAnimationContext } from "./useModalAnimationContext";
13
+
13
14
  export { AnimationComponent } from "./AnimationComponent";
14
15
 
15
16
  export { ComponentAnimationType, defaultAspectRatioWidth } from "./utils";
@@ -0,0 +1,6 @@
1
+ import { useContext } from "react";
2
+ import { ModalAnimationContextT, ReactContext } from "./ModalAnimationContext";
3
+
4
+ export function useModalAnimationContext() {
5
+ return useContext<ModalAnimationContextT>(ReactContext);
6
+ }
@@ -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
  };