@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
@@ -3,7 +3,7 @@
3
3
  exports[`OfflineHandler renders 1`] = `
4
4
  <View
5
5
  style={
6
- Object {
6
+ {
7
7
  "flex": 1,
8
8
  "position": "relative",
9
9
  }
@@ -11,7 +11,7 @@ exports[`OfflineHandler renders 1`] = `
11
11
  >
12
12
  <View
13
13
  style={
14
- Object {
14
+ {
15
15
  "bottom": 0,
16
16
  "left": 0,
17
17
  "position": "absolute",
@@ -32,7 +32,7 @@ exports[`OfflineHandler renders 1`] = `
32
32
  onResponderTerminationRequest={[Function]}
33
33
  onStartShouldSetResponder={[Function]}
34
34
  style={
35
- Object {
35
+ {
36
36
  "alignItems": "center",
37
37
  "backgroundColor": undefined,
38
38
  "flex": 1,
@@ -43,8 +43,8 @@ exports[`OfflineHandler renders 1`] = `
43
43
  "position": "absolute",
44
44
  "right": 0,
45
45
  "top": 0,
46
- "transform": Array [
47
- Object {
46
+ "transform": [
47
+ {
48
48
  "translateY": -88,
49
49
  },
50
50
  ],
@@ -54,7 +54,7 @@ exports[`OfflineHandler renders 1`] = `
54
54
  >
55
55
  <View
56
56
  style={
57
- Object {
57
+ {
58
58
  "backgroundColor": undefined,
59
59
  "height": 44,
60
60
  }
@@ -62,7 +62,7 @@ exports[`OfflineHandler renders 1`] = `
62
62
  />
63
63
  <Text
64
64
  style={
65
- Object {
65
+ {
66
66
  "color": undefined,
67
67
  "fontFamily": undefined,
68
68
  "fontSize": undefined,
@@ -2,43 +2,46 @@ import React from "react";
2
2
 
3
3
  import renderer, { act } from "react-test-renderer";
4
4
 
5
- jest.useFakeTimers();
5
+ jest.useFakeTimers({ legacyFakeTimers: true });
6
6
 
7
- let connectionStatus = false;
8
- const previousValue = null;
7
+ let mockConnectionStatus = false;
8
+ const mockPreviousValue = null;
9
9
 
10
10
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/connection", () => {
11
11
  return {
12
- useConnectionInfo: jest.fn(() => connectionStatus),
12
+ useConnectionInfo: jest.fn(() => mockConnectionStatus),
13
13
  };
14
14
  });
15
15
 
16
16
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
17
17
  return {
18
- usePrevious: jest.fn(() => previousValue),
18
+ usePrevious: jest.fn(() => mockPreviousValue),
19
19
  };
20
20
  });
21
21
 
22
- jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
23
- usePickFromState: () => ({
24
- plugins: [
25
- {
26
- name: "offline experience",
27
- identifier: "offline-experience",
28
- type: "general",
29
- module: {
30
- useOfflineExperienceConfiguration: () => ({
31
- configurationFields: {},
32
- localizations: {
33
- offline_toast_message: "No internet connection",
34
- online_toast_message: "You are back online",
35
- },
36
- }),
22
+ jest.mock(
23
+ "@applicaster/zapp-react-native-redux/hooks/usePickFromState",
24
+ () => ({
25
+ usePickFromState: () => ({
26
+ plugins: [
27
+ {
28
+ name: "offline experience",
29
+ identifier: "offline-experience",
30
+ type: "general",
31
+ module: {
32
+ useOfflineExperienceConfiguration: () => ({
33
+ configurationFields: {},
34
+ localizations: {
35
+ offline_toast_message: "No internet connection",
36
+ online_toast_message: "You are back online",
37
+ },
38
+ }),
39
+ },
37
40
  },
38
- },
39
- ],
40
- }),
41
- }));
41
+ ],
42
+ }),
43
+ })
44
+ );
42
45
 
43
46
  jest.mock("react-native-safe-area-context", () => ({
44
47
  useSafeAreaInsets: () => ({ top: 44 }),
@@ -53,7 +56,7 @@ describe("OfflineHandler", () => {
53
56
  });
54
57
 
55
58
  it("renders Notification mode if component was rendered while online", () => {
56
- connectionStatus = true;
59
+ mockConnectionStatus = true;
57
60
 
58
61
  let instance;
59
62
 
@@ -1,17 +1,17 @@
1
1
  import * as React from "react";
2
+ import { useEffect, useReducer } from "react";
2
3
  // @ts-ignore
3
- import { View, ViewStyle, TVMenuControl } from "react-native";
4
+ import { TVMenuControl, View, ViewStyle } from "react-native";
4
5
  import * as R from "ramda";
5
6
  import uuid from "uuid/v4";
6
7
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
7
8
  import {
8
9
  isApplePlatform,
9
- platformSelect,
10
10
  isTV,
11
+ platformSelect,
11
12
  } from "@applicaster/zapp-react-native-utils/reactUtils";
12
13
 
13
14
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
14
- import { useEffect, useReducer } from "react";
15
15
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
16
16
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
17
17
  import {
@@ -29,16 +29,14 @@ import {
29
29
  import { ProgramInfo } from "./ProgramInfo";
30
30
  import { AudioPlayer } from "../AudioPlayer";
31
31
  import {
32
- playerContainerLogger,
33
32
  log_debug,
34
33
  log_info,
35
34
  log_warning,
35
+ playerContainerLogger,
36
36
  } from "./logger";
37
37
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
38
- import {
39
- useSetNavbarState,
40
- useTargetScreenData,
41
- } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
38
+ import { useSetNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
39
+ import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
42
40
  import {
43
41
  PlayerContainerContext,
44
42
  PlayerContainerContextProvider,
@@ -55,8 +53,8 @@ import { usePlayNextOverlay } from "@applicaster/zapp-react-native-utils/appUtil
55
53
  import { PlayNextState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/OverlaysObserver";
56
54
 
57
55
  import {
58
- useModalAnimationContext,
59
56
  PlayerAnimationStateEnum,
57
+ useModalAnimationContext,
60
58
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
61
59
 
62
60
  type Props = {
@@ -382,7 +380,7 @@ const PlayerContainerComponent = (props: Props) => {
382
380
  }
383
381
  };
384
382
 
385
- const playerRemoteHandler = (component, event, isLanguageOverlayVisible) => {
383
+ const playerRemoteHandler = (event, isLanguageOverlayVisible) => {
386
384
  const { eventType } = event;
387
385
 
388
386
  if (!isLanguageOverlayVisible && eventType === "menu") {
@@ -625,12 +623,8 @@ const PlayerContainerComponent = (props: Props) => {
625
623
  <PlayerContainerContext.Consumer>
626
624
  {(context) => (
627
625
  <TVEventHandlerComponent
628
- tvEventHandler={(component, event) =>
629
- playerRemoteHandler(
630
- component,
631
- event,
632
- context.isLanguageOverlayVisible
633
- )
626
+ tvEventHandler={(_component, event) =>
627
+ playerRemoteHandler(event, context.isLanguageOverlayVisible)
634
628
  }
635
629
  >
636
630
  <FocusableGroup
@@ -689,10 +683,10 @@ const PlayerContainerComponent = (props: Props) => {
689
683
 
690
684
  {renderRestPlayers(restPlayerProps)}
691
685
 
692
- {state.error && <ErrorDisplay error={state.error} />}
686
+ {state.error ? <ErrorDisplay error={state.error} /> : null}
693
687
  </View>
694
688
  {/* Components container */}
695
- {isInlineTV && context.showComponentsContainer && (
689
+ {isInlineTV && context.showComponentsContainer ? (
696
690
  <View
697
691
  style={styles.inlineRiver}
698
692
  testID={"inline-river-component-wrapper"}
@@ -723,7 +717,7 @@ const PlayerContainerComponent = (props: Props) => {
723
717
  )}
724
718
  </ComponentFocusableWrapperView>
725
719
  </View>
726
- )}
720
+ ) : null}
727
721
  </View>
728
722
  </FocusableGroup>
729
723
  </TVEventHandlerComponent>
@@ -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
 
@@ -114,12 +114,12 @@ function ProgramInfoComponent({
114
114
  return (
115
115
  <View style={container}>
116
116
  <View style={programStyles.programInfo.container}>
117
- {logo && (
117
+ {logo ? (
118
118
  <Image
119
119
  source={{ uri: logo }}
120
120
  style={programStyles.programInfo.logo}
121
121
  />
122
- )}
122
+ ) : null}
123
123
  {!isAudioContent && transportInfo}
124
124
  </View>
125
125
  </View>
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren } from "react";
1
+ import React, { PropsWithChildren, useEffect, useState } from "react";
2
2
  import { ImageBackground, View } from "react-native";
3
3
 
4
4
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
@@ -12,6 +12,7 @@ import {
12
12
  type Props = PropsWithChildren<{
13
13
  entry: ZappEntry;
14
14
  style?: { [K: string]: any };
15
+ docked?: boolean;
15
16
  imageStyle?: { [K: string]: any };
16
17
  imageKey?: string;
17
18
  defaultImageDimensions?: { [K: string]: any };
@@ -23,6 +24,7 @@ const PlayerImageBackgroundComponent = ({
23
24
  entry,
24
25
  children,
25
26
  style,
27
+ docked,
26
28
  imageStyle,
27
29
  imageKey,
28
30
  defaultImageDimensions,
@@ -34,8 +36,22 @@ const PlayerImageBackgroundComponent = ({
34
36
 
35
37
  const { playerAnimationState } = useModalAnimationContext();
36
38
 
39
+ const [lastNonNullAnimationState, setLastNonNullAnimationState] =
40
+ useState(playerAnimationState);
41
+
42
+ useEffect(() => {
43
+ if (playerAnimationState !== null) {
44
+ setLastNonNullAnimationState(playerAnimationState);
45
+ }
46
+ }, [playerAnimationState]);
47
+
37
48
  if (!source) return <>{children}</>;
38
49
 
50
+ const imageBackgroundStyle =
51
+ lastNonNullAnimationState !== PlayerAnimationStateEnum.minimize && !docked
52
+ ? defaultImageDimensions
53
+ : imageSize;
54
+
39
55
  return (
40
56
  <View
41
57
  style={
@@ -45,13 +61,17 @@ const PlayerImageBackgroundComponent = ({
45
61
  }
46
62
  >
47
63
  <AnimationComponent
48
- style={style}
64
+ style={
65
+ playerAnimationState === PlayerAnimationStateEnum.maximaze
66
+ ? defaultImageDimensions
67
+ : style
68
+ }
49
69
  animationType={ComponentAnimationType.player}
50
70
  additionalData={defaultImageDimensions}
51
71
  >
52
72
  <ImageBackground
53
73
  resizeMode="cover"
54
- style={imageSize}
74
+ style={imageBackgroundStyle}
55
75
  imageStyle={imageStyle}
56
76
  source={source}
57
77
  >
@@ -70,21 +70,6 @@ function ComponentsMapComponent(props: Props) {
70
70
 
71
71
  const [flatListHeight, setFlatListHeight] = React.useState(null);
72
72
 
73
- const {
74
- isAnyLoading,
75
- isAllLoaded,
76
- waitForAllComponents,
77
- onLoadFinished,
78
- onLoadFailed,
79
- shouldShowLoadingError,
80
- isAnyLoaded,
81
- arePreviousComponentsLoaded,
82
- } = useLoadingState(feed?.entry?.length || components.length);
83
-
84
- const theme = useTheme();
85
-
86
- const logTimestamp = useProfilerLogging();
87
-
88
73
  const riverComponents = React.useMemo(() => {
89
74
  if (feed?.entry?.length < components.length) {
90
75
  return R.slice(0, feed?.entry?.length, components);
@@ -93,55 +78,42 @@ function ComponentsMapComponent(props: Props) {
93
78
  return components;
94
79
  }, [components, feed]);
95
80
 
81
+ const logTimestamp = useProfilerLogging();
82
+
83
+ const onLoadDone = React.useCallback(() => {
84
+ logTimestamp(riverId?.toString());
85
+ }, [logTimestamp]);
86
+
87
+ const { loadingState, onLoadFinished, onLoadFailed, shouldShowLoadingError } =
88
+ useLoadingState(riverComponents.length, onLoadDone);
89
+
90
+ const theme = useTheme();
91
+
96
92
  const renderRiverItem = React.useCallback(
97
93
  ({ item, index }) => {
98
- const readyToBeDisplayed = arePreviousComponentsLoaded(index);
99
-
100
- const styles = {
101
- display: !readyToBeDisplayed ? "none" : ("flex" as "none" | "flex"),
94
+ const riverItemProps = {
95
+ riverId,
96
+ item,
97
+ index,
98
+ isScreenWrappedInContainer,
99
+ feed,
100
+ groupId,
101
+ onLoadFailed,
102
+ onLoadFinished,
103
+ getStaticComponentFeed,
104
+ isLast: isLast(index, riverComponents.length),
105
+ loadingState,
102
106
  };
103
107
 
104
108
  return (
105
- <View style={styles}>
106
- <ScreenLoadingMeasurementsListItemWrapper index={index}>
107
- <RiverItem
108
- {...{
109
- readyToBeDisplayed,
110
- riverId,
111
- item,
112
- index,
113
- isScreenWrappedInContainer,
114
- feed,
115
- groupId,
116
- onLoadFailed,
117
- onLoadFinished,
118
- getStaticComponentFeed,
119
- isLast: isLast(index, riverComponents.length),
120
- }}
121
- />
122
- </ScreenLoadingMeasurementsListItemWrapper>
123
- </View>
109
+ <ScreenLoadingMeasurementsListItemWrapper index={index}>
110
+ <RiverItem {...riverItemProps} />
111
+ </ScreenLoadingMeasurementsListItemWrapper>
124
112
  );
125
113
  },
126
- [
127
- feed,
128
- getStaticComponentFeed,
129
- arePreviousComponentsLoaded,
130
- onLoadFailed,
131
- onLoadFinished,
132
- ]
114
+ [feed, getStaticComponentFeed, onLoadFailed, onLoadFinished]
133
115
  );
134
116
 
135
- const renderFooter = React.useCallback(() => {
136
- return (
137
- <RiverFooter
138
- visible={isAnyLoading}
139
- flatListHeight={flatListHeight}
140
- isAnyLoaded={isAnyLoaded || waitForAllComponents}
141
- />
142
- );
143
- }, [flatListHeight, isAnyLoading, isAnyLoaded]);
144
-
145
117
  const screenStyle = React.useMemo(
146
118
  () => ({
147
119
  paddingTop: ifEmptyUseFallback(
@@ -179,12 +151,6 @@ function ComponentsMapComponent(props: Props) {
179
151
 
180
152
  usePipesCacheReset(riverId, riverComponents);
181
153
 
182
- React.useEffect(() => {
183
- if (isAllLoaded) {
184
- logTimestamp(riverId?.toString());
185
- }
186
- }, [isAllLoaded]);
187
-
188
154
  const refreshControl = React.useMemo(
189
155
  () =>
190
156
  pullToRefreshEnabled ? (
@@ -280,6 +246,11 @@ function ComponentsMapComponent(props: Props) {
280
246
  }
281
247
  }, []);
282
248
 
249
+ const contentContainerStyle = React.useMemo(
250
+ () => (isScreenWrappedInContainer ? {} : screenStyle),
251
+ [isScreenWrappedInContainer, screenStyle]
252
+ );
253
+
283
254
  if (shouldShowLoadingError) {
284
255
  return <RiverError />;
285
256
  }
@@ -291,7 +262,7 @@ function ComponentsMapComponent(props: Props) {
291
262
  <View style={styles.container}>
292
263
  <ScreenLoadingMeasurements
293
264
  riverId={riverId}
294
- numberOfComponents={feed?.entry?.length || components.length}
265
+ numberOfComponents={riverComponents.length}
295
266
  >
296
267
  <ViewportTracker>
297
268
  <FlatList
@@ -308,14 +279,16 @@ function ComponentsMapComponent(props: Props) {
308
279
  initialNumToRender={3}
309
280
  maxToRenderPerBatch={10}
310
281
  windowSize={12}
311
- listKey={riverId}
312
282
  keyExtractor={keyExtractor}
313
283
  renderItem={renderRiverItem}
314
284
  data={riverComponents}
315
- contentContainerStyle={
316
- isScreenWrappedInContainer ? {} : screenStyle
285
+ contentContainerStyle={contentContainerStyle}
286
+ ListFooterComponent={
287
+ <RiverFooter
288
+ flatListHeight={flatListHeight}
289
+ loadingState={loadingState}
290
+ />
317
291
  }
318
- ListFooterComponent={renderFooter}
319
292
  refreshControl={refreshControl}
320
293
  onScrollBeginDrag={onScrollBeginDrag}
321
294
  onScroll={onScroll}
@@ -1,50 +1,86 @@
1
1
  import * as React from "react";
2
- import * as R from "ramda";
3
-
4
- const allTrue = R.all(R.equals(true));
5
- const anyFalse = R.any(R.equals(false));
6
- const anyTrue = R.any(R.equals(true));
2
+ import { isNil, set, lensIndex, T, slice } from "ramda";
3
+ import { BehaviorSubject } from "rxjs";
4
+ import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
7
5
 
8
6
  const reducer = (state, { payload }) => {
9
- if (!R.isNil(payload) && !state[payload]) {
10
- return R.set(R.lensIndex(payload), true)(state);
7
+ if (!isNil(payload) && !state[payload]) {
8
+ return set(lensIndex(payload), true)(state);
11
9
  }
12
10
 
13
11
  return state;
14
12
  };
15
13
 
16
- type Return = {
17
- isAnyLoading: boolean;
18
- isAllLoaded: boolean;
14
+ type LoadingState = {
15
+ index: number;
16
+ done: boolean;
19
17
  waitForAllComponents: boolean;
18
+ };
19
+
20
+ type Return = {
21
+ loadingState: BehaviorSubject<LoadingState>;
20
22
  onLoadFinished: (index: number) => void;
21
23
  onLoadFailed: ({ error, index }: { error: Error; index: number }) => void;
22
24
  shouldShowLoadingError: boolean;
23
- isAnyLoaded: boolean;
24
25
  arePreviousComponentsLoaded: (index: number) => boolean;
25
26
  };
26
27
 
27
- type Action = { payload: { index: number } };
28
-
29
- type Loaded = true;
30
- type Loading = false;
31
-
32
- type LoadingState = Array<Loaded | Loading>;
33
-
34
28
  // TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
35
29
  const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
36
30
 
37
- export const useLoadingState = (count: number): Return => {
31
+ const createLoadingStateObservable = () =>
32
+ new BehaviorSubject<LoadingState>({
33
+ index: -1,
34
+ done: false,
35
+ waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
36
+ });
37
+
38
+ export const useLoadingState = (
39
+ count: number,
40
+ onLoadDone: () => void
41
+ ): Return => {
42
+ const componentStateRef = React.useRef(new Array(count).fill(false));
38
43
  const [loadingError, setLoadingError] = React.useState(null);
39
44
 
40
- const [componentsState, dispatch] = React.useReducer<
41
- React.Reducer<LoadingState, Action>
42
- >(reducer, new Array(count).fill(false));
45
+ const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
46
+ createLoadingStateObservable
47
+ );
48
+
49
+ const arePreviousComponentsLoaded = React.useCallback((index) => {
50
+ if (index === 0) {
51
+ return true;
52
+ }
43
53
 
44
- const handleComponentLoaded = React.useCallback((index) => {
45
- dispatch({ payload: index });
54
+ const componentsBefore = slice(0, index, componentStateRef.current);
55
+
56
+ return componentsBefore.every(T);
46
57
  }, []);
47
58
 
59
+ const dispatch = React.useCallback(({ payload }) => {
60
+ const newState = reducer(componentStateRef.current, { payload });
61
+ componentStateRef.current = newState;
62
+ const isDone = arePreviousComponentsLoaded(count - 1);
63
+
64
+ const state = loadingState.current.getValue();
65
+
66
+ const newLoadingState = {
67
+ ...state,
68
+ index: state.index < payload ? payload : state.index,
69
+ done: isDone,
70
+ };
71
+
72
+ loadingState.current.next(newLoadingState);
73
+
74
+ if (isDone) {
75
+ onLoadDone();
76
+ }
77
+ }, []);
78
+
79
+ const handleComponentLoaded = React.useCallback(
80
+ (index) => dispatch({ payload: index }),
81
+ []
82
+ );
83
+
48
84
  const handleComponentLoadErrorWhenNeedToFail = React.useCallback(
49
85
  ({ error }) => {
50
86
  if (error !== loadingError) {
@@ -55,35 +91,26 @@ export const useLoadingState = (count: number): Return => {
55
91
  );
56
92
 
57
93
  const handleComponentLoadErrorWhenNoNeedToFail = React.useCallback(
58
- ({ index }) => {
59
- handleComponentLoaded(index);
60
- },
94
+ ({ index }) => handleComponentLoaded(index),
61
95
  []
62
96
  );
63
97
 
64
- const arePreviousComponentsLoaded = React.useCallback(
65
- (index) => {
66
- if (index === 0) {
67
- return true;
68
- }
69
-
70
- const componentsBefore = R.slice(0, index, componentsState);
71
-
72
- return allTrue(componentsBefore);
73
- },
74
- [componentsState]
98
+ return React.useMemo(
99
+ () => ({
100
+ loadingState: loadingState.current,
101
+ onLoadFinished: handleComponentLoaded,
102
+ onLoadFailed: SHOULD_FAIL_ON_COMPONENT_LOADING
103
+ ? handleComponentLoadErrorWhenNeedToFail
104
+ : handleComponentLoadErrorWhenNoNeedToFail,
105
+ shouldShowLoadingError: SHOULD_FAIL_ON_COMPONENT_LOADING && loadingError,
106
+ arePreviousComponentsLoaded,
107
+ }),
108
+ [
109
+ loadingError,
110
+ handleComponentLoaded,
111
+ handleComponentLoadErrorWhenNeedToFail,
112
+ handleComponentLoadErrorWhenNoNeedToFail,
113
+ arePreviousComponentsLoaded,
114
+ ]
75
115
  );
76
-
77
- return {
78
- isAnyLoading: anyFalse(componentsState),
79
- isAllLoaded: allTrue(componentsState),
80
- onLoadFinished: handleComponentLoaded,
81
- onLoadFailed: SHOULD_FAIL_ON_COMPONENT_LOADING
82
- ? handleComponentLoadErrorWhenNeedToFail
83
- : handleComponentLoadErrorWhenNoNeedToFail,
84
- shouldShowLoadingError: SHOULD_FAIL_ON_COMPONENT_LOADING && loadingError,
85
- isAnyLoaded: anyTrue(componentsState),
86
- waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
87
- arePreviousComponentsLoaded,
88
- };
89
116
  };
@@ -9,7 +9,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
9
9
  import { useLocalizedStrings } from "@applicaster/zapp-react-native-utils/localizationUtils";
10
10
  import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";
11
11
  import { useSendAnalyticsEventWithFunction } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
12
- import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
12
+ import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useCurrentScreenData";
13
13
  import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
14
14
  import { useDispatch } from "react-redux";
15
15
  import { useShallow } from "zustand/react/shallow";