@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5428512514 → 13.0.0-alpha.5771418585

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 (70) hide show
  1. package/Components/BaseFocusable/index.ios.ts +1 -1
  2. package/Components/BaseFocusable/index.tsx +1 -1
  3. package/Components/Cell/Cell.tsx +7 -3
  4. package/Components/Cell/CellWithFocusable.ios.tsx +126 -0
  5. package/Components/Cell/CellWithFocusable.tsx +43 -59
  6. package/Components/Cell/TvOSCellComponent.tsx +0 -4
  7. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  8. package/Components/ErrorScreen/index.tsx +6 -6
  9. package/Components/Focusable/Focusable.tsx +1 -0
  10. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  11. package/Components/Focusable/Touchable.tsx +19 -20
  12. package/Components/FocusableList/index.tsx +0 -1
  13. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  14. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  15. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  16. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  17. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  18. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  19. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  20. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  21. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  22. package/Components/MasterCell/utils/index.ts +1 -1
  23. package/Components/ModalComponent/Button/index.tsx +6 -6
  24. package/Components/ModalComponent/Header/index.tsx +3 -3
  25. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  26. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  27. package/Components/PlayerContainer/PlayerContainer.tsx +11 -15
  28. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  29. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  30. package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
  31. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  32. package/Components/River/RiverFooter.tsx +39 -9
  33. package/Components/River/RiverItem.tsx +37 -2
  34. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
  35. package/Components/River/__tests__/componentsMap.test.js +17 -5
  36. package/Components/Screen/hooks.ts +56 -0
  37. package/Components/Screen/index.tsx +16 -42
  38. package/Components/Tabs/Tab.tsx +11 -9
  39. package/Components/TextInputTv/index.tsx +4 -3
  40. package/Components/Transitioner/AnimationManager.js +8 -8
  41. package/Components/Transitioner/Scene.tsx +53 -24
  42. package/Components/Transitioner/Transitioner.tsx +3 -3
  43. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +59 -43
  44. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  45. package/Components/Transitioner/index.js +8 -4
  46. package/Components/VideoLive/LiveImageManager.ts +27 -1
  47. package/Components/VideoLive/PlayerLiveImageComponent.tsx +32 -24
  48. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
  49. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
  50. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +16 -12
  51. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  52. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +15 -14
  53. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -3
  54. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  55. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  56. package/Components/VideoModal/PlayerDetails.tsx +5 -5
  57. package/Components/VideoModal/PlayerWrapper.tsx +17 -36
  58. package/Components/VideoModal/VideoModal.tsx +14 -23
  59. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
  60. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
  61. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  62. package/Components/VideoModal/hooks/index.ts +7 -0
  63. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  64. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  65. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  66. package/Components/VideoModal/utils.ts +1 -1
  67. package/Contexts/ScreenContext/index.tsx +3 -2
  68. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  69. package/Decorators/ZappPipesDataConnector/index.tsx +31 -1
  70. package/package.json +5 -5
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { equals } from "ramda";
2
3
  import { Animated, ViewProps, ViewStyle } from "react-native";
3
4
  import { useSafeAreaFrame } from "react-native-safe-area-context";
4
5
 
@@ -8,6 +9,11 @@ import { PathnameContext } from "../../Contexts/PathnameContext";
8
9
  import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
9
10
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
10
11
 
12
+ const fullWidthDimensions = {
13
+ height: "100%",
14
+ width: "100%",
15
+ };
16
+
11
17
  type Props = {
12
18
  children: any;
13
19
  style: any;
@@ -20,6 +26,47 @@ type Props = {
20
26
  screenData: NavigationScreenData;
21
27
  };
22
28
 
29
+ export function CurrentScreenContextProvider({
30
+ children,
31
+ ...props
32
+ }: {
33
+ children: any;
34
+ pathname: string;
35
+ isActive: boolean;
36
+ screenData: NavigationScreenData;
37
+ }) {
38
+ const { pathname, isActive = false, screenData } = props;
39
+
40
+ const [initialScreenData, setInitialScreenData] = React.useState(screenData);
41
+
42
+ React.useLayoutEffect(() => {
43
+ const screenDataChanged = !equals(initialScreenData, screenData);
44
+
45
+ if (isActive && screenDataChanged) {
46
+ setInitialScreenData(screenData);
47
+ }
48
+ }, [initialScreenData, screenData, isActive]);
49
+
50
+ return (
51
+ <ScreenDataContext.Provider value={initialScreenData}>
52
+ <PathnameContext.Provider value={pathname}>
53
+ <ScreenContextProvider pathname={pathname}>
54
+ {children}
55
+ </ScreenContextProvider>
56
+ </PathnameContext.Provider>
57
+ </ScreenDataContext.Provider>
58
+ );
59
+ }
60
+
61
+ const withCurrentScreenContext = (Component) =>
62
+ function SceneComponent(props: Props) {
63
+ return (
64
+ <CurrentScreenContextProvider {...props}>
65
+ <Component {...props} />
66
+ </CurrentScreenContextProvider>
67
+ );
68
+ };
69
+
23
70
  /**
24
71
  * Animated View container for any purpose.
25
72
  * Renders given children with given style object.
@@ -32,53 +79,35 @@ type Props = {
32
79
  * @param contentStyle
33
80
  * @param screenUniqueId
34
81
  */
35
- export function Scene({
82
+ function SceneComponent({
36
83
  children,
37
84
  style,
38
85
  pointerEvents = "auto",
39
86
  overlayStyle,
40
87
  animating,
41
88
  contentStyle,
42
- pathname,
43
89
  isActive = false,
44
90
  screenData,
45
91
  }: Props) {
46
- const [initialScreenData, setInitialScreenData] = React.useState(screenData);
47
-
48
92
  useScreenOrientationHandler({
49
93
  screenData,
50
94
  isActive,
51
95
  });
52
96
 
53
- React.useLayoutEffect(() => {
54
- if (isActive) {
55
- setInitialScreenData(screenData);
56
- }
57
- }, [screenData, isActive]);
58
-
59
97
  const frame = useSafeAreaFrame();
60
98
  const isAnimating = animating && overlayStyle;
61
99
 
62
- const dimensions = isAnimating
63
- ? {
64
- width: "100%",
65
- height: "100%",
66
- }
67
- : frame;
100
+ const dimensions = isAnimating ? fullWidthDimensions : frame;
68
101
 
69
102
  return (
70
103
  <Animated.View
71
104
  pointerEvents={pointerEvents}
72
105
  style={[style, contentStyle, dimensions]}
73
106
  >
74
- <ScreenDataContext.Provider value={initialScreenData}>
75
- <PathnameContext.Provider value={pathname}>
76
- <ScreenContextProvider pathname={pathname}>
77
- {children}
78
- </ScreenContextProvider>
79
- </PathnameContext.Provider>
80
- </ScreenDataContext.Provider>
81
- {isAnimating && <Animated.View style={overlayStyle} />}
107
+ {children}
108
+ {isAnimating ? <Animated.View style={overlayStyle} /> : null}
82
109
  </Animated.View>
83
110
  );
84
111
  }
112
+
113
+ export const Scene = withCurrentScreenContext(SceneComponent);
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { View } from "react-native";
3
- import { update, compose, tail, append, take, identity, isNil } from "ramda";
3
+ import { append, compose, identity, isNil, tail, take, update } from "ramda";
4
4
 
5
5
  import { AnimationManager } from "./AnimationManager";
6
6
  import { Scene } from "./Scene";
@@ -289,7 +289,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
289
289
 
290
290
  return (
291
291
  <View style={styles.container}>
292
- {scenes[to.index] && (
292
+ {scenes[to.index] ? (
293
293
  <Scene
294
294
  {...{ style: to?.style || {} }}
295
295
  pathname={pathname}
@@ -301,7 +301,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
301
301
  >
302
302
  {scenes[to.index].children}
303
303
  </Scene>
304
- )}
304
+ ) : null}
305
305
  </View>
306
306
  );
307
307
  }
@@ -1,63 +1,79 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Scene /> renders correctly 1`] = `
4
- <ForwardRef(AnimatedComponentWrapper)
5
- pointerEvents="auto"
4
+ <CurrentScreenContextProvider
5
+ contentStyle={
6
+ {
7
+ "paddingBottom": 49,
8
+ }
9
+ }
10
+ overlayStyle={
11
+ {
12
+ "opacity": 1,
13
+ }
14
+ }
6
15
  style={
7
- [
8
- {
9
- "flex": 1,
10
- },
16
+ {
17
+ "flex": 1,
18
+ }
19
+ }
20
+ >
21
+ <SceneComponent
22
+ contentStyle={
11
23
  {
12
24
  "paddingBottom": 49,
13
- },
25
+ }
26
+ }
27
+ overlayStyle={
14
28
  {
15
- "fontScale": 2,
16
- "height": 1334,
17
- "scale": 2,
18
- "statusBarHeight": null,
19
- "width": 750,
20
- },
21
- ]
22
- }
23
- >
24
- <ContextProvider>
25
- <ContextProvider>
26
- <ScreenContextProvider />
27
- </ContextProvider>
28
- </ContextProvider>
29
- </ForwardRef(AnimatedComponentWrapper)>
29
+ "opacity": 1,
30
+ }
31
+ }
32
+ style={
33
+ {
34
+ "flex": 1,
35
+ }
36
+ }
37
+ />
38
+ </CurrentScreenContextProvider>
30
39
  `;
31
40
 
32
41
  exports[`<Scene /> renders the overlay while animating 1`] = `
33
- <ForwardRef(AnimatedComponentWrapper)
34
- pointerEvents="auto"
42
+ <CurrentScreenContextProvider
43
+ animating={true}
44
+ contentStyle={
45
+ {
46
+ "paddingBottom": 49,
47
+ }
48
+ }
49
+ overlayStyle={
50
+ {
51
+ "opacity": 1,
52
+ }
53
+ }
35
54
  style={
36
- [
37
- {
38
- "flex": 1,
39
- },
55
+ {
56
+ "flex": 1,
57
+ }
58
+ }
59
+ >
60
+ <SceneComponent
61
+ animating={true}
62
+ contentStyle={
40
63
  {
41
64
  "paddingBottom": 49,
42
- },
65
+ }
66
+ }
67
+ overlayStyle={
43
68
  {
44
- "height": "100%",
45
- "width": "100%",
46
- },
47
- ]
48
- }
49
- >
50
- <ContextProvider>
51
- <ContextProvider>
52
- <ScreenContextProvider />
53
- </ContextProvider>
54
- </ContextProvider>
55
- <ForwardRef(AnimatedComponentWrapper)
69
+ "opacity": 1,
70
+ }
71
+ }
56
72
  style={
57
73
  {
58
- "opacity": 1,
74
+ "flex": 1,
59
75
  }
60
76
  }
61
77
  />
62
- </ForwardRef(AnimatedComponentWrapper)>
78
+ </CurrentScreenContextProvider>
63
79
  `;
@@ -9,7 +9,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
9
9
  }
10
10
  }
11
11
  >
12
- <Scene
12
+ <SceneComponent
13
13
  isActive={true}
14
14
  screenUniqueId="mocked-uuid"
15
15
  style={{}}
@@ -23,6 +23,6 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
23
23
  children
24
24
  </Text>
25
25
  </View>
26
- </Scene>
26
+ </SceneComponent>
27
27
  </View>
28
28
  `;
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import { useWindowDimensions } from "react-native";
3
2
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
4
3
  import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
5
4
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
@@ -7,10 +6,15 @@ import { TransitionerComponent } from "./Transitioner";
7
6
 
8
7
  export const Transitioner = (props) => {
9
8
  const navigator = useNavigation();
10
- const { height, width } = useWindowDimensions();
11
9
 
12
- const dimensions = useDimensions("window", { deviceInfo: true });
13
- const isTablet = dimensions?.deviceInfo?.isTablet;
10
+ const {
11
+ width,
12
+ height,
13
+ deviceInfo: { isTablet },
14
+ } = useDimensions("window", {
15
+ updateForInactiveScreens: false,
16
+ deviceInfo: true,
17
+ });
14
18
 
15
19
  const { appData } = usePickFromState(["appData"]);
16
20
  const isTabletPortrait = appData?.isTabletPortrait;
@@ -8,6 +8,8 @@ import { loggerLiveImageManager } from "./loggerHelper";
8
8
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
9
9
  import { Component } from "react";
10
10
 
11
+ const TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION = 500; // ms
12
+
11
13
  const { log_debug, log_info, log_error } = loggerLiveImageManager;
12
14
 
13
15
  export type LiveImageManagerEvent =
@@ -62,6 +64,9 @@ export class LiveImageManager implements PlayerLifecycleListener {
62
64
  protected currentlyPlaying: LiveImage | null = null;
63
65
  protected primaryPlayer: Player | null = null;
64
66
 
67
+ private checkPlayerPositionTimeout: ReturnType<typeof setTimeout> | null =
68
+ null;
69
+
65
70
  protected listeners: Record<
66
71
  string,
67
72
  Record<LiveImageManagerEvent, (event?: Record<string, any>) => void>
@@ -118,6 +123,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
118
123
  });
119
124
  };
120
125
 
126
+ private cancelCheckPlayerPositionTimeout = () => {
127
+ clearTimeout(this.checkPlayerPositionTimeout);
128
+ this.checkPlayerPositionTimeout = null;
129
+ };
130
+
121
131
  public onViewportEnter = (item: LiveImage) => {
122
132
  log_debug(
123
133
  `onViewportEnter: live-image ${playerInfo(
@@ -125,7 +135,21 @@ export class LiveImageManager implements PlayerLifecycleListener {
125
135
  )}, primary ${playerInfo(this.primaryPlayer)}`
126
136
  );
127
137
 
128
- this.checkPlayerPosition(item);
138
+ if (!isTV()) {
139
+ // mobile only
140
+ // we have to delay running checkPlayerPosition, because sometimes on fast scrolling we get wrong order onEnter, then onLeave.
141
+ // which could cause select wrong item to play
142
+
143
+ this.cancelCheckPlayerPositionTimeout();
144
+
145
+ this.checkPlayerPositionTimeout = setTimeout(() => {
146
+ this.cancelCheckPlayerPositionTimeout();
147
+
148
+ this.checkPlayerPosition(item);
149
+ }, TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION);
150
+ } else {
151
+ this.checkPlayerPosition(item);
152
+ }
129
153
  };
130
154
 
131
155
  public onViewportLeave = (item: LiveImage) => {
@@ -246,6 +270,8 @@ export class LiveImageManager implements PlayerLifecycleListener {
246
270
  };
247
271
 
248
272
  public checkPlayerPosition = (item: LiveImage) => {
273
+ this.cancelCheckPlayerPositionTimeout();
274
+
249
275
  log_debug(
250
276
  `checkPlayerPosition: live-image playerId: ${playerInfo(
251
277
  item.player
@@ -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}
@@ -4,6 +4,7 @@ import { render } from "@testing-library/react-native";
4
4
  import * as PlayerFactory from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerFactory";
5
5
  import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
6
6
  import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
7
+ import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
7
8
 
8
9
  import { PlayerLiveImage } from "../PlayerLiveImageComponent";
9
10
  import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
@@ -32,7 +33,7 @@ const mockStore = configureStore();
32
33
 
33
34
  const store = mockStore({ appData: {} });
34
35
 
35
- const Wrapper = ({ children }: { children: React.ReactChildren }) => (
36
+ const Wrapper = ({ children }: { children: React.ReactNode }) => (
36
37
  /* @ts-ignore */
37
38
  <Provider store={store}>
38
39
  <ThemeContext.Provider
@@ -118,4 +119,53 @@ describe("PlayerLiveImageComponent", () => {
118
119
 
119
120
  // TODO: implement this test
120
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
+ });
121
171
  });
@@ -31,11 +31,6 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
31
31
  playerId="player1"
32
32
  resizeMode="cover"
33
33
  screenConfig={{}}
34
- source={
35
- {
36
- "uri": "",
37
- }
38
- }
39
34
  style={{}}
40
35
  />
41
36
  </View>
@@ -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}