@applicaster/zapp-react-native-ui-components 13.0.0-rc.10 → 13.0.0-rc.100

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 (209) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  3. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  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/AudioPlayer/helpers.tsx +1 -0
  19. package/Components/BaseFocusable/index.ios.ts +1 -1
  20. package/Components/BaseFocusable/index.tsx +67 -31
  21. package/Components/Cell/Cell.tsx +18 -22
  22. package/Components/Cell/CellWithFocusable.tsx +51 -60
  23. package/Components/Cell/CellWrapper.tsx +18 -0
  24. package/Components/Cell/TvOSCellComponent.tsx +23 -30
  25. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  26. package/Components/Cell/index.js +3 -1
  27. package/Components/Cell/styles.ts +17 -0
  28. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  29. package/Components/CellRendererResolver/index.ts +2 -1
  30. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  31. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  32. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  33. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  34. package/Components/ErrorScreen/index.tsx +14 -6
  35. package/Components/Focusable/Focusable.tsx +1 -54
  36. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  37. package/Components/Focusable/Touchable.tsx +19 -20
  38. package/Components/Focusable/index.android.tsx +10 -3
  39. package/Components/FocusableCell/index.tsx +1 -1
  40. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  41. package/Components/FocusableGroup/index.tsx +0 -3
  42. package/Components/FocusableList/index.tsx +26 -10
  43. package/Components/FocusableScrollView/index.tsx +43 -13
  44. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
  45. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
  46. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  47. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  48. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  49. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  50. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  51. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
  52. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  53. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  54. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  55. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  56. package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
  57. package/Components/Layout/TV/index.tsx +6 -20
  58. package/Components/Layout/TV/index.web.tsx +4 -1
  59. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  60. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  61. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  62. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
  63. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  64. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  65. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  66. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  67. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  68. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  69. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  70. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  71. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  72. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  73. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  74. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  75. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  76. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  77. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  78. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  79. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  80. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  81. package/Components/MasterCell/utils/index.ts +9 -135
  82. package/Components/ModalComponent/BottomSheetModalContent.tsx +45 -19
  83. package/Components/ModalComponent/Button/Item.tsx +6 -5
  84. package/Components/ModalComponent/Button/assets.ts +1 -1
  85. package/Components/ModalComponent/Button/index.tsx +30 -43
  86. package/Components/ModalComponent/Header/index.tsx +3 -3
  87. package/Components/ModalComponent/utils.ts +55 -7
  88. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  89. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  90. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  91. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  92. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  93. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  94. package/Components/OfflineHandler/utils/index.ts +1 -1
  95. package/Components/PlayerContainer/PlayerContainer.tsx +45 -25
  96. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  97. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  98. package/Components/PlayerImageBackground/index.tsx +1 -1
  99. package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
  100. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  101. package/Components/River/RefreshControl.tsx +1 -1
  102. package/Components/River/RiverFooter.tsx +39 -9
  103. package/Components/River/RiverItem.tsx +39 -3
  104. package/Components/River/TV/index.tsx +6 -1
  105. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
  106. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  107. package/Components/River/__tests__/componentsMap.test.js +64 -17
  108. package/Components/River/__tests__/river.test.js +75 -40
  109. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +12 -5
  110. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  111. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  112. package/Components/Screen/TV/index.web.tsx +5 -6
  113. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  114. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  115. package/Components/Screen/hooks.ts +53 -0
  116. package/Components/Screen/index.tsx +16 -42
  117. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  118. package/Components/Tabs/Tab.tsx +12 -9
  119. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  120. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  121. package/Components/TextInputTv/index.tsx +6 -5
  122. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  123. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  124. package/Components/TrackedView/index.tsx +1 -0
  125. package/Components/Transitioner/AnimationManager.js +15 -15
  126. package/Components/Transitioner/Scene.tsx +53 -24
  127. package/Components/Transitioner/Transitioner.tsx +3 -3
  128. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  129. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  130. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  131. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  132. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  133. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  134. package/Components/Transitioner/index.js +8 -4
  135. package/Components/VideoLive/LiveImageManager.ts +27 -1
  136. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  137. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  138. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
  139. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  140. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
  141. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  142. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -22
  143. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +15 -15
  144. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  145. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  146. package/Components/VideoModal/ModalAnimation/index.ts +4 -1
  147. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  148. package/Components/VideoModal/ModalAnimation/utils.ts +38 -2
  149. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  150. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  151. package/Components/VideoModal/PlayerWrapper.tsx +43 -39
  152. package/Components/VideoModal/VideoModal.tsx +17 -11
  153. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  154. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  155. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  156. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  157. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  158. package/Components/VideoModal/hooks/index.ts +7 -0
  159. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  160. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  161. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  162. package/Components/VideoModal/utils.ts +6 -9
  163. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  164. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  165. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  166. package/Components/Viewport/__tests__/utils.test.js +5 -4
  167. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  168. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  169. package/Components/ZappUIComponent/index.tsx +4 -17
  170. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  171. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  172. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  173. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  174. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  175. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  176. package/Contexts/ScreenContext/index.tsx +6 -12
  177. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  178. package/Decorators/Analytics/{index.js → index.tsx} +11 -11
  179. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  180. package/Decorators/Navigator/index.tsx +1 -1
  181. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  182. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  183. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  184. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  185. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  186. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  187. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  188. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  189. package/Decorators/RiverResolver/index.tsx +6 -8
  190. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  191. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  192. package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
  193. package/package.json +13 -11
  194. package/tsconfig.json +2 -3
  195. package/.babelrc +0 -8
  196. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  197. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  198. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  199. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  200. package/Components/Cell/CellStyles/colors.js +0 -40
  201. package/Components/Cell/CellStyles/index.js +0 -15
  202. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  203. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  204. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  205. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  206. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  207. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  208. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  209. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -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
 
@@ -0,0 +1,93 @@
1
+ import { ImageBorderContainer } from "../index";
2
+ import { getImageContainerMarginStyles } from "@applicaster/zapp-react-native-utils/cellUtils";
3
+
4
+ const mockValue = (key) => {
5
+ const values = {
6
+ cell_padding_top: 1,
7
+ cell_padding_left: 2,
8
+ cell_padding_right: 3,
9
+ cell_padding_bottom: 4,
10
+ image_border_size: 5,
11
+ image_focused_border_color: "red",
12
+ image_selected_border_color: "blue",
13
+ image_focused_selected_border_color: "green",
14
+ image_border_color: "black",
15
+ image_corner_radius: 10,
16
+ image_border_position: "outside",
17
+ image_border_padding_top: 6,
18
+ image_border_padding_right: 7,
19
+ image_border_padding_bottom: 8,
20
+ image_border_padding_left: 9,
21
+ image_margin_top: 11,
22
+ image_margin_left: 12,
23
+ image_margin_right: 13,
24
+ image_margin_bottom: 14,
25
+ };
26
+
27
+ return values[key] || 0;
28
+ };
29
+
30
+ describe("ImageBorderContainer", () => {
31
+ it("calculates style properties correctly", () => {
32
+ const marginStyles = getImageContainerMarginStyles({ value: mockValue });
33
+
34
+ expect(marginStyles.marginTop).toBe(11);
35
+ expect(marginStyles.marginLeft).toBe(12);
36
+ expect(marginStyles.marginRight).toBe(13);
37
+ expect(marginStyles.marginBottom).toBe(14);
38
+
39
+ const props = {
40
+ value: mockValue,
41
+ state: "default",
42
+ imageStyles: {},
43
+ };
44
+
45
+ const result = ImageBorderContainer(props);
46
+
47
+ expect(result.style.marginTop).toBe(12); // 11 + 1
48
+ expect(result.style.marginLeft).toBe(14); // 12 + 2
49
+ expect(result.style.marginRight).toBe(16); // 13 + 3
50
+ expect(result.style.marginBottom).toBe(18); // 14 + 4
51
+ expect(result.style.borderWidth).toBe(5);
52
+ expect(result.style.borderColor).toBe("black");
53
+ expect(result.style.borderRadius).toBe(10);
54
+ expect(result.additionalProps.borderPosition).toBe("outside");
55
+ expect(result.additionalProps.borderPaddingTop).toBe(6);
56
+ expect(result.additionalProps.borderPaddingRight).toBe(7);
57
+ expect(result.additionalProps.borderPaddingBottom).toBe(8);
58
+ expect(result.additionalProps.borderPaddingLeft).toBe(9);
59
+ });
60
+
61
+ it("handles focused state correctly", () => {
62
+ const props = {
63
+ value: mockValue,
64
+ state: "focused",
65
+ imageStyles: {},
66
+ };
67
+
68
+ const result = ImageBorderContainer(props);
69
+ expect(result.style.borderColor).toBe("red");
70
+ });
71
+
72
+ it("handles selected state correctly", () => {
73
+ const props = {
74
+ value: mockValue,
75
+ state: "selected",
76
+ imageStyles: {},
77
+ };
78
+
79
+ const result = ImageBorderContainer(props);
80
+ expect(result.style.borderColor).toBe("blue");
81
+ });
82
+
83
+ it("handles focused and selected state correctly", () => {
84
+ const props = {
85
+ value: mockValue,
86
+ state: "focused_selected",
87
+ imageStyles: {},
88
+ };
89
+
90
+ const result = ImageBorderContainer(props);
91
+ expect(result.style.borderColor).toBe("green");
92
+ });
93
+ });
@@ -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
  };
@@ -6,7 +6,7 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
6
6
  <View
7
7
  onLayout={[Function]}
8
8
  style={
9
- Object {
9
+ {
10
10
  "borderRadius": 10,
11
11
  "height": 100,
12
12
  "width": 100,
@@ -16,12 +16,12 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
16
16
  <Image
17
17
  onAsyncRender={[Function]}
18
18
  source={
19
- Object {
19
+ {
20
20
  "uri": "",
21
21
  }
22
22
  }
23
23
  style={
24
- Object {
24
+ {
25
25
  "aspectRatio": 1,
26
26
  "borderRadius": 10,
27
27
  "height": 100,
@@ -17,7 +17,7 @@ const SECONDARY_IMAGE_PREFIX = "secondary_image";
17
17
 
18
18
  type ImageSizing = typeof IMAGE_SIZING_FIT | typeof IMAGE_SIZING_FILL;
19
19
 
20
- type ImagePosition = typeof IMAGE_POSITION[keyof typeof IMAGE_POSITION];
20
+ type ImagePosition = (typeof IMAGE_POSITION)[keyof typeof IMAGE_POSITION];
21
21
 
22
22
  export type DisplayMode =
23
23
  | typeof DISPLAY_MODE_FIXED
@@ -39,6 +39,6 @@ describe("image with no source", () => {
39
39
  );
40
40
 
41
41
  const testInstance = testRenderer.root;
42
- expect(testInstance.findByType(Image).props.source).toEqual({ uri: "" });
42
+ expect(testInstance.findByType(Image).props.source).toBeUndefined();
43
43
  });
44
44
  });
@@ -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),
@@ -3,7 +3,7 @@
3
3
  exports[`CollapsibleTextContainer render container+children when label is presented 1`] = `
4
4
  <View
5
5
  style={
6
- Object {
6
+ {
7
7
  "backgroundColor": "#000000",
8
8
  }
9
9
  }
@@ -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
  };