@applicaster/zapp-react-native-ui-components 13.0.0-alpha.7120331332 → 13.0.0-alpha.7122212380

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 (48) hide show
  1. package/Components/BaseFocusable/index.ios.ts +1 -1
  2. package/Components/BaseFocusable/index.tsx +66 -29
  3. package/Components/Cell/Cell.tsx +7 -3
  4. package/Components/Cell/TvOSCellComponent.tsx +0 -4
  5. package/Components/Focusable/Focusable.tsx +0 -54
  6. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  7. package/Components/Focusable/Touchable.tsx +19 -20
  8. package/Components/FocusableList/index.tsx +0 -1
  9. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  10. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  11. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  12. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  13. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  14. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  15. package/Components/MasterCell/dataAdapter.ts +10 -3
  16. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  17. package/Components/MasterCell/utils/index.ts +21 -7
  18. package/Components/PlayerContainer/PlayerContainer.tsx +3 -7
  19. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  20. package/Components/River/__tests__/componentsMap.test.js +14 -1
  21. package/Components/Tabs/Tab.tsx +6 -6
  22. package/Components/TextInputTv/index.tsx +2 -2
  23. package/Components/Transitioner/AnimationManager.js +8 -8
  24. package/Components/VideoLive/LiveImageManager.ts +27 -1
  25. package/Components/VideoLive/PlayerLiveImageComponent.tsx +18 -16
  26. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
  27. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
  28. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +5 -1
  29. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  30. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +8 -7
  31. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  32. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  33. package/Components/VideoModal/PlayerWrapper.tsx +16 -35
  34. package/Components/VideoModal/VideoModal.tsx +14 -23
  35. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
  36. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
  37. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  38. package/Components/VideoModal/hooks/index.ts +7 -0
  39. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  40. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  41. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  42. package/Components/VideoModal/utils.ts +1 -1
  43. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +7 -3
  44. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +5 -1
  45. package/Contexts/ScreenContext/index.tsx +3 -2
  46. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  47. package/Decorators/ZappPipesDataConnector/index.tsx +31 -1
  48. package/package.json +12 -6
@@ -380,7 +380,7 @@ const PlayerContainerComponent = (props: Props) => {
380
380
  }
381
381
  };
382
382
 
383
- const playerRemoteHandler = (component, event, isLanguageOverlayVisible) => {
383
+ const playerRemoteHandler = (event, isLanguageOverlayVisible) => {
384
384
  const { eventType } = event;
385
385
 
386
386
  if (!isLanguageOverlayVisible && eventType === "menu") {
@@ -623,12 +623,8 @@ const PlayerContainerComponent = (props: Props) => {
623
623
  <PlayerContainerContext.Consumer>
624
624
  {(context) => (
625
625
  <TVEventHandlerComponent
626
- tvEventHandler={(component, event) =>
627
- playerRemoteHandler(
628
- component,
629
- event,
630
- context.isLanguageOverlayVisible
631
- )
626
+ tvEventHandler={(_component, event) =>
627
+ playerRemoteHandler(event, context.isLanguageOverlayVisible)
632
628
  }
633
629
  >
634
630
  <FocusableGroup
@@ -9,11 +9,14 @@ type ContextProps = {
9
9
  setIsLanguageOverlayVisible: (isVisible) => void;
10
10
  setShowComponentsContainer: (isVisible) => void;
11
11
  showComponentsContainer: boolean;
12
+ setIsSeekBarTouch: (isTouch) => void;
13
+ isSeekBarTouch: boolean;
12
14
  };
13
15
 
14
16
  export const PlayerContainerContext = createContext({
15
17
  ignoreOffsetContainer: false,
16
18
  isLanguageOverlayVisible: false,
19
+ isSeekBarTouch: false,
17
20
  } as ContextProps);
18
21
 
19
22
  type Props = {
@@ -40,6 +43,8 @@ export const PlayerContainerContextProvider = ({
40
43
  const [showComponentsContainer, setShowComponentsContainer] =
41
44
  React.useState(true);
42
45
 
46
+ const [isSeekBarTouch, setIsSeekBarTouch] = React.useState(false);
47
+
43
48
  const value = React.useMemo(
44
49
  () => ({
45
50
  ignoreOffsetContainer,
@@ -49,6 +54,8 @@ export const PlayerContainerContextProvider = ({
49
54
  setIsLanguageOverlayVisible,
50
55
  showComponentsContainer,
51
56
  setShowComponentsContainer: inline ? setShowComponentsContainer : null,
57
+ isSeekBarTouch,
58
+ setIsSeekBarTouch,
52
59
  }),
53
60
  [
54
61
  ignoreOffsetContainer,
@@ -58,6 +65,8 @@ export const PlayerContainerContextProvider = ({
58
65
  setIsLanguageOverlayVisible,
59
66
  showComponentsContainer,
60
67
  setShowComponentsContainer,
68
+ isSeekBarTouch,
69
+ setIsSeekBarTouch,
61
70
  ]
62
71
  );
63
72
 
@@ -81,6 +81,13 @@ const mockScreenData = {
81
81
  id: "A1234",
82
82
  };
83
83
 
84
+ jest.mock("@applicaster/zapp-react-native-redux/AppStore", () => ({
85
+ appStore: {
86
+ get: jest.fn((prop) => mockStore[prop]),
87
+ getState: jest.fn(),
88
+ },
89
+ }));
90
+
84
91
  jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
85
92
  useIsRTL: jest.fn(() => mock_rtl_flag),
86
93
  }));
@@ -153,7 +160,13 @@ const plugins = [];
153
160
  const navigation = {};
154
161
 
155
162
  const props = { components, cellStyles, riverComponents, navigation };
156
- const store = mockStore({ components, cellStyles, plugins });
163
+
164
+ const store = mockStore({
165
+ components,
166
+ cellStyles,
167
+ plugins,
168
+ getState: jest.fn(),
169
+ });
157
170
 
158
171
  jest.useFakeTimers();
159
172
 
@@ -69,8 +69,8 @@ const getStyles = (configuration, selected, focused) => {
69
69
  ? tab_cell_background_color_selected_active
70
70
  : tab_cell_background_color_selected_default
71
71
  : focused
72
- ? tab_cell_background_color_active
73
- : tab_cell_background_color_default,
72
+ ? tab_cell_background_color_active
73
+ : tab_cell_background_color_default,
74
74
  justifyContent: "center",
75
75
  alignItems: "center",
76
76
  position: "relative",
@@ -85,8 +85,8 @@ const getStyles = (configuration, selected, focused) => {
85
85
  ? tab_cell_border_color_active_focused
86
86
  : tab_cell_border_color_active
87
87
  : focused
88
- ? tab_cell_border_color_default_focused
89
- : tab_cell_border_color_default,
88
+ ? tab_cell_border_color_default_focused
89
+ : tab_cell_border_color_default,
90
90
  },
91
91
  label: {
92
92
  fontFamily: text_label_font_family,
@@ -98,8 +98,8 @@ const getStyles = (configuration, selected, focused) => {
98
98
  ? text_label_selected_active_font_color
99
99
  : text_label_selected_default_font_color
100
100
  : focused
101
- ? text_label_active_font_color
102
- : text_label_default_font_color,
101
+ ? text_label_active_font_color
102
+ : text_label_default_font_color,
103
103
  },
104
104
  underline: {
105
105
  position: "absolute",
@@ -94,8 +94,8 @@ function TextInputTV(props: Props, ref) {
94
94
  styles.textAlign === "center"
95
95
  ? styles.textAlign
96
96
  : styles.textAlign === "left"
97
- ? "right"
98
- : "left";
97
+ ? "right"
98
+ : "left";
99
99
 
100
100
  return { style: { ...styles, textAlign } };
101
101
  }
@@ -3,19 +3,19 @@ import { Animated } from "react-native";
3
3
  import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
4
4
 
5
5
  type TransitionConfig = {
6
- duration: number,
7
- easing: any,
6
+ duration: number;
7
+ easing: any;
8
8
  from: {
9
- style: any,
10
- },
9
+ style: any;
10
+ };
11
11
  to: {
12
- style: any,
13
- },
12
+ style: any;
13
+ };
14
14
  };
15
15
 
16
16
  type Props = {
17
- transitionConfig: TransitionConfig,
18
- contentStyle: { [string]: any },
17
+ transitionConfig: TransitionConfig;
18
+ contentStyle: { [string]: any };
19
19
  };
20
20
 
21
21
  /**
@@ -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
@@ -244,25 +244,27 @@ const PlayerLiveImageComponent = (props: Props) => {
244
244
  }, [item.id]);
245
245
 
246
246
  React.useEffect(() => {
247
- if (playerManager) {
248
- const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
247
+ if (isMeasurement(item) || !playerManager) {
248
+ return;
249
+ }
249
250
 
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
- });
251
+ const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
259
252
 
260
- return () => {
261
- playerManager.unregisterPlayer(playerId);
262
- };
263
- }
253
+ if (isPlayerRegistered) {
254
+ log_error(
255
+ `PlayerLiveImageComponent: player ${playerId} already registered`
256
+ );
257
+ } else {
258
+ playerManager.registerPlayer({
259
+ id: playerId,
260
+ playerController: controller,
261
+ });
262
+
263
+ return () => {
264
+ playerManager.unregisterPlayer(playerId);
265
+ };
264
266
  }
265
- }, [liveImageItem, playerId, controller]);
267
+ }, [liveImageItem, playerId, controller, item.id]);
266
268
 
267
269
  const onPositionUpdated = React.useCallback(
268
270
  (data) => {
@@ -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>
@@ -62,7 +62,10 @@ 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();
@@ -80,6 +83,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
80
83
  enableGesture &&
81
84
  !isLanguageOverlayVisible &&
82
85
  isNotMinimizeMaximazeAnimation &&
86
+ !isSeekBarTouch &&
83
87
  (isMaximazedModal || isMinimizedModal);
84
88
 
85
89
  const isAudioItem = React.useMemo(
@@ -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(
@@ -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
@@ -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 &&
@@ -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
+ };
@@ -10,7 +10,8 @@ import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
10
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
11
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
12
12
  import { PlayerDetails } from "./PlayerDetails";
13
- import { playerDimesionsHack } from "./utils";
13
+ import { playerDimensionsHack } from "./utils";
14
+ import { useDelayedPlayerDetails } from "./hooks";
14
15
 
15
16
  import {
16
17
  AnimatedScrollModal,
@@ -121,34 +122,6 @@ const getTabletWidth = (
121
122
  return Number(width) - sidebarWidth;
122
123
  };
123
124
 
124
- const showDetails = (
125
- isMobile: boolean,
126
- docked: boolean,
127
- isInlineModal,
128
- pip
129
- ): boolean => {
130
- if (pip) {
131
- return false;
132
- }
133
-
134
- if (!isInlineModal) {
135
- return false;
136
- }
137
-
138
- // for mobile we always show details. Mounting of it very heavy operation.
139
- if (isMobile) {
140
- return true;
141
- }
142
-
143
- // workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
144
- // FIXME - find out the reason of dissapearing of content
145
- if (docked) {
146
- return false;
147
- }
148
-
149
- return true;
150
- };
151
-
152
125
  const PlayerWrapperComponent = (props: Props) => {
153
126
  const {
154
127
  entry,
@@ -167,7 +140,15 @@ const PlayerWrapperComponent = (props: Props) => {
167
140
 
168
141
  const isInlineModal = inline && isModal;
169
142
 
170
- // const style = getStyles(baseStyle, !isTablet, isInlineModal, pip);
143
+ // Mounting the PlayerDetails component is a resource-intensive process.
144
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
145
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
146
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
147
+ const isShowPlayerDetails = useDelayedPlayerDetails({
148
+ isInline: isInlineModal,
149
+ isDocked: docked,
150
+ isPip: pip,
151
+ });
171
152
 
172
153
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
173
154
 
@@ -203,8 +184,8 @@ const PlayerWrapperComponent = (props: Props) => {
203
184
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
204
185
 
205
186
  const childrenStyles = React.useMemo(
206
- () => ({ ...playerDimensions, ...playerDimesionsHack }),
207
- [containerDimensions, playerDimesionsHack]
187
+ () => ({ ...playerDimensions, ...playerDimensionsHack }),
188
+ [containerDimensions, playerDimensionsHack]
208
189
  );
209
190
 
210
191
  return (
@@ -213,7 +194,7 @@ const PlayerWrapperComponent = (props: Props) => {
213
194
  style={[
214
195
  safeAreaStyles(configuration, isTablet),
215
196
  style,
216
- playerDimesionsHack,
197
+ playerDimensionsHack,
217
198
  ]}
218
199
  >
219
200
  <AnimationComponent
@@ -227,7 +208,7 @@ const PlayerWrapperComponent = (props: Props) => {
227
208
  defaultStyles.playerContainer,
228
209
  containerDimensions,
229
210
  containerStyle,
230
- playerDimesionsHack,
211
+ playerDimensionsHack,
231
212
  ]}
232
213
  >
233
214
  <AnimationComponent
@@ -246,7 +227,7 @@ const PlayerWrapperComponent = (props: Props) => {
246
227
  </View>
247
228
 
248
229
  <AnimatedScrollModal>
249
- {showDetails(!isTablet, docked, isInlineModal, pip) && (
230
+ {isShowPlayerDetails && (
250
231
  <AnimationComponent
251
232
  animationType={ComponentAnimationType.componentFade}
252
233
  style={defaultStyles.flex}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import * as R from "ramda";
3
- import { StyleSheet, View, StatusBar } from "react-native";
2
+ import { equals } from "ramda";
3
+ import { StyleSheet, StatusBar } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -17,17 +17,20 @@ 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 { useModalSize } from "./hooks/useModalSize";
21
- import { useBackgroundColor } from "./hooks/useBackgroundColor";
22
- import { useInitialPlayerState } from "./hooks/useInitialPlayerState";
20
+ import {
21
+ useModalSize,
22
+ useBackgroundColor,
23
+ useInitialPlayerState,
24
+ } from "./hooks";
25
+
23
26
  import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
24
- import { Spinner } from "../Spinner";
25
27
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
26
28
  import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
27
29
  import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
28
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
29
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
30
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { OpaqueLayer } from "./OpaqueLayer";
31
34
 
32
35
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
33
36
 
@@ -39,17 +42,6 @@ const styles = StyleSheet.create({
39
42
  bottom: 0,
40
43
  position: "absolute",
41
44
  },
42
- // eslint-disable-next-line react-native/no-color-literals
43
- loaderContainer: {
44
- top: 0,
45
- left: 0,
46
- right: 0,
47
- bottom: 0,
48
- position: "absolute",
49
- alignItems: "center",
50
- justifyContent: "center",
51
- backgroundColor: "rgba(64,64,64,.5)",
52
- },
53
45
  });
54
46
 
55
47
  const VideoModalComponent = () => {
@@ -100,7 +92,7 @@ const VideoModalComponent = () => {
100
92
 
101
93
  const onHooksSuccess = ({ payload }) => {
102
94
  // set new modified entry
103
- if (!R.equals(payload, item)) {
95
+ if (!equals(payload, item)) {
104
96
  onVideoModalHookSuccessAnalyticsEvent();
105
97
  setVideoModalItem(payload);
106
98
  }
@@ -136,7 +128,10 @@ const VideoModalComponent = () => {
136
128
 
137
129
  <PathnameContext.Provider value={pathname}>
138
130
  <ScreenContextProvider pathname={pathname}>
139
- {itemIdHooksFinished === item?.id ? (
131
+ {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
+ {mode === "FULLSCREEN" && <OpaqueLayer />}
133
+
134
+ {itemIdHooksFinished === item?.id && (
140
135
  <AnimatedPlayerModalWrapper
141
136
  style={[
142
137
  styles.container,
@@ -153,10 +148,6 @@ const VideoModalComponent = () => {
153
148
  mode={mode}
154
149
  />
155
150
  </AnimatedPlayerModalWrapper>
156
- ) : (
157
- <View style={styles.loaderContainer}>
158
- <Spinner />
159
- </View>
160
151
  )}
161
152
  </ScreenContextProvider>
162
153
  </PathnameContext.Provider>
@@ -62,7 +62,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
62
62
  })),
63
63
  }));
64
64
 
65
- jest.mock("../utils", () => ({ playerDimesionsHack: {} }));
65
+ jest.mock("../utils", () => ({ playerDimensionsHack: {} }));
66
66
 
67
67
  const { PlayerWrapper } = require("../PlayerWrapper");
68
68