@applicaster/zapp-react-native-ui-components 17.0.0-rc.4 → 17.0.0-rc.6

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.
@@ -610,11 +610,8 @@ const PlayerContainerComponent = (props: Props) => {
610
610
  );
611
611
  }
612
612
 
613
- if (
614
- screen_background_color &&
615
- mode !== VideoModalMode.FULLSCREEN &&
616
- isTV()
617
- ) {
613
+ // Not on inline TV screens: their color would stay around the video once it is expanded (#7344).
614
+ if (screen_background_color && isTV() && !isInlineTV) {
618
615
  updatedStyles.playerScreen.backgroundColor = screen_background_color;
619
616
  }
620
617
 
@@ -632,7 +629,6 @@ const PlayerContainerComponent = (props: Props) => {
632
629
  tv_component_container_height,
633
630
  screen_background_color,
634
631
  isInlineTV,
635
- mode,
636
632
  ]);
637
633
 
638
634
  const applePlayerProps = {
@@ -0,0 +1,29 @@
1
+ import { renderHook } from "@testing-library/react-native";
2
+
3
+ import { useResetScreenRevealManager } from "../useResetScreenRevealManager";
4
+
5
+ const mockResetScreenRevealManagerSubject = jest.fn();
6
+
7
+ jest.mock(
8
+ "@applicaster/zapp-react-native-ui-components/Components/ScreenRevealManager/utils",
9
+ () => ({
10
+ resetScreenRevealManagerSubject: () =>
11
+ mockResetScreenRevealManagerSubject(),
12
+ })
13
+ );
14
+
15
+ describe("useResetScreenRevealManager", () => {
16
+ beforeEach(() => {
17
+ mockResetScreenRevealManagerSubject.mockClear();
18
+ });
19
+
20
+ it("recreates the reveal subject once per screen mount", () => {
21
+ const { rerender } = renderHook(() => useResetScreenRevealManager());
22
+
23
+ expect(mockResetScreenRevealManagerSubject).toHaveBeenCalledTimes(1);
24
+
25
+ rerender();
26
+
27
+ expect(mockResetScreenRevealManagerSubject).toHaveBeenCalledTimes(1);
28
+ });
29
+ });
@@ -1,3 +1,5 @@
1
1
  export { useInitialFocus } from "./useInitialFocus";
2
2
 
3
3
  export { useAfterPaint } from "./useAfterPaint";
4
+
5
+ export { useResetScreenRevealManager } from "./useResetScreenRevealManager";
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+
3
+ import { resetScreenRevealManagerSubject } from "@applicaster/zapp-react-native-ui-components/Components/ScreenRevealManager/utils";
4
+
5
+ // Once per screen mount, before useInitialFocus subscribes. A later reset
6
+ // would drop a transition already emitted for this screen.
7
+ export const useResetScreenRevealManager = (): void => {
8
+ const hasResetScreenReveal = React.useRef(false);
9
+
10
+ if (!hasResetScreenReveal.current) {
11
+ hasResetScreenReveal.current = true;
12
+ resetScreenRevealManagerSubject();
13
+ }
14
+ };
@@ -21,7 +21,11 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
21
21
 
22
22
  import { NavBarContainer } from "../../Layout/TV/NavBarContainer";
23
23
  import { ScreenResolver } from "../../ScreenResolver";
24
- import { useInitialFocus, useAfterPaint } from "./hooks";
24
+ import {
25
+ useInitialFocus,
26
+ useAfterPaint,
27
+ useResetScreenRevealManager,
28
+ } from "./hooks";
25
29
  import { isPlayerPlugin } from "@applicaster/zapp-react-native-utils/pluginUtils";
26
30
  import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
27
31
  import { FreezeWithCallback } from "../../FreezeWithCallback";
@@ -113,6 +117,8 @@ export const Screen = ({ route, Components }: Props) => {
113
117
 
114
118
  const backgroundColor = useScreenBackgroundColor(screenId);
115
119
 
120
+ useResetScreenRevealManager();
121
+
116
122
  useInitialFocus();
117
123
 
118
124
  const activeRiver = getActiveRiver({
@@ -0,0 +1,50 @@
1
+ import {
2
+ emitScreenRevealManagerIsNotReadyToShow,
3
+ emitScreenRevealManagerIsReadyToShow,
4
+ resetScreenRevealManagerSubject,
5
+ waitUntilScreenRevealManagerIsReady,
6
+ } from "../index";
7
+
8
+ const emitReadyTransition = () => {
9
+ emitScreenRevealManagerIsNotReadyToShow();
10
+ emitScreenRevealManagerIsReadyToShow();
11
+ };
12
+
13
+ describe("screenRevealManagerSubject", () => {
14
+ afterEach(() => {
15
+ resetScreenRevealManagerSubject();
16
+ });
17
+
18
+ it("replays a ready transition to a subscriber that arrives after it", () => {
19
+ emitReadyTransition();
20
+
21
+ let emitted = false;
22
+
23
+ const subscription = waitUntilScreenRevealManagerIsReady().subscribe(() => {
24
+ emitted = true;
25
+ });
26
+
27
+ expect(emitted).toBe(true);
28
+
29
+ subscription.unsubscribe();
30
+ });
31
+
32
+ it("does not replay the previous screen transition after the subject is recreated", () => {
33
+ emitReadyTransition();
34
+ resetScreenRevealManagerSubject();
35
+
36
+ let emitted = false;
37
+
38
+ const subscription = waitUntilScreenRevealManagerIsReady().subscribe(() => {
39
+ emitted = true;
40
+ });
41
+
42
+ expect(emitted).toBe(false);
43
+
44
+ emitReadyTransition();
45
+
46
+ expect(emitted).toBe(true);
47
+
48
+ subscription.unsubscribe();
49
+ });
50
+ });
@@ -2,7 +2,16 @@ import { ReplaySubject } from "rxjs";
2
2
  import { pairwise, filter, first } from "rxjs/operators";
3
3
 
4
4
  // we are interested in last 2 events, because we wait transition from <false> to <true>
5
- const screenRevealManagerSubject$ = new ReplaySubject<boolean>(2);
5
+ // Replaced on each screen mount. A shared buffer replays the previous
6
+ // screen's false→true pair to the next subscriber, and initial focus fires
7
+ // before that screen has anything to reveal.
8
+ let screenRevealManagerSubject$: ReplaySubject<boolean>;
9
+
10
+ export const resetScreenRevealManagerSubject = () => {
11
+ screenRevealManagerSubject$ = new ReplaySubject<boolean>(2);
12
+ };
13
+
14
+ resetScreenRevealManagerSubject();
6
15
 
7
16
  export const emitScreenRevealManagerIsReadyToShow = () => {
8
17
  screenRevealManagerSubject$.next(true);
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.4",
3
+ "version": "17.0.0-rc.6",
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.4",
32
- "@applicaster/zapp-react-native-bridge": "17.0.0-rc.4",
33
- "@applicaster/zapp-react-native-redux": "17.0.0-rc.4",
34
- "@applicaster/zapp-react-native-utils": "17.0.0-rc.4",
31
+ "@applicaster/applicaster-types": "17.0.0-rc.6",
32
+ "@applicaster/zapp-react-native-bridge": "17.0.0-rc.6",
33
+ "@applicaster/zapp-react-native-redux": "17.0.0-rc.6",
34
+ "@applicaster/zapp-react-native-utils": "17.0.0-rc.6",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "react-native-sortables": "1.7.1",