@applicaster/zapp-react-native-ui-components 17.0.0-rc.3 → 17.0.0-rc.5

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 (44) hide show
  1. package/Components/AudioPlayer/index.web.tsx +10 -0
  2. package/Components/Cell/PlatformCellComponent.ts +9 -0
  3. package/Components/Cell/PlatformCellComponent.web.ts +3 -0
  4. package/Components/Cell/index.js +2 -9
  5. package/Components/CellRendererResolver/index.ts +20 -1
  6. package/Components/ComponentResolver/ComponentResolver.ts +4 -0
  7. package/Components/Focusable/index.web.tsx +3 -0
  8. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +29 -4
  9. package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.android.tv.tsx +7 -4
  10. package/Components/MasterCell/DefaultComponents/ButtonContainerView/types.ts +1 -0
  11. package/Components/MasterCell/DefaultComponents/FocusableView/index.android.tsx +10 -4
  12. package/Components/MasterCell/DefaultComponents/Image/index.web.ts +7 -0
  13. package/Components/MasterCell/DefaultComponents/LiveImage/__tests__/prepareEntry.test.ts +30 -0
  14. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +22 -4
  15. package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.missingPlugin.test.tsx +66 -0
  16. package/Components/MasterCell/__tests__/masterCell.test.js +56 -0
  17. package/Components/MasterCell/index.tsx +17 -2
  18. package/Components/MasterCell/utils/__tests__/getFocusableElementId.test.ts +38 -0
  19. package/Components/MasterCell/utils/index.ts +39 -1
  20. package/Components/ModalComponent/Button/index.tsx +3 -1
  21. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +29 -2
  22. package/Components/ModalComponent/presets/index.ts +2 -3
  23. package/Components/PlayerContainer/PlayerContainer.tsx +2 -6
  24. package/Components/River/ComponentsMap/index.web.tsx +3 -0
  25. package/Components/River/RiverItem.tsx +4 -0
  26. package/Components/River/TV/River.tsx +7 -1
  27. package/Components/ScreenResolver/index.tsx +4 -1
  28. package/Components/Tabs/TV/index.web.tsx +5 -0
  29. package/Components/TopCutoffOverlay/__tests__/TopCutoffOverlay.test.tsx +56 -10
  30. package/Components/TopCutoffOverlay/index.tsx +41 -10
  31. package/Components/VideoLive/__tests__/LiveImageManager.test.ts +30 -0
  32. package/Components/VideoModal/PlayerDetails.tsx +27 -2
  33. package/Components/VideoModal/PlayerWrapper.tsx +5 -1
  34. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +84 -0
  35. package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +206 -1
  36. package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +110 -1
  37. package/Components/VideoModal/playerWrapperStyle.ts +41 -20
  38. package/Components/VideoModal/playerWrapperUtils.ts +134 -0
  39. package/Components/__tests__/webVariants.test.js +73 -0
  40. package/Components/default-cell-renderer/containerStyles/index.web.ts +6 -0
  41. package/Components/default-cell-renderer/viewTrees/index.web.ts +10 -0
  42. package/Decorators/RiverResolver/__tests__/riverResolver.missingRiver.test.tsx +52 -0
  43. package/Decorators/RiverResolver/index.tsx +25 -0
  44. package/package.json +5 -5
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { render } from "@testing-library/react-native";
4
+
5
+ const mockError = jest.fn();
6
+
7
+ jest.mock("@applicaster/zapp-react-native-utils/logger", () => ({
8
+ // Called on import, before mockError is assigned: look it up at call time.
9
+ subsystemLogger: () => ({ error: (event) => mockError(event) }),
10
+ }));
11
+
12
+ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
13
+ useRivers: () => ({ A123: { id: "A123" } }),
14
+ }));
15
+
16
+ jest.mock(
17
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname",
18
+ () => ({ usePathname: () => "/home" })
19
+ );
20
+
21
+ import { withRiver } from "../";
22
+
23
+ const Wrapped = withRiver((props) => <View {...props} />);
24
+
25
+ describe("withRiver with a screen that is not in the layout", () => {
26
+ beforeEach(() => mockError.mockClear());
27
+
28
+ it("renders nothing and logs the entry that led there", () => {
29
+ const entry = { id: "e1", title: "Star Wars", type: { value: "movie" } };
30
+
31
+ const { toJSON } = render(<Wrapped screenId="e1" screenData={entry} />);
32
+
33
+ expect(toJSON()).toBeNull();
34
+ expect(mockError).toHaveBeenCalledTimes(1);
35
+
36
+ expect(mockError).toHaveBeenCalledWith({
37
+ message:
38
+ "river not found, blank screen shown, screen_id=e1, entry_type=movie",
39
+ data: {
40
+ diagnostic: { code: "type-mapping" },
41
+ screen_id: "e1",
42
+ entry,
43
+ },
44
+ });
45
+ });
46
+
47
+ it("does not log for a screen that exists", () => {
48
+ render(<Wrapped screenId="A123" />);
49
+
50
+ expect(mockError).not.toHaveBeenCalled();
51
+ });
52
+ });
@@ -3,6 +3,9 @@ import * as React from "react";
3
3
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
4
4
  import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
5
5
  import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
6
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
7
+
8
+ const logger = subsystemLogger("ui/screens", "RiverResolver");
6
9
 
7
10
  type Props = ZappUIComponentProps & {
8
11
  rivers: ZappRivers;
@@ -15,6 +18,28 @@ export function withRiver(Component: ZappComponent): ZappComponent {
15
18
  const river = useRivers()?.[screenId];
16
19
  const pathname = usePathname();
17
20
 
21
+ // Nothing is rendered for a screen that is not in the layout, so the log is the only trace of
22
+ // the blank screen: usually a tapped entry whose type leads to no screen.
23
+ React.useEffect(() => {
24
+ if (!river) {
25
+ // Without a river the screen data is the entry that was pushed.
26
+ const entry = otherProps.screenData as unknown as ZappEntry | undefined;
27
+
28
+ logger.error({
29
+ message: `river not found, blank screen shown, screen_id=${screenId}, entry_type=${entry?.type?.value}`,
30
+ data: {
31
+ // For X-Ray diagnostics: keep when the message is reworded. No `case`: all that is
32
+ // known here is that the screen is missing.
33
+ diagnostic: { code: "type-mapping" },
34
+ screen_id: screenId,
35
+ entry,
36
+ },
37
+ });
38
+ }
39
+ // Once per screen: the entry object is new on every render.
40
+ // eslint-disable-next-line @wogns3623/better-exhaustive-deps/exhaustive-deps
41
+ }, [river, screenId]);
42
+
18
43
  if (!river) {
19
44
  return null;
20
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "17.0.0-rc.3",
3
+ "version": "17.0.0-rc.5",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "17.0.0-rc.3",
32
- "@applicaster/zapp-react-native-bridge": "17.0.0-rc.3",
33
- "@applicaster/zapp-react-native-redux": "17.0.0-rc.3",
34
- "@applicaster/zapp-react-native-utils": "17.0.0-rc.3",
31
+ "@applicaster/applicaster-types": "17.0.0-rc.5",
32
+ "@applicaster/zapp-react-native-bridge": "17.0.0-rc.5",
33
+ "@applicaster/zapp-react-native-redux": "17.0.0-rc.5",
34
+ "@applicaster/zapp-react-native-utils": "17.0.0-rc.5",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "react-native-sortables": "1.7.1",