@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1124981321 → 13.0.0-alpha.1173186260

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 (157) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -4
  3. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  6. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  8. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  9. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  11. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  12. package/Components/AudioPlayer/helpers.tsx +1 -1
  13. package/Components/BaseFocusable/index.tsx +1 -2
  14. package/Components/Cell/Cell.tsx +4 -13
  15. package/Components/Cell/CellWithFocusable.tsx +50 -59
  16. package/Components/Cell/CellWrapper.tsx +18 -0
  17. package/Components/Cell/TvOSCellComponent.tsx +20 -22
  18. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  19. package/Components/Cell/index.js +3 -1
  20. package/Components/Cell/styles.ts +17 -0
  21. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  22. package/Components/CellRendererResolver/index.ts +2 -1
  23. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  24. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  25. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  26. package/Components/ErrorScreen/index.tsx +14 -6
  27. package/Components/Focusable/Focusable.tsx +1 -0
  28. package/Components/Focusable/FocusableTvOS.tsx +5 -1
  29. package/Components/Focusable/index.android.tsx +10 -3
  30. package/Components/FocusableCell/index.tsx +1 -1
  31. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  32. package/Components/FocusableGroup/index.tsx +0 -3
  33. package/Components/FocusableList/index.tsx +26 -9
  34. package/Components/FocusableScrollView/index.tsx +43 -13
  35. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  36. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
  37. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  38. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  39. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  40. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  41. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  42. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  43. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  44. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
  45. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
  46. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  47. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  48. package/Components/Layout/TV/index.tsx +6 -20
  49. package/Components/Layout/TV/index.web.tsx +4 -1
  50. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  51. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  52. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  53. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  54. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  55. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  56. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  57. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  58. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  59. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  60. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  61. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  62. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  63. package/Components/MasterCell/utils/index.ts +8 -134
  64. package/Components/ModalComponent/BottomSheetModalContent.tsx +59 -43
  65. package/Components/ModalComponent/Button/Item.tsx +6 -5
  66. package/Components/ModalComponent/Button/assets.ts +1 -1
  67. package/Components/ModalComponent/Button/index.tsx +45 -62
  68. package/Components/ModalComponent/Header/index.tsx +12 -11
  69. package/Components/ModalComponent/utils.ts +55 -7
  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/utils/index.ts +1 -1
  74. package/Components/PlayerContainer/PlayerContainer.tsx +42 -15
  75. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  76. package/Components/PlayerImageBackground/index.tsx +1 -1
  77. package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
  78. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  79. package/Components/River/RiverFooter.tsx +39 -9
  80. package/Components/River/RiverItem.tsx +39 -3
  81. package/Components/River/TV/index.tsx +6 -1
  82. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
  83. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  84. package/Components/River/__tests__/componentsMap.test.js +3 -4
  85. package/Components/River/__tests__/river.test.js +75 -40
  86. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  87. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  88. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  89. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  90. package/Components/Screen/TV/index.web.tsx +5 -6
  91. package/Components/Screen/__tests__/Screen.test.tsx +22 -14
  92. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
  93. package/Components/Screen/hooks.ts +3 -6
  94. package/Components/Screen/index.tsx +4 -4
  95. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  96. package/Components/Tabs/Tab.tsx +5 -3
  97. package/Components/TextInputTv/index.tsx +2 -1
  98. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  99. package/Components/TrackedView/index.tsx +1 -0
  100. package/Components/Transitioner/AnimationManager.js +15 -15
  101. package/Components/Transitioner/Scene.tsx +1 -1
  102. package/Components/Transitioner/Transitioner.tsx +3 -3
  103. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  104. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
  105. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  106. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  107. package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
  108. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  109. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  110. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +46 -30
  111. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  112. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +45 -21
  113. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +12 -6
  114. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  115. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  116. package/Components/VideoModal/ModalAnimation/index.ts +2 -0
  117. package/Components/VideoModal/ModalAnimation/utils.ts +30 -0
  118. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  119. package/Components/VideoModal/PlayerWrapper.tsx +37 -24
  120. package/Components/VideoModal/VideoModal.tsx +19 -4
  121. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  122. package/Components/VideoModal/utils.ts +3 -4
  123. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  124. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  125. package/Components/Viewport/__tests__/utils.test.js +5 -4
  126. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  127. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  128. package/Components/ZappUIComponent/index.tsx +4 -17
  129. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  130. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  131. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  132. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  133. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  134. package/Contexts/ScreenContext/index.tsx +3 -10
  135. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  136. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  137. package/Decorators/Navigator/index.tsx +1 -1
  138. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  139. package/Decorators/RiverResolver/index.tsx +6 -8
  140. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  141. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  142. package/package.json +7 -11
  143. package/tsconfig.json +2 -3
  144. package/.babelrc +0 -8
  145. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  146. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  147. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  148. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  149. package/Components/Cell/CellStyles/colors.js +0 -40
  150. package/Components/Cell/CellStyles/index.js +0 -15
  151. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  152. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  153. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  154. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  155. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  156. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  157. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,9 +1,5 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { ScreenLayoutContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenLayoutContext";
4
- import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
5
- import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
6
- import { useScreenConfiguration } from "../../River/useScreenConfiguration";
2
+ import { StyleSheet, View } from "react-native";
7
3
 
8
4
  type Props = {
9
5
  children: React.ReactNode;
@@ -12,33 +8,33 @@ type Props = {
12
8
  };
13
9
 
14
10
  const styles = StyleSheet.create({
15
- container: { position: "absolute", top: 0, zIndex: 10, width: 1920 },
11
+ container: {
12
+ position: "absolute",
13
+ top: 0,
14
+ zIndex: 10,
15
+ flex: 1,
16
+ width: "100%",
17
+ },
18
+ themeStyles: {
19
+ // limits the height of the focusable container of the TopMenuBarTV component
20
+ // to prevent it from being overlapped by the screen content,
21
+ // as it makes TopMenuBarTV unfocusable on tvOS
22
+ maxHeight: 1,
23
+ },
16
24
  });
17
25
 
18
26
  export const NavBarContainer = ({ children, isVisible, onReady }: Props) => {
19
- const screenLayout = React.useContext(ScreenLayoutContext);
20
- const screenMarginTop = screenLayout?.screenMarginTop || 0;
21
- const screen = useCurrentScreenData();
22
- const screenConfig = useScreenConfiguration(screen?.id);
23
-
24
- const themeStyles = React.useMemo(
25
- () => ({
26
- // limits the height of the focusable container of the TopMenuBarTV component
27
- // to prevent it from being overlapped by the screen content,
28
- // as it makes TopMenuBarTV unfocusable on tvOS
29
- maxHeight: ifEmptyUseFallback(screenConfig?.marginTop, screenMarginTop),
30
- }),
31
- [screenLayout, screenConfig]
32
- );
33
-
34
27
  React.useEffect(() => {
35
28
  setTimeout(() => {
36
29
  onReady?.(true);
37
30
  }, 0);
38
- }, []);
31
+ }, [onReady]);
39
32
 
40
33
  return isVisible ? (
41
- <View testID="nav-bar-container" style={[styles.container, themeStyles]}>
34
+ <View
35
+ testID="nav-bar-container"
36
+ style={[styles.container, styles.themeStyles]}
37
+ >
42
38
  {children}
43
39
  </View>
44
40
  ) : null;
@@ -22,7 +22,6 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
22
22
  import { NavBarContainer } from "./NavBarContainer";
23
23
 
24
24
  type ComponentsExtraProps = {
25
- Background?: Record<string, any>;
26
25
  NavBar?: Record<string, any>;
27
26
  };
28
27
 
@@ -55,8 +54,11 @@ export const ScreenContainer = React.memo(function ScreenContainer({
55
54
  ComponentsExtraProps,
56
55
  NavBar,
57
56
  }: Props) {
58
- const { screenMarginBottom } = React.useContext(ScreenLayoutContext);
57
+ const { screenMarginBottom, resetScreenLayout } =
58
+ React.useContext(ScreenLayoutContext);
59
+
59
60
  const { currentRoute, screenData } = useNavigation();
61
+
60
62
  const screen = useCurrentScreenData();
61
63
 
62
64
  const { marginBottom, backgroundColor, paddingTop, paddingBottom } =
@@ -65,6 +67,10 @@ export const ScreenContainer = React.memo(function ScreenContainer({
65
67
  const theme = useTheme();
66
68
  const getThemeValue = React.useCallback(R.propOr(0, R.__, theme), [theme]);
67
69
 
70
+ React.useEffect(() => {
71
+ resetScreenLayout();
72
+ }, [currentRoute]);
73
+
68
74
  const fullscreen = React.useCallback(
69
75
  displayFullScreen({ currentRoute, screenData }),
70
76
  [currentRoute, screenData]
@@ -60,10 +60,15 @@ export function ScreenLayoutContextProvider(props: {
60
60
  initialState
61
61
  );
62
62
 
63
+ const resetScreenLayout = React.useCallback(() => {
64
+ setScreenLayout(initialState);
65
+ }, [initialState]);
66
+
63
67
  const screenLayoutValue = React.useMemo(
64
68
  () => ({
65
69
  ...screenLayout,
66
70
  setScreenLayout,
71
+ resetScreenLayout,
67
72
  }),
68
73
  [screenLayout]
69
74
  );
@@ -56,11 +56,12 @@ describe("ScreenContainer", () => {
56
56
  };
57
57
 
58
58
  const setScreenLayout = () => {};
59
+ const resetScreenLayout = () => {};
59
60
 
60
61
  const wrapper = ({ children }) => (
61
62
  <WrappedWithProviders>
62
63
  <ScreenLayoutContext.Provider
63
- value={{ ...screenLayout, setScreenLayout }}
64
+ value={{ ...screenLayout, setScreenLayout, resetScreenLayout }}
64
65
  >
65
66
  <ScreenContainer NavBar={View}>{children}</ScreenContainer>
66
67
  </ScreenLayoutContext.Provider>
@@ -5,13 +5,14 @@ exports[`NavBarContainer renders 1`] = `
5
5
  style={
6
6
  [
7
7
  {
8
+ "flex": 1,
8
9
  "position": "absolute",
9
10
  "top": 0,
10
- "width": 1920,
11
+ "width": "100%",
11
12
  "zIndex": 10,
12
13
  },
13
14
  {
14
- "maxHeight": 10,
15
+ "maxHeight": 1,
15
16
  },
16
17
  ]
17
18
  }
@@ -16,13 +16,14 @@ exports[`ScreenContainer renders 1`] = `
16
16
  style={
17
17
  [
18
18
  {
19
+ "flex": 1,
19
20
  "position": "absolute",
20
21
  "top": 0,
21
- "width": 1920,
22
+ "width": "100%",
22
23
  "zIndex": 10,
23
24
  },
24
25
  {
25
- "maxHeight": 10,
26
+ "maxHeight": 1,
26
27
  },
27
28
  ]
28
29
  }
@@ -2,18 +2,23 @@
2
2
 
3
3
  exports[`Layout TV renders 1`] = `
4
4
  <View
5
- excludeFromFocusSearching={true}
6
- id="/river/A1234"
7
- preferredFocus={true}
5
+ backgroundColor="#000000"
6
+ testID="background-component"
8
7
  >
9
8
  <View
10
- Components={
11
- {
12
- "Background": [Function],
13
- "NavBar": [Function],
9
+ excludeFromFocusSearching={true}
10
+ id="/river/A1234"
11
+ preferredFocus={true}
12
+ >
13
+ <View
14
+ Components={
15
+ {
16
+ "Background": [Function],
17
+ "NavBar": [Function],
18
+ }
14
19
  }
15
- }
16
- route="/river/A1234"
17
- />
20
+ route="/river/A1234"
21
+ />
22
+ </View>
18
23
  </View>
19
24
  `;
@@ -5,6 +5,14 @@ import { render } from "@testing-library/react-native";
5
5
  import { Provider } from "react-redux";
6
6
  import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
7
7
  import configureStore from "redux-mock-store";
8
+ import Layout from "../index.web";
9
+
10
+ // mock useTheme to provide app_background_color
11
+ jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
12
+ useTheme: () => ({
13
+ app_background_color: "#000000",
14
+ }),
15
+ }));
8
16
 
9
17
  const withoutChildren = omit(["children"]);
10
18
 
@@ -16,8 +24,6 @@ jest.mock("../../../Screen/TV/index.web", () => {
16
24
  };
17
25
  });
18
26
 
19
- const Layout = require("../index.web").default;
20
-
21
27
  const mockStore = configureStore()({
22
28
  appState: { appReady: true },
23
29
  });
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import * as R from "ramda";
3
2
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
3
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
5
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
6
4
 
7
- import { getBackgroundImageUrl } from "../utils";
8
5
  import { LayoutContainer } from "./LayoutContainer";
9
6
  import { ScreenContainer } from "./ScreenContainer";
10
7
 
@@ -12,6 +9,7 @@ import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
12
9
  import { PathnameContext } from "../../../Contexts/PathnameContext";
13
10
  import { ScreenDataContext } from "../../../Contexts/ScreenDataContext";
14
11
  import { ScreenContextProvider } from "../../../Contexts/ScreenContext";
12
+ import { LayoutBackground } from "./LayoutBackground";
15
13
 
16
14
  type Components = {
17
15
  NavBar: React.ComponentType<any>;
@@ -19,7 +17,6 @@ type Components = {
19
17
  };
20
18
 
21
19
  type ComponentsExtraProps = {
22
- Background?: Record<string, any>;
23
20
  NavBar?: Record<string, any>;
24
21
  };
25
22
 
@@ -31,17 +28,10 @@ type Props = {
31
28
 
32
29
  const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
33
30
  const navigator = useNavigation();
34
- const theme = useTheme();
35
31
 
36
- const { appState: { appReady = false } = {}, remoteConfigurations } =
37
- usePickFromState(["appState", "remoteConfigurations", "plugins"]);
38
-
39
- const backgroundColor = React.useMemo(() => theme.app_background_color, []);
40
-
41
- const backgroundImageUrl = React.useMemo(
42
- () => getBackgroundImageUrl(remoteConfigurations),
43
- [remoteConfigurations]
44
- );
32
+ const { appState: { appReady = false } = {} } = usePickFromState([
33
+ "appState",
34
+ ]);
45
35
 
46
36
  if (!appReady) {
47
37
  return null;
@@ -50,11 +40,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
50
40
  return (
51
41
  <LayoutContainer>
52
42
  <ScreenLayoutContextProvider>
53
- <Components.Background
54
- backgroundColor={backgroundColor}
55
- backgroundImageUrl={backgroundImageUrl}
56
- {...R.omit(["ref"])(ComponentsExtraProps?.Background)}
57
- >
43
+ <LayoutBackground Background={Components.Background}>
58
44
  <ScreenDataContext.Provider value={navigator.data}>
59
45
  <PathnameContext.Provider value={navigator.currentRoute}>
60
46
  <ScreenContextProvider pathname={navigator.currentRoute}>
@@ -67,7 +53,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
67
53
  </ScreenContextProvider>
68
54
  </PathnameContext.Provider>
69
55
  </ScreenDataContext.Provider>
70
- </Components.Background>
56
+ </LayoutBackground>
71
57
  </ScreenLayoutContextProvider>
72
58
  </LayoutContainer>
73
59
  );
@@ -5,6 +5,7 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
5
 
6
6
  import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
7
7
  import { StackNavigator } from "../../Navigator";
8
+ import { LayoutBackground } from "./LayoutBackground";
8
9
 
9
10
  type Components = {
10
11
  NavBar: React.ComponentType<any>;
@@ -25,7 +26,9 @@ const Layout = ({ Components }: Props) => {
25
26
 
26
27
  return (
27
28
  <ScreenLayoutContextProvider>
28
- <StackNavigator Components={Components} />
29
+ <LayoutBackground Background={Components.Background}>
30
+ <StackNavigator Components={Components} />
31
+ </LayoutBackground>
29
32
  </ScreenLayoutContextProvider>
30
33
  );
31
34
  };
@@ -4,7 +4,6 @@ import { TouchableOpacity, ViewStyle } from "react-native";
4
4
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
5
5
 
6
6
  import Image from "./Image";
7
-
8
7
  type Props = {
9
8
  item: ZappEntry | ZappFeed;
10
9
  flavour?: "flavour_1" | "flavour_2";
@@ -69,7 +68,7 @@ export function ActionButton(props: Props) {
69
68
  if (!((actionDisabled || !actionContext) && actionState !== null)) {
70
69
  setActionState(actionContext.initialEntryState(item));
71
70
  }
72
- }, [actionDisabled, item?.id, actionContext, action]);
71
+ }, [actionDisabled, item?.id, actionContext, action, setActionState]);
73
72
 
74
73
  const onPress = useCallback(() => {
75
74
  actionContext.invokeAction(item, {
@@ -85,7 +84,7 @@ export function ActionButton(props: Props) {
85
84
  setActionState(state);
86
85
  });
87
86
  }
88
- }, [item?.id]);
87
+ }, [item?.id, setActionState, actionContext]);
89
88
 
90
89
  if (actionDisabled || !actionContext) return null;
91
90
  const AssetComponent = actionState?.asset;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Image as RnImage, ImageStyle } from "react-native";
3
- import * as R from "ramda";
3
+ import { equals, omit } from "ramda";
4
4
 
5
5
  import { useImageSource } from "./hooks";
6
6
 
@@ -17,7 +17,7 @@ type Props = Record<string, any> & {
17
17
  withDimensions: (source: Source) => Source;
18
18
  };
19
19
 
20
- const MemoizedImage = React.memo(RnImage, R.equals);
20
+ const MemoizedImage = React.memo(RnImage, equals);
21
21
 
22
22
  function Image({
23
23
  style,
@@ -44,11 +44,12 @@ function Image({
44
44
 
45
45
  return (
46
46
  <MemoizedImage
47
+ key={_source?.uri || "no-image"}
47
48
  style={style as ImageStyle}
48
49
  onError={React.useCallback(() => setErrorState(true), [])}
49
50
  // as we have defaults as "" for placeholder image, we need to pass undefined to source to not throw warnings
50
51
  source={_source?.uri ? _source : undefined}
51
- {...R.omit(["source"], otherProps)}
52
+ {...omit(["source"], otherProps)}
52
53
  />
53
54
  );
54
55
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as R from "ramda";
2
+ import { path } from "ramda";
3
3
 
4
4
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
@@ -7,9 +7,13 @@ import { extractAsset } from "./utils";
7
7
 
8
8
  type Return = { uri: string } | null;
9
9
 
10
+ const getSourceContext = path(["source", "context"]);
11
+ const getSourceUri = path(["source", "uri"]);
12
+ const getState = path(["state"]);
13
+
10
14
  export const useImageSource = ({ uri, entry, otherProps }): Return => {
11
- const uriContext = R.path(["source", "context"], otherProps);
12
- const uriState = R.path(["state"], otherProps);
15
+ const uriContext = getSourceContext(otherProps);
16
+ const uriState = getState(otherProps);
13
17
 
14
18
  const action = useActions(uriContext);
15
19
 
@@ -34,7 +38,7 @@ export const useImageSource = ({ uri, entry, otherProps }): Return => {
34
38
  return { uri };
35
39
  }
36
40
 
37
- const uriFromSource = R.path(["source", "uri"], otherProps);
41
+ const uriFromSource = getSourceUri(otherProps);
38
42
 
39
43
  if (uriFromSource) {
40
44
  return { uri: uriFromSource };
@@ -56,7 +60,7 @@ const getSource = (uri, showDefault, placeholderImage, otherProps) => {
56
60
  return { uri };
57
61
  }
58
62
 
59
- const uriFromSource = R.path(["source", "uri"], otherProps);
63
+ const uriFromSource = getSourceUri(otherProps);
60
64
 
61
65
  if (uriFromSource) {
62
66
  return { uri: uriFromSource };
@@ -72,8 +76,8 @@ export const useImageSourceWithDefault = ({
72
76
  placeholderImage,
73
77
  otherProps,
74
78
  }): Return => {
75
- const uriContext = R.path(["source", "context"], otherProps);
76
- const uriState = R.path(["state"], otherProps);
79
+ const uriContext = getSourceContext(otherProps);
80
+ const uriState = getState(otherProps);
77
81
 
78
82
  const action = useActions(uriContext);
79
83
 
@@ -244,7 +244,7 @@ const LiveImageComponent = (props: LiveImageProps) => {
244
244
  return (
245
245
  <>
246
246
  <Image {...props} applyMaxSize />
247
- {isShouldRender && (
247
+ {isShouldRender ? (
248
248
  <View style={[style, positionAbsolute]}>
249
249
  <PlayerLiveImage
250
250
  uri={props.uri}
@@ -257,7 +257,7 @@ const LiveImageComponent = (props: LiveImageProps) => {
257
257
  audioMutedByDefault={audio_muted_by_default}
258
258
  />
259
259
  </View>
260
- )}
260
+ ) : null}
261
261
  </>
262
262
  );
263
263
  };
@@ -0,0 +1,3 @@
1
+ export const PREFIX = "tv_buttons";
2
+
3
+ export const BUTTON_PREFIX = `${PREFIX}_button`;
@@ -1,4 +1,4 @@
1
- import * as R from "ramda";
1
+ import { times } from "@applicaster/zapp-react-native-utils/utils";
2
2
  import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
3
3
 
4
4
  import { Button } from "./Button";
@@ -9,13 +9,14 @@ import {
9
9
  } from "./utils";
10
10
 
11
11
  import { compact } from "@applicaster/zapp-react-native-utils/cellUtils";
12
+ import { PREFIX, BUTTON_PREFIX } from "./const";
12
13
 
13
14
  export {
14
15
  insertButtonsBetweenLabels,
15
16
  insertButtonsBetweenLabelContainers,
16
17
  } from "./utils";
17
18
 
18
- const PREFIX = "tv_buttons";
19
+ const buttonId = (index: number) => `${BUTTON_PREFIX}_${index}`;
19
20
 
20
21
  type Props = {
21
22
  value: Function;
@@ -42,7 +43,6 @@ export const TvActionButtons = ({
42
43
  return null;
43
44
  }
44
45
 
45
- const prefix1Button = `${PREFIX}_button_1`;
46
46
  const independentStyles = value(`${PREFIX}_container_independent_styles`);
47
47
 
48
48
  return {
@@ -73,11 +73,11 @@ export const TvActionButtons = ({
73
73
  buttonsCount,
74
74
  },
75
75
  elements: compact(
76
- R.times((index) => {
77
- const prefixSpecificButton = `${PREFIX}_button_${index + 1}`;
76
+ times((index) => {
77
+ const prefixSpecificButton = buttonId(index + 1);
78
78
 
79
79
  return Button({
80
- prefix: independentStyles ? prefixSpecificButton : prefix1Button,
80
+ prefix: independentStyles ? prefixSpecificButton : buttonId(1),
81
81
  value,
82
82
  platformValue,
83
83
  pluginIdentifier: getPluginIdentifier(configuration, PREFIX, index),
@@ -34,7 +34,6 @@ export const useFillInPercent = (entry: ZappEntry): number => {
34
34
  React.useState<number>(DEFAULT_FILL);
35
35
 
36
36
  React.useEffect(() => {
37
- // setup progress in UI on mount
38
37
  getProgressValue(action, entry, (progress) => {
39
38
  setFillInPercent(progress);
40
39
  });
@@ -45,17 +44,12 @@ export const useFillInPercent = (entry: ZappEntry): number => {
45
44
  return;
46
45
  }
47
46
 
48
- // refresh progress in UI when it was changed in CW
49
- const unsubscribe = action?.addDataSourceListener?.(() => {
47
+ return action?.addDataSourceListener?.(() => {
50
48
  getProgressValue(action, entry, (progress) => {
51
49
  setFillInPercent(progress);
52
50
  });
53
51
  });
54
-
55
- return () => {
56
- unsubscribe?.();
57
- };
58
- }, [isActive]);
52
+ }, [isActive, action, entry, setFillInPercent]);
59
53
 
60
54
  return fillInPercent;
61
55
  };
@@ -3,12 +3,10 @@
3
3
  exports[`elementMapper renders the nodes 1`] = `
4
4
  <View>
5
5
  <View
6
- key="View_0"
7
6
  testProp={true}
8
7
  viewProp={true}
9
8
  >
10
- <ImageContainer
11
- key="0"
9
+ <View
12
10
  style={
13
11
  {
14
12
  "borderTopLeftRadius": 4,
@@ -20,7 +18,6 @@ exports[`elementMapper renders the nodes 1`] = `
20
18
  uri="http://urlOfTheImage.net/img.png"
21
19
  />
22
20
  <View
23
- key="1"
24
21
  style={
25
22
  {
26
23
  "height": 30,
@@ -32,8 +29,7 @@ exports[`elementMapper renders the nodes 1`] = `
32
29
  testProp={true}
33
30
  viewProp={true}
34
31
  >
35
- <_Text
36
- key="0"
32
+ <View
37
33
  label="Test Entry"
38
34
  numberOfLines={1}
39
35
  style={
@@ -47,7 +43,6 @@ exports[`elementMapper renders the nodes 1`] = `
47
43
  />
48
44
  </View>
49
45
  <View
50
- key="2"
51
46
  style={
52
47
  {
53
48
  "height": 60,
@@ -58,8 +53,7 @@ exports[`elementMapper renders the nodes 1`] = `
58
53
  }
59
54
  testProp={true}
60
55
  >
61
- <_Text
62
- key="0"
56
+ <View
63
57
  label="Summary of the test entry"
64
58
  numberOfLines={2}
65
59
  style={
@@ -74,7 +68,6 @@ exports[`elementMapper renders the nodes 1`] = `
74
68
  />
75
69
  </View>
76
70
  <View
77
- key="3"
78
71
  style={
79
72
  {
80
73
  "height": 42,
@@ -85,8 +78,7 @@ exports[`elementMapper renders the nodes 1`] = `
85
78
  testProp={true}
86
79
  viewProp={true}
87
80
  >
88
- <ImageContainer
89
- key="0"
81
+ <View
90
82
  style={
91
83
  {
92
84
  "height": 42,