@applicaster/zapp-react-native-ui-components 15.0.0-rc.14 → 15.0.0-rc.141

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 (197) hide show
  1. package/Components/AnimatedInOut/index.tsx +69 -26
  2. package/Components/BaseFocusable/index.ios.ts +12 -2
  3. package/Components/Cell/Cell.tsx +14 -3
  4. package/Components/Cell/CellWithFocusable.tsx +9 -0
  5. package/Components/Cell/FocusableWrapper.tsx +3 -0
  6. package/Components/Cell/TvOSCellComponent.tsx +25 -6
  7. package/Components/Focusable/Focusable.tsx +4 -2
  8. package/Components/Focusable/FocusableTvOS.tsx +18 -1
  9. package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
  10. package/Components/FocusableGroup/FocusableTvOS.tsx +32 -1
  11. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +39 -28
  12. package/Components/GeneralContentScreen/__tests__/GeneralContentScreen.test.tsx +104 -0
  13. package/Components/GeneralContentScreen/utils/__tests__/getScreenDataSource.test.ts +19 -0
  14. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
  15. package/Components/GeneralContentScreen/utils/getScreenDataSource.ts +9 -0
  16. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -6
  17. package/Components/HandlePlayable/HandlePlayable.tsx +33 -94
  18. package/Components/HandlePlayable/const.ts +3 -0
  19. package/Components/HandlePlayable/utils.ts +105 -0
  20. package/Components/HookRenderer/HookRenderer.tsx +40 -10
  21. package/Components/HookRenderer/__tests__/HookRenderer.test.tsx +60 -0
  22. package/Components/Layout/TV/LayoutBackground.tsx +5 -2
  23. package/Components/Layout/TV/NavBarContainer.tsx +1 -10
  24. package/Components/Layout/TV/ScreenContainer.tsx +2 -6
  25. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +7 -12
  26. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +7 -12
  27. package/Components/Layout/TV/index.tsx +3 -4
  28. package/Components/Layout/TV/index.web.tsx +3 -4
  29. package/Components/LinkHandler/LinkHandler.tsx +2 -2
  30. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/model.test.ts +80 -0
  31. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +187 -0
  32. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/selectors.test.ts +45 -0
  33. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/style.test.ts +49 -0
  34. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/model.ts +47 -0
  35. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +170 -0
  36. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/selectors.ts +26 -0
  37. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/style.ts +29 -0
  38. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/types.ts +37 -0
  39. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
  40. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
  41. package/Components/MasterCell/DefaultComponents/Button.tsx +0 -15
  42. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +5 -1
  43. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
  44. package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
  45. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
  46. package/Components/MasterCell/DefaultComponents/LiveImage/__tests__/prepareEntry.test.ts +352 -0
  47. package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +136 -0
  48. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +43 -22
  49. package/Components/MasterCell/DefaultComponents/PressableView.tsx +261 -0
  50. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +40 -39
  51. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +95 -0
  52. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +86 -0
  53. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/index.test.ts +141 -0
  54. package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
  55. package/Components/MasterCell/DefaultComponents/SecondaryImage/index.ts +1 -1
  56. package/Components/MasterCell/DefaultComponents/Text/index.tsx +10 -14
  57. package/Components/MasterCell/DefaultComponents/index.ts +2 -0
  58. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Asset.ts +42 -0
  59. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +127 -0
  60. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ButtonContainerView.ts +23 -0
  61. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +16 -0
  62. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabel.ts +67 -0
  63. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +32 -0
  64. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +195 -0
  65. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/builders.test.ts +140 -0
  66. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +222 -0
  67. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/helpers.ts +105 -0
  68. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +104 -0
  69. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +118 -0
  70. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +73 -0
  71. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/index.test.ts +86 -0
  72. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +35 -48
  73. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +115 -29
  74. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +39 -144
  75. package/Components/MasterCell/elementMapper.tsx +1 -0
  76. package/Components/MasterCell/hoc/__tests__/withAsyncRender.test.tsx +219 -0
  77. package/Components/MasterCell/hoc/withAsyncRender.tsx +9 -7
  78. package/Components/MasterCell/index.tsx +2 -0
  79. package/Components/MasterCell/utils/__tests__/resolveColor.test.js +82 -3
  80. package/Components/MasterCell/utils/index.ts +61 -31
  81. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +102 -87
  82. package/Components/MeasurmentsPortal/__tests__/MeasurementsPortal.test.tsx +355 -0
  83. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +17 -9
  84. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +16 -8
  85. package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
  86. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
  87. package/Components/OfflineHandler/NotificationView/utils.ts +34 -0
  88. package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
  89. package/Components/PlayerContainer/PlayerContainer.tsx +44 -65
  90. package/Components/PlayerImageBackground/index.tsx +3 -22
  91. package/Components/PreloaderWrapper/__tests__/index.test.tsx +26 -0
  92. package/Components/PreloaderWrapper/index.tsx +15 -0
  93. package/Components/River/ComponentsMap/ComponentsMap.tsx +18 -16
  94. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
  95. package/Components/River/RefreshControl.tsx +19 -82
  96. package/Components/River/River.tsx +9 -82
  97. package/Components/River/RiverItem.tsx +26 -20
  98. package/Components/River/TV/River.tsx +31 -14
  99. package/Components/River/TV/index.tsx +8 -4
  100. package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
  101. package/Components/River/TV/utils/index.ts +4 -0
  102. package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
  103. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  104. package/Components/River/__tests__/componentsMap.test.js +38 -0
  105. package/Components/River/hooks/__tests__/usePullToRefresh.test.ts +132 -0
  106. package/Components/River/hooks/index.ts +1 -0
  107. package/Components/River/hooks/usePullToRefresh.ts +51 -0
  108. package/Components/Screen/TV/index.web.tsx +4 -2
  109. package/Components/Screen/__tests__/Screen.test.tsx +66 -42
  110. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
  111. package/Components/Screen/hooks.ts +75 -6
  112. package/Components/Screen/index.tsx +9 -4
  113. package/Components/Screen/navigationHandler.ts +49 -24
  114. package/Components/Screen/orientationHandler.ts +10 -13
  115. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +46 -0
  116. package/Components/ScreenFeedLoader/__tests__/ScreenFeedLoader.test.tsx +94 -0
  117. package/Components/ScreenFeedLoader/index.ts +1 -0
  118. package/Components/ScreenResolver/__tests__/screenResolver.test.js +24 -0
  119. package/Components/ScreenResolver/hooks/index.ts +3 -0
  120. package/Components/ScreenResolver/hooks/useGetComponent.ts +15 -0
  121. package/Components/ScreenResolver/hooks/useScreenComponentResolver.tsx +90 -0
  122. package/Components/ScreenResolver/index.tsx +15 -111
  123. package/Components/ScreenResolver/utils/__tests__/getScreenTypeProps.test.ts +45 -0
  124. package/Components/ScreenResolver/utils/getScreenTypeProps.ts +43 -0
  125. package/Components/ScreenResolver/utils/index.ts +1 -0
  126. package/Components/ScreenResolver/withDefaultScreenContext.tsx +16 -0
  127. package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +25 -0
  128. package/Components/ScreenResolverFeedProvider/__tests__/ScreenResolverFeedProvider.test.tsx +44 -0
  129. package/Components/ScreenResolverFeedProvider/index.ts +1 -0
  130. package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
  131. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
  132. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +44 -26
  133. package/Components/Tabs/TV/Tabs.tsx +20 -3
  134. package/Components/Tabs/TabContent.tsx +7 -4
  135. package/Components/TopCutoffOverlay/hooks/__tests__/useMarginTop.test.ts +130 -0
  136. package/Components/TopCutoffOverlay/hooks/index.ts +1 -0
  137. package/Components/TopCutoffOverlay/hooks/useMarginTop.ts +59 -0
  138. package/Components/TopCutoffOverlay/index.tsx +55 -0
  139. package/Components/Transitioner/Scene.tsx +10 -3
  140. package/Components/Transitioner/index.js +3 -3
  141. package/Components/VideoLive/LiveImageManager.ts +199 -54
  142. package/Components/VideoLive/PlayerLiveImageComponent.tsx +31 -33
  143. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +2 -17
  144. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  145. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +118 -171
  146. package/Components/VideoModal/ModalAnimation/index.ts +2 -13
  147. package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
  148. package/Components/VideoModal/PlayerWrapper.tsx +14 -88
  149. package/Components/VideoModal/VideoModal.tsx +1 -5
  150. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
  151. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
  152. package/Components/VideoModal/hooks/useModalSize.ts +10 -5
  153. package/Components/VideoModal/playerWrapperStyle.ts +70 -0
  154. package/Components/VideoModal/playerWrapperUtils.ts +91 -0
  155. package/Components/VideoModal/utils.ts +19 -9
  156. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
  157. package/Components/Viewport/ViewportAware/index.tsx +16 -7
  158. package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
  159. package/Components/ZappUIComponent/index.tsx +12 -6
  160. package/Components/default-cell-renderer/viewTrees/mobile/index.ts +0 -3
  161. package/Components/index.js +1 -1
  162. package/Contexts/ScreenContext/__tests__/index.test.tsx +57 -0
  163. package/Contexts/ScreenContext/index.tsx +71 -19
  164. package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
  165. package/Contexts/ZappHookModalContext/index.tsx +37 -61
  166. package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +18 -7
  167. package/Contexts/index.ts +0 -2
  168. package/Decorators/Analytics/index.tsx +6 -5
  169. package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
  170. package/Decorators/ConfigurationWrapper/const.ts +1 -0
  171. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -7
  172. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +212 -5
  173. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
  174. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
  175. package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
  176. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
  177. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
  178. package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
  179. package/Helpers/DataSourceHelper/index.ts +19 -0
  180. package/events/index.ts +3 -0
  181. package/events/scrollEndReached.ts +15 -0
  182. package/index.d.ts +7 -0
  183. package/package.json +6 -5
  184. package/Components/MasterCell/DefaultComponents/Text/utils/__tests__/withAdjustedLineHeight.test.ts +0 -46
  185. package/Components/MasterCell/DefaultComponents/Text/utils/index.ts +0 -21
  186. package/Components/PlayerContainer/ErrorDisplay/ErrorDisplay.tsx +0 -57
  187. package/Components/PlayerContainer/ErrorDisplay/index.ts +0 -9
  188. package/Components/River/TV/withTVEventHandler.tsx +0 -27
  189. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
  190. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -417
  191. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +0 -294
  192. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
  193. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +0 -93
  194. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
  195. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
  196. package/Helpers/DataSourceHelper/index.js +0 -19
  197. /package/Components/HookRenderer/{index.tsx → index.ts} +0 -0
@@ -0,0 +1,141 @@
1
+ import { SecondaryImage } from "../index";
2
+
3
+ describe("SecondaryImage - Configuration Builder", () => {
4
+ const mockValue = (config: any) => (key: string, transformer?: Function) => {
5
+ const value = config[key];
6
+
7
+ return transformer ? transformer(value) : value;
8
+ };
9
+
10
+ it("should pass false as second argument to image_src_from_media_item", () => {
11
+ const config = {
12
+ secondary_image_switch: true,
13
+ secondary_image_position: "over_image",
14
+ secondary_image_visibility: "always",
15
+ secondary_image_image_key: "custom_image",
16
+ secondary_image_display_mode: "dynamic",
17
+ secondary_image_dynamic_width: 100,
18
+ };
19
+
20
+ const result = SecondaryImage({
21
+ value: mockValue(config),
22
+ currentPosition: "over_image",
23
+ state: "default",
24
+ });
25
+
26
+ expect(result).not.toBeNull();
27
+ expect(result?.elements).toBeDefined();
28
+ expect(result?.elements[0].data).toBeDefined();
29
+
30
+ const imageData = result?.elements[0].data[0];
31
+ expect(imageData.func).toBe("image_src_from_media_item");
32
+ expect(imageData.args).toEqual(["custom_image", false]);
33
+ expect(imageData.propName).toBe("uri");
34
+ });
35
+
36
+ it("should return null when secondary image is disabled", () => {
37
+ const config = {
38
+ secondary_image_switch: false,
39
+ };
40
+
41
+ const result = SecondaryImage({
42
+ value: mockValue(config),
43
+ currentPosition: "over_image",
44
+ state: "default",
45
+ });
46
+
47
+ expect(result).toBeNull();
48
+ });
49
+
50
+ it("should return null when position does not match currentPosition", () => {
51
+ const config = {
52
+ secondary_image_switch: true,
53
+ secondary_image_position: "above_text_label_1",
54
+ secondary_image_visibility: "always",
55
+ };
56
+
57
+ const result = SecondaryImage({
58
+ value: mockValue(config),
59
+ currentPosition: "over_image",
60
+ state: "default",
61
+ });
62
+
63
+ expect(result).toBeNull();
64
+ });
65
+
66
+ it("should return null when visibility does not match state", () => {
67
+ const config = {
68
+ secondary_image_switch: true,
69
+ secondary_image_position: "over_image",
70
+ secondary_image_visibility: "focused",
71
+ };
72
+
73
+ const result = SecondaryImage({
74
+ value: mockValue(config),
75
+ currentPosition: "over_image",
76
+ state: "default",
77
+ });
78
+
79
+ expect(result).toBeNull();
80
+ });
81
+
82
+ it("should include display mode and image sizing in additionalProps", () => {
83
+ const config = {
84
+ secondary_image_switch: true,
85
+ secondary_image_position: "over_image",
86
+ secondary_image_visibility: "always",
87
+ secondary_image_image_key: "logo",
88
+ secondary_image_display_mode: "fixed",
89
+ secondary_image_image_sizing: "fill",
90
+ secondary_image_fit_position: "center",
91
+ secondary_image_fixed_width: 200,
92
+ secondary_image_fixed_height: 150,
93
+ };
94
+
95
+ const result = SecondaryImage({
96
+ value: mockValue(config),
97
+ currentPosition: "over_image",
98
+ state: "default",
99
+ });
100
+
101
+ expect(result?.elements[0].additionalProps).toMatchObject({
102
+ displayMode: "fixed",
103
+ imageSizing: "fill",
104
+ fitPosition: "center",
105
+ fixedWidth: 200,
106
+ fixedHeight: 150,
107
+ });
108
+ });
109
+
110
+ it("should apply correct styles including margins and border radius", () => {
111
+ const config = {
112
+ secondary_image_switch: true,
113
+ secondary_image_position: "over_image",
114
+ secondary_image_visibility: "always",
115
+ secondary_image_display_mode: "fixed",
116
+ secondary_image_fixed_width: 100,
117
+ secondary_image_fixed_height: 100,
118
+ secondary_image_corner_radius: 12,
119
+ secondary_image_margin_top: 10,
120
+ secondary_image_margin_left: 5,
121
+ secondary_image_margin_right: 5,
122
+ secondary_image_margin_bottom: 10,
123
+ };
124
+
125
+ const result = SecondaryImage({
126
+ value: mockValue(config),
127
+ currentPosition: "over_image",
128
+ state: "default",
129
+ });
130
+
131
+ expect(result?.elements[0].style).toMatchObject({
132
+ width: 100,
133
+ height: 100,
134
+ borderRadius: 12,
135
+ marginTop: 10,
136
+ marginLeft: 5,
137
+ marginRight: 5,
138
+ marginBottom: 10,
139
+ });
140
+ });
141
+ });
@@ -1,4 +1,4 @@
1
- import { renderHook } from "@testing-library/react-hooks";
1
+ import { renderHook, waitFor } from "@testing-library/react-native";
2
2
  import { Image } from "react-native";
3
3
 
4
4
  import { useGetImageDimensions } from "../useGetImageDimensions";
@@ -13,15 +13,16 @@ jest.spyOn(Image, "getSize").mockImplementation((_uri, success) => {
13
13
 
14
14
  describe("useGetImageDimensions", () => {
15
15
  it("should return aspect ration initially when known dimensions", async () => {
16
- const { result, waitForNextUpdate } = renderHook(() =>
16
+ const { result } = renderHook(() =>
17
17
  useGetImageDimensions("https://some_url.com", WIDTH, undefined)
18
18
  );
19
19
 
20
20
  expect(result.current).toBeUndefined();
21
- await waitForNextUpdate();
22
21
 
23
- expect(result.current).toEqual(
24
- getDimension({ width: WIDTH, height: HEIGTH })
25
- );
22
+ await waitFor(() => {
23
+ expect(result.current).toEqual(
24
+ getDimension({ width: WIDTH, height: HEIGTH })
25
+ );
26
+ });
26
27
  });
27
28
  });
@@ -103,7 +103,7 @@ export const SecondaryImage = ({ value, currentPosition, state }: Props) => {
103
103
  data: [
104
104
  {
105
105
  func: "image_src_from_media_item",
106
- args: [imageKey],
106
+ args: [imageKey, false],
107
107
  propName: "uri",
108
108
  },
109
109
  ],
@@ -7,7 +7,6 @@ import {
7
7
  } from "@applicaster/zapp-react-native-utils/cellUtils";
8
8
 
9
9
  import { useTextLabel, withFocusedStyles } from "./hooks";
10
- import { withScaledLineHeight } from "./utils";
11
10
  import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
12
11
  import { MeasurementPortalContext } from "../../../MeasurmentsPortal";
13
12
  import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
@@ -52,14 +51,14 @@ const _Text = ({
52
51
  : textTransform(transformText, _label);
53
52
 
54
53
  React.useLayoutEffect(() => {
55
- // For FocusableCells with action buttons
56
- if (otherProps.state) {
57
- if (otherProps.state === "focused" && cellFocused === true) {
58
- accessibilityManager.addHeading(textLabel);
59
- }
60
- } else {
61
- if (cellFocused === true) {
62
- accessibilityManager.addHeading(textLabel);
54
+ if (cellFocused) {
55
+ switch (otherProps.state) {
56
+ case "focused":
57
+ accessibilityManager.addHeading(textLabel);
58
+ break;
59
+ case "focused_selected":
60
+ accessibilityManager.addHeading(`${textLabel}, Selected`);
61
+ break;
63
62
  }
64
63
  }
65
64
  }, [cellFocused, otherProps.state, textLabel]);
@@ -70,12 +69,9 @@ const _Text = ({
70
69
 
71
70
  return (
72
71
  <Text
73
- style={[
74
- withScaledLineHeight(withFocusedStyles({ style, otherProps })),
75
- { height },
76
- ]}
77
- allowFontScaling={false}
72
+ style={[withFocusedStyles({ style, otherProps }), { height }]}
78
73
  {...withoutLabel(otherProps)}
74
+ allowFontScaling={false}
79
75
  >
80
76
  {textLabel}
81
77
  </Text>
@@ -16,12 +16,14 @@ import { CellBadge } from "./CellBadge";
16
16
  import { TvActionButtons } from "./tv/TvActionButtons";
17
17
  import { ButtonContainerView } from "./tv/ButtonContainerView";
18
18
  import { ImageBorderContainer } from "./ImageBorderContainer";
19
+ import { PressableView } from "./PressableView";
19
20
 
20
21
  export const defaultComponents = {
21
22
  View,
22
23
  CollapsibleTextContainer,
23
24
  Text,
24
25
  Button,
26
+ PressableView,
25
27
  Image,
26
28
  PureImage,
27
29
  ButtonContainerView,
@@ -0,0 +1,42 @@
1
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
2
+
3
+ type Props = {
4
+ prefix: string;
5
+ value: Function;
6
+ testID?: string;
7
+ };
8
+
9
+ /** Asset used in conjunction with PressableView inside mobile action buttons, uri is provided by PressableView */
10
+ export const Asset = ({ prefix, value, testID }: Props) => {
11
+ if (!value(`${prefix}_asset_enabled`)) {
12
+ return null;
13
+ }
14
+
15
+ return {
16
+ type: "Image",
17
+ style: {
18
+ width: toNumberWithDefaultZero(value(`${prefix}_asset_width`)),
19
+ height: toNumberWithDefaultZero(value(`${prefix}_asset_height`)),
20
+ marginTop: toNumberWithDefaultZero(value(`${prefix}_asset_margin_top`)),
21
+ marginRight: toNumberWithDefaultZero(
22
+ value(`${prefix}_asset_margin_right`)
23
+ ),
24
+ marginBottom: toNumberWithDefaultZero(
25
+ value(`${prefix}_asset_margin_bottom`)
26
+ ),
27
+ marginLeft: toNumberWithDefaultZero(value(`${prefix}_asset_margin_left`)),
28
+ backgroundColor: "transparent",
29
+ },
30
+ data: [
31
+ {
32
+ func: (entry) => entry,
33
+ args: [],
34
+ propName: "entry",
35
+ },
36
+ ],
37
+ additionalProps: {
38
+ mobileActionRole: "asset",
39
+ testID: testID ? `${testID}-asset` : undefined,
40
+ },
41
+ };
42
+ };
@@ -0,0 +1,127 @@
1
+ import {
2
+ toNumberWithDefault,
3
+ toNumberWithDefaultZero,
4
+ } from "@applicaster/zapp-react-native-utils/numberUtils";
5
+ import { compact } from "@applicaster/zapp-react-native-utils/cellUtils";
6
+
7
+ import { Asset } from "./Asset";
8
+ import { Spacer } from "./Spacer";
9
+ import { TextLabelsContainer } from "./TextLabelsContainer";
10
+ import { getContentDirection, getContentsAlignment } from "./helpers";
11
+
12
+ const displayModeStyle = ({ value, prefix }) => {
13
+ const mode = value(`${prefix}_display_mode`) || "dynamic";
14
+
15
+ if (mode === "fixed") {
16
+ return {
17
+ width: toNumberWithDefault(140, value(`${prefix}_width`)),
18
+ };
19
+ }
20
+
21
+ if (mode === "fill") {
22
+ return {
23
+ flex: 1,
24
+ };
25
+ }
26
+
27
+ return {};
28
+ };
29
+
30
+ type Props = {
31
+ index: number;
32
+ value: Function;
33
+ stylePrefix: string;
34
+ specificPrefix: string;
35
+ spacingStyle: Record<string, unknown>;
36
+ };
37
+
38
+ export const Button = ({
39
+ index,
40
+ value,
41
+ stylePrefix,
42
+ specificPrefix,
43
+ spacingStyle,
44
+ }: Props) => {
45
+ if (!value(`${specificPrefix}_button_enabled`)) {
46
+ return null;
47
+ }
48
+
49
+ const testID = `mobile_action_button_${index + 1}`;
50
+ const actionIdentifier = value(`${specificPrefix}_assign_action`);
51
+ const assetAlignment = value(`${stylePrefix}_asset_alignment`) || "left";
52
+ const actionAssetFlavour = value(`${stylePrefix}_action_asset_flavour`);
53
+
54
+ const contentsAlignment =
55
+ value(`${stylePrefix}_contents_alignment`) || "center";
56
+
57
+ return {
58
+ type: "PressableView",
59
+ style: {
60
+ flexDirection: getContentDirection(assetAlignment),
61
+ alignItems: "center",
62
+ justifyContent: getContentsAlignment(contentsAlignment),
63
+
64
+ marginTop: toNumberWithDefaultZero(value(`${stylePrefix}_margin_top`)),
65
+ marginRight: toNumberWithDefaultZero(
66
+ value(`${stylePrefix}_margin_right`)
67
+ ),
68
+ marginBottom: toNumberWithDefaultZero(
69
+ value(`${stylePrefix}_margin_bottom`)
70
+ ),
71
+ marginLeft: toNumberWithDefaultZero(value(`${stylePrefix}_margin_left`)),
72
+
73
+ paddingTop: toNumberWithDefaultZero(value(`${stylePrefix}_padding_top`)),
74
+ paddingRight: toNumberWithDefaultZero(
75
+ value(`${stylePrefix}_padding_right`)
76
+ ),
77
+ paddingBottom: toNumberWithDefaultZero(
78
+ value(`${stylePrefix}_padding_bottom`)
79
+ ),
80
+ paddingLeft: toNumberWithDefaultZero(
81
+ value(`${stylePrefix}_padding_left`)
82
+ ),
83
+
84
+ borderWidth: toNumberWithDefaultZero(value(`${stylePrefix}_border_size`)),
85
+ borderRadius: toNumberWithDefaultZero(
86
+ value(`${stylePrefix}_corner_radius`)
87
+ ),
88
+ borderColor: value(`${stylePrefix}_border_color`),
89
+ backgroundColor: value(`${stylePrefix}_background_color`),
90
+
91
+ ...displayModeStyle({ value, prefix: stylePrefix }),
92
+ ...spacingStyle,
93
+ },
94
+ additionalProps: {
95
+ action: {
96
+ identifier: actionIdentifier,
97
+ flavour: actionAssetFlavour,
98
+ },
99
+ focusedStyles: {
100
+ backgroundColor: value(`${stylePrefix}_focused_background_color`),
101
+ borderColor: value(`${stylePrefix}_focused_border_color`),
102
+ },
103
+ testID,
104
+ },
105
+ elements: compact([
106
+ Asset({
107
+ prefix: stylePrefix,
108
+ value,
109
+ testID,
110
+ }),
111
+ Spacer(),
112
+ TextLabelsContainer({
113
+ prefix: stylePrefix,
114
+ value,
115
+ actionIdentifier,
116
+ testID,
117
+ }),
118
+ ]),
119
+ data: [
120
+ {
121
+ func: (x) => x,
122
+ args: [],
123
+ propName: "item",
124
+ },
125
+ ],
126
+ };
127
+ };
@@ -0,0 +1,23 @@
1
+ type Props = {
2
+ style: Record<string, unknown>;
3
+ contentStyle: Record<string, unknown>;
4
+ elements: Array<Record<string, unknown>>;
5
+ };
6
+
7
+ export const ButtonContainerView = ({
8
+ style,
9
+ contentStyle,
10
+ elements,
11
+ }: Props) => {
12
+ return {
13
+ type: "View",
14
+ style,
15
+ elements: [
16
+ {
17
+ type: "View",
18
+ style: contentStyle,
19
+ elements,
20
+ },
21
+ ],
22
+ };
23
+ };
@@ -0,0 +1,16 @@
1
+ type Props = {
2
+ enabled?: boolean;
3
+ };
4
+
5
+ export const Spacer = ({ enabled = false }: Props = {}) => {
6
+ if (!enabled) {
7
+ return null;
8
+ }
9
+
10
+ return {
11
+ type: "View",
12
+ style: {
13
+ flex: 1,
14
+ },
15
+ };
16
+ };
@@ -0,0 +1,67 @@
1
+ import { Platform } from "react-native";
2
+
3
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
4
+
5
+ type Props = {
6
+ prefix: string;
7
+ value: Function;
8
+ actionIdentifier: string;
9
+ testID?: string;
10
+ };
11
+
12
+ export const TextLabel = ({
13
+ prefix,
14
+ value,
15
+ actionIdentifier,
16
+ testID,
17
+ }: Props) => {
18
+ if (!value(`${prefix}_label_enabled`)) {
19
+ return null;
20
+ }
21
+
22
+ return {
23
+ type: "Text",
24
+ style: {
25
+ color: value(`${prefix}_font_color`),
26
+ fontSize: toNumberWithDefaultZero(value(`${prefix}_font_size`)),
27
+ lineHeight: toNumberWithDefaultZero(value(`${prefix}_line_height`)),
28
+ marginTop: toNumberWithDefaultZero(value(`${prefix}_margin_top`)),
29
+ marginRight: toNumberWithDefaultZero(value(`${prefix}_margin_right`)),
30
+ marginBottom: toNumberWithDefaultZero(value(`${prefix}_margin_bottom`)),
31
+ marginLeft: toNumberWithDefaultZero(value(`${prefix}_margin_left`)),
32
+ fontFamily:
33
+ Platform.OS === "ios"
34
+ ? value(`${prefix}_ios_font_family`)
35
+ : value(`${prefix}_android_font_family`),
36
+ letterSpacing: toNumberWithDefaultZero(
37
+ Platform.OS === "ios"
38
+ ? value(`${prefix}_ios_letter_spacing`)
39
+ : value(`${prefix}_android_letter_spacing`)
40
+ ),
41
+ },
42
+ data: [
43
+ {
44
+ func: (entry) => entry,
45
+ args: [],
46
+ propName: "entry",
47
+ },
48
+ ],
49
+ additionalProps: {
50
+ label: {
51
+ context: actionIdentifier,
52
+ name: "label_1",
53
+ },
54
+ normalStyles: {
55
+ color: value(`${prefix}_font_color`),
56
+ },
57
+ focusedStyles: {
58
+ color: value(`${prefix}_focused_font_color`),
59
+ },
60
+ state: "default",
61
+ mobileActionRole: "label",
62
+ transformText: value(`${prefix}_text_transform`) || "default",
63
+ numberOfLines: value(`${prefix}_number_of_lines`),
64
+ testID: testID ? `${testID}-label` : undefined,
65
+ },
66
+ };
67
+ };
@@ -0,0 +1,32 @@
1
+ import { compact } from "@applicaster/zapp-react-native-utils/cellUtils";
2
+
3
+ import { TextLabel } from "./TextLabel";
4
+
5
+ type Props = {
6
+ prefix: string;
7
+ value: Function;
8
+ actionIdentifier: string;
9
+ testID?: string;
10
+ };
11
+
12
+ export const TextLabelsContainer = ({
13
+ prefix,
14
+ value,
15
+ actionIdentifier,
16
+ testID,
17
+ }: Props) => {
18
+ return {
19
+ type: "View",
20
+ additionalProps: {
21
+ mobileActionRole: "label_container",
22
+ },
23
+ elements: compact([
24
+ TextLabel({
25
+ prefix,
26
+ value,
27
+ actionIdentifier,
28
+ testID,
29
+ }),
30
+ ]),
31
+ };
32
+ };