@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5621117258 → 14.0.0-alpha.6242515303

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 (61) hide show
  1. package/Components/AudioPlayer/index.tsx +15 -0
  2. package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
  3. package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -8
  4. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  5. package/Components/AudioPlayer/mobile/index.tsx +18 -0
  6. package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +3 -2
  7. package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
  8. package/Components/AudioPlayer/tv/Layout.tsx +168 -0
  9. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +7 -1
  10. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +6 -2
  11. package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +6 -2
  12. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
  13. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
  14. package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
  15. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -2
  16. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -2
  17. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
  18. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +1 -2
  19. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +17 -58
  20. package/Components/AudioPlayer/types.ts +40 -0
  21. package/Components/Cell/index.js +6 -2
  22. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  23. package/Components/Focusable/index.android.tsx +12 -8
  24. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
  25. package/Components/HandlePlayable/HandlePlayable.tsx +11 -1
  26. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
  27. package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
  28. package/Components/MasterCell/index.tsx +1 -1
  29. package/Components/PlayerContainer/PlayerContainer.tsx +7 -22
  30. package/Components/PlayerImageBackground/index.tsx +1 -1
  31. package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -5
  32. package/Components/River/RiverItem.tsx +8 -8
  33. package/Components/River/TV/River.tsx +0 -3
  34. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -6
  35. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
  36. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -9
  37. package/Components/VideoModal/PlayerDetails.tsx +2 -24
  38. package/Components/VideoModal/PlayerWrapper.tsx +142 -26
  39. package/Components/VideoModal/VideoModal.tsx +17 -3
  40. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -1
  41. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +240 -44
  42. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
  43. package/Components/VideoModal/hooks/index.ts +2 -0
  44. package/Components/VideoModal/hooks/useBackgroundColor.ts +10 -0
  45. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
  46. package/Components/VideoModal/utils.ts +0 -6
  47. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  48. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  49. package/index.d.ts +0 -1
  50. package/package.json +5 -8
  51. package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
  52. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -72
  53. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
  54. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
  55. package/Components/AudioPlayer/index.ts +0 -1
  56. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
  57. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +0 -0
  58. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
  59. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
  60. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
  61. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
@@ -4,14 +4,13 @@ exports[`<Summary /> renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
- "height": 80,
8
7
  "marginBottom": 30,
9
8
  "width": 600,
10
9
  }
11
10
  }
12
11
  >
13
12
  <Text
14
- numberOfLines={2}
13
+ numberOfLines={3}
15
14
  style={
16
15
  {
17
16
  "color": "white",
@@ -4,14 +4,13 @@ exports[`<Title /> renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
- "height": 100,
8
7
  "marginBottom": 12,
9
8
  "width": 600,
10
9
  }
11
10
  }
12
11
  >
13
12
  <Text
14
- numberOfLines={2}
13
+ numberOfLines={3}
15
14
  style={
16
15
  {
17
16
  "color": "white",
@@ -1,7 +1,11 @@
1
1
  import React from "react";
2
2
  import { render } from "@testing-library/react-native";
3
3
 
4
- import { AudioPlayer } from "../AudioPlayer";
4
+ import { AudioPlayerTV } from "..";
5
+
6
+ jest.mock("@applicaster/zapp-react-native-utils/audioPlayerUtils", () => ({
7
+ useArtworkImage: jest.fn(() => "artwork_url"),
8
+ }));
5
9
 
6
10
  const audioPlayerProps = {
7
11
  audio_item: {
@@ -45,9 +49,9 @@ const audioPlayerProps = {
45
49
  styles: {},
46
50
  };
47
51
 
48
- describe("<AudioPlayer />", () => {
52
+ describe("<AudioPlayerTV />", () => {
49
53
  it("renders correctly", () => {
50
- const { toJSON } = render(<AudioPlayer {...audioPlayerProps} />);
54
+ const { toJSON } = render(<AudioPlayerTV {...audioPlayerProps} />);
51
55
  expect(toJSON()).toMatchSnapshot();
52
56
  });
53
57
  });
@@ -2,9 +2,8 @@ const defaults = {
2
2
  audio_player_title_color: "white",
3
3
  audio_player_summary_color: "white",
4
4
  audio_player_background_color: "black",
5
- audio_player_artwork_aspect_ratio: "1:1",
5
+ audio_player_background_image: undefined,
6
6
  audio_player_rtl: false,
7
- audio_player_background_image_default_color: "",
8
7
  };
9
8
 
10
9
  export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
@@ -1,60 +1,24 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
 
3
3
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
+ import { useArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
4
5
 
5
- import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
6
+ import { AudioPlayerTVLayout } from "./Layout";
6
7
 
7
- import { AudioPlayerLayout } from "./AudioPlayerLayout";
8
8
  import { Channel } from "./Channel";
9
9
  import { Title } from "./Title";
10
10
  import { Summary } from "./Summary";
11
11
  import { Runtime } from "./Runtime";
12
12
  import { getPropertyFromEntryOrConfig } from "./helpers";
13
- import { ViewStyle } from "react-native";
14
-
15
- type Props = {
16
- audio_item: ZappEntry & {
17
- extensions?: {
18
- audio_player_artwork_aspect_ratio?: string;
19
- audio_player_background_image?: string;
20
- audio_player_background_color?: string;
21
- audio_player_channel_icon?: string;
22
- audio_player_title_color?: string;
23
- audio_player_summary_color?: string;
24
- audio_player_rtl?: boolean;
25
- audio_player_background_image_default_color?: string;
26
- start_time?: string;
27
- end_time?: string;
28
- };
29
- };
30
- plugin_configuration: {
31
- audio_player_background_color?: string;
32
- audio_player_title_color?: string;
33
- audio_player_summary_color?: string;
34
- audio_player_rtl?: string;
35
- audio_player_background_image_default_color?: string;
36
- audio_player_background_image?: string;
37
- audio_player_artwork_aspect_ratio?: string;
38
- lg_tv_audio_player_title_font_family?: string;
39
- lg_tv_audio_player_title_font_size?: number;
40
- lg_tv_audio_player_summary_font_family?: string;
41
- lg_tv_audio_player_summary_font_size?: number;
42
- samsung_tv_audio_player_title_font_family?: string;
43
- samsung_tv_audio_player_title_font_size?: number;
44
- samsung_tv_audio_player_summary_font_family?: string;
45
- samsung_tv_audio_player_summary_font_size?: number;
46
- tv_os_audio_player_title_font_family?: string;
47
- tv_os_audio_player_title_font_size?: number;
48
- tv_os_audio_player_summary_font_family?: string;
49
- tv_os_audio_player_summary_font_size?: number;
50
- };
51
- style?: ViewStyle;
52
- };
53
-
54
- export function AudioPlayer(props: Props) {
55
- const { audio_item, plugin_configuration } = props;
13
+
14
+ import { Props } from "../types";
15
+
16
+ export function AudioPlayerTV(props: Props) {
17
+ const { audio_item, plugin_configuration, style = {} } = props;
56
18
  const { extensions, title, summary } = audio_item;
57
19
 
20
+ const artwork = useArtworkImage(audio_item);
21
+
58
22
  const getProp = useCallback(
59
23
  getPropertyFromEntryOrConfig({
60
24
  entry: audio_item,
@@ -64,20 +28,20 @@ export function AudioPlayer(props: Props) {
64
28
  );
65
29
 
66
30
  const config = useMemo(() => {
67
- // Checking if we are recieving items from the DSP
31
+ // Checking if we are receiving items from the DSP
68
32
  const titleColor = getProp("audio_player_title_color");
69
33
  const summaryColor = getProp("audio_player_summary_color");
70
34
  const backgroundColor = getProp("audio_player_background_color");
71
35
  const backgroundImage = getProp("audio_player_background_image");
72
- const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
73
36
  const channelIcon = getProp("audio_player_channel_icon");
74
37
  const rtlFlag = getProp("audio_player_rtl");
75
- const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
76
38
 
77
- const audioPlayerBackgroundImageDefaultColor = getProp(
78
- "audio_player_background_image_default_color"
39
+ const backgroundImageOverlay = getProp(
40
+ "audio_player_background_image_overlay"
79
41
  );
80
42
 
43
+ const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
44
+
81
45
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
82
46
 
83
47
  const titleFontFamily = getProp(
@@ -152,23 +116,18 @@ export function AudioPlayer(props: Props) {
152
116
  summaryFontSize,
153
117
  runTimeFontFamily,
154
118
  runTimeFontSize,
155
- artworkAspectRatio,
156
119
  channelIcon,
157
- audioPlayerBackgroundImageDefaultColor,
158
120
  artworkBorderRadius,
121
+ backgroundImageOverlay,
159
122
  };
160
123
  }, [getProp]);
161
124
 
162
- const artwork = imageSrcFromMediaItem(audio_item, [
163
- config?.artworkAspectRatio,
164
- ]);
165
-
166
125
  return (
167
- <AudioPlayerLayout artwork={artwork} config={config}>
126
+ <AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
168
127
  <Channel srcImage={config?.channelIcon} config={config} />
169
128
  <Title title={title} config={config} />
170
129
  <Summary summary={summary} config={config} />
171
130
  <Runtime {...extensions} config={config} />
172
- </AudioPlayerLayout>
131
+ </AudioPlayerTVLayout>
173
132
  );
174
133
  }
@@ -0,0 +1,40 @@
1
+ import { ViewStyle } from "react-native";
2
+
3
+ export type Props = {
4
+ audio_item: ZappEntry & {
5
+ extensions?: {
6
+ audio_player_artwork_aspect_ratio?: string;
7
+ audio_player_background_image?: string;
8
+ audio_player_background_color?: string;
9
+ audio_player_channel_icon?: string;
10
+ audio_player_title_color?: string;
11
+ audio_player_summary_color?: string;
12
+ audio_player_rtl?: boolean;
13
+ audio_player_background_image_default_color?: string;
14
+ start_time?: string;
15
+ end_time?: string;
16
+ };
17
+ };
18
+ plugin_configuration: {
19
+ audio_player_background_color?: string;
20
+ audio_player_title_color?: string;
21
+ audio_player_summary_color?: string;
22
+ audio_player_rtl?: string;
23
+ audio_player_background_image_default_color?: string;
24
+ audio_player_background_image?: string;
25
+ audio_player_artwork_aspect_ratio?: string;
26
+ lg_tv_audio_player_title_font_family?: string;
27
+ lg_tv_audio_player_title_font_size?: number;
28
+ lg_tv_audio_player_summary_font_family?: string;
29
+ lg_tv_audio_player_summary_font_size?: number;
30
+ samsung_tv_audio_player_title_font_family?: string;
31
+ samsung_tv_audio_player_title_font_size?: number;
32
+ samsung_tv_audio_player_summary_font_family?: string;
33
+ samsung_tv_audio_player_summary_font_size?: number;
34
+ tv_os_audio_player_title_font_family?: string;
35
+ tv_os_audio_player_title_font_size?: number;
36
+ tv_os_audio_player_summary_font_family?: string;
37
+ tv_os_audio_player_summary_font_size?: number;
38
+ };
39
+ style?: ViewStyle;
40
+ };
@@ -3,11 +3,15 @@ import * as R from "ramda";
3
3
  import { connectToStore } from "@applicaster/zapp-react-native-redux";
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
6
- import { HorizontalScrollContext, RiverOffsetContext } from "../../Contexts";
6
+ import {
7
+ HorizontalScrollContext,
8
+ RiverOffsetContext,
9
+ ScreenScrollingContext,
10
+ } from "../../Contexts";
11
+
7
12
  import { CellComponent } from "./Cell";
8
13
  import { TvOSCellComponent } from "./TvOSCellComponent";
9
14
  import { withConsumer } from "../../Contexts/HeaderOffsetContext";
10
- import { ScreenScrollingContext } from "../../Contexts/ScreenScrollingContext";
11
15
 
12
16
  import { ScreenLayoutContextConsumer } from "../../Contexts/ScreenLayoutContext";
13
17
  import { createContext } from "@applicaster/zapp-react-native-utils/reactUtils/createContext";
@@ -38,6 +38,9 @@ describe("Focusable", () => {
38
38
  });
39
39
 
40
40
  it("updates disableFocus state when disableFocus prop changes", () => {
41
+ const unregister = jest.fn();
42
+ mockFocusManager.registerFocusable.mockReturnValue(unregister);
43
+
41
44
  const { rerender } = render(
42
45
  <Focusable id="test-id" disableFocus={false}>
43
46
  <Touchable testID="touchable" />
@@ -43,11 +43,13 @@ export const FocusableContext = React.createContext<
43
43
  // eslint-disable-next-line
44
44
  setIsFocusable: (enableFocus: boolean) => void;
45
45
  ref: FocusManager.FocusableRef;
46
+ parentFocusableId: Option<string>;
46
47
  } & ParentFocus
47
48
  >({
48
49
  focused: false,
49
50
  setIsFocusable: () => {},
50
51
  ref: { current: null },
52
+ parentFocusableId: undefined,
51
53
  });
52
54
 
53
55
  export const useFocusable = () => React.useContext(FocusableContext);
@@ -74,7 +76,7 @@ function FocusableComponent(props: Props, forwardedRef) {
74
76
 
75
77
  const isRTL = useIsRTL();
76
78
  const focusManager = useFocusManager();
77
- const { ref: parentFocusable } = useFocusable();
79
+ const { ref: parentFocusableRef, parentFocusableId } = useFocusable();
78
80
  const touchableRef = React.useRef(null);
79
81
 
80
82
  const [focused, setFocused] = React.useState(() =>
@@ -98,13 +100,14 @@ function FocusableComponent(props: Props, forwardedRef) {
98
100
  }
99
101
  }, [disableFocus]);
100
102
 
101
- React.useEffect(() => {
103
+ React.useLayoutEffect(() => {
102
104
  if (id) {
103
- const unregister = focusManager.registerFocusable(
105
+ const unregister = focusManager.registerFocusable({
104
106
  touchableRef,
105
- parentFocusable,
106
- isFocusableCell
107
- );
107
+ parentFocusableRef,
108
+ isFocusableCell,
109
+ parentFocusableId,
110
+ });
108
111
 
109
112
  onRegister();
110
113
 
@@ -112,7 +115,7 @@ function FocusableComponent(props: Props, forwardedRef) {
112
115
  unregister();
113
116
  };
114
117
  }
115
- }, [id, onRegister, isFocusableCell]);
118
+ }, [id, onRegister, isFocusableCell, parentFocusableId]);
116
119
 
117
120
  if (R.isNil(id)) {
118
121
  // eslint-disable-next-line no-console
@@ -164,8 +167,9 @@ function FocusableComponent(props: Props, forwardedRef) {
164
167
  ...parentFocus,
165
168
  ref: touchableRef,
166
169
  setIsFocusable,
170
+ parentFocusableId: id,
167
171
  };
168
- }, [parentFocus, focused]);
172
+ }, [parentFocus, focused, id]);
169
173
 
170
174
  return (
171
175
  <Touchable
@@ -30,7 +30,6 @@ export const GeneralContentScreen = ({
30
30
  isScreenWrappedInContainer,
31
31
  componentsMapExtraProps = {},
32
32
  focused,
33
- extraOffset,
34
33
  parentFocus,
35
34
  containerHeight,
36
35
  preferredFocus = false,
@@ -122,7 +121,6 @@ export const GeneralContentScreen = ({
122
121
  isScreenWrappedInContainer={isScreenWrappedInContainer}
123
122
  parentFocus={parentFocus}
124
123
  focused={focused}
125
- extraOffset={extraOffset}
126
124
  containerHeight={containerHeight}
127
125
  preferredFocus={preferredFocus}
128
126
  {...componentsMapExtraProps}
@@ -7,12 +7,14 @@ import {
7
7
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
8
8
  import {
9
9
  useDimensions,
10
+ useIsTablet as isTablet,
10
11
  useNavigation,
11
12
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
13
 
13
14
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
15
  import { PlayerContainer } from "../PlayerContainer";
15
16
  import { useModalSize } from "../VideoModal/hooks";
17
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
16
18
 
17
19
  type Props = {
18
20
  item: ZappEntry;
@@ -83,6 +85,13 @@ type PlayableComponent = {
83
85
  Component: React.ComponentType<any>;
84
86
  };
85
87
 
88
+ const dimensionsContext: "window" | "screen" = platformSelect({
89
+ android_tv: "window",
90
+ amazon: "window",
91
+ // eslint-disable-next-line react-hooks/rules-of-hooks
92
+ default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
93
+ });
94
+
86
95
  export function HandlePlayable({
87
96
  item,
88
97
  isModal,
@@ -135,7 +144,8 @@ export function HandlePlayable({
135
144
  });
136
145
  }, [casting]);
137
146
 
138
- const { width: screenWidth, height: screenHeight } = useDimensions("window");
147
+ const { width: screenWidth, height: screenHeight } =
148
+ useDimensions(dimensionsContext);
139
149
 
140
150
  const modalSize = useModalSize();
141
151
 
@@ -2,7 +2,6 @@ import React, { useMemo } from "react";
2
2
  import { ImageStyle } from "react-native";
3
3
  import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
4
4
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
5
- import * as R from "ramda";
6
5
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
7
6
  import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
8
7
  import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
@@ -67,32 +66,10 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
67
66
  const handleFocus = (focusable) => {
68
67
  const focusedButtonId = getFocusedButtonId(focusable);
69
68
 
70
- wrapperRef?.current?.measure((x, y, width, height, pageX, pageY) => {
71
- const top = pageY;
72
- const bottom = top + height;
73
- const left = pageX;
74
- const right = left + width;
75
-
76
- const boundingRect = {
77
- x,
78
- y,
79
- pageX,
80
- pageY,
81
- width,
82
- height,
83
- top,
84
- bottom,
85
- left,
86
- right,
87
- };
88
-
89
- otherProps?.onToggleFocus?.({
90
- focusable: {
91
- getRect: R.always(boundingRect),
92
- },
93
- focusedButtonId,
94
- mouse: focusable.mouse,
95
- });
69
+ otherProps?.onToggleFocus?.({
70
+ focusable: wrapperRef.current,
71
+ focusedButtonId,
72
+ mouse: focusable.mouse,
96
73
  });
97
74
 
98
75
  if (ttsLabel) {
@@ -52,6 +52,7 @@ const _Text = ({
52
52
  withScaledLineHeight(withFocusedStyles({ style, otherProps })),
53
53
  { height },
54
54
  ]}
55
+ allowFontScaling={false}
55
56
  {...withoutLabel(otherProps)}
56
57
  >
57
58
  {dateTransformEnabled
@@ -86,7 +86,7 @@ export function masterCellBuilder({
86
86
  entry: item,
87
87
  state: getEntryState(state, entryIsSelected),
88
88
  }),
89
- [state, item?.id, entryIsSelected] // Assuming that item won't mutate
89
+ [state, item, entryIsSelected] // Assuming that item won't mutate
90
90
  );
91
91
 
92
92
  const wrapperRef = React.useRef(null);
@@ -88,7 +88,7 @@ export const VideoModalMode = {
88
88
  MAXIMIZED: "MAXIMIZED",
89
89
  MINIMIZED: "MINIMIZED",
90
90
  FULLSCREEN: "FULLSCREEN",
91
- } as const;
91
+ };
92
92
 
93
93
  export type PlayNextData = {
94
94
  state: PlayNextState;
@@ -105,11 +105,6 @@ const isTvOS = isTvOSPlatform();
105
105
  // height for container with additional content below player
106
106
  const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
107
107
 
108
- // Default Y offset for anchor points on non-Android TV platforms
109
- const DEFAULT_OFFSET_Y = -600;
110
-
111
- const EXTRA_ANCHOR_POINT_Y_OFFSET = isAndroidTV ? 0 : DEFAULT_OFFSET_Y;
112
-
113
108
  const withBorderHack = () => {
114
109
  if (isAndroidTV) {
115
110
  /* @HACK: see GH#7269 */
@@ -132,7 +127,7 @@ const webStyles = {
132
127
  playerScreen: {
133
128
  flex: 1,
134
129
  height: "100vh",
135
- backgroundColor: "black",
130
+ background: "black",
136
131
  },
137
132
  playerWrapper: {
138
133
  height: "100%",
@@ -570,9 +565,8 @@ const PlayerContainerComponent = (props: Props) => {
570
565
  const isInlineTV = isInlineTVUtil(screenData);
571
566
 
572
567
  const inline =
573
- [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
574
- mode as any
575
- ) || isInlineTV;
568
+ [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
569
+ isInlineTV;
576
570
 
577
571
  const value = React.useMemo(
578
572
  () => ({ playerId: state.playerId }),
@@ -593,11 +587,7 @@ const PlayerContainerComponent = (props: Props) => {
593
587
  );
594
588
  }
595
589
 
596
- if (
597
- screen_background_color &&
598
- mode !== VideoModalMode.FULLSCREEN &&
599
- isTV()
600
- ) {
590
+ if (screen_background_color && mode !== VideoModalMode.FULLSCREEN) {
601
591
  updatedStyles.playerScreen.backgroundColor = screen_background_color;
602
592
  }
603
593
 
@@ -647,17 +637,14 @@ const PlayerContainerComponent = (props: Props) => {
647
637
  preferredFocus
648
638
  shouldUsePreferredFocus
649
639
  groupId={groupId}
650
- pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
651
640
  >
652
641
  {/* Video player and components */}
653
642
  <View
654
643
  style={styles.playerScreen}
655
644
  testID={"player-screen-container"}
656
- pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
657
645
  >
658
646
  {/* Player container */}
659
647
  <View
660
- pointerEvents={mode === "MINIMIZED" ? "box-none" : "auto"}
661
648
  style={[
662
649
  styles.playerWrapper,
663
650
  // eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
@@ -729,13 +716,11 @@ const PlayerContainerComponent = (props: Props) => {
729
716
  key={item.id}
730
717
  groupId={FocusableGroupMainContainerId}
731
718
  cellTapAction={onCellTap}
732
- extraAnchorPointYOffset={
733
- EXTRA_ANCHOR_POINT_Y_OFFSET
734
- }
719
+ extraAnchorPointYOffset={0}
735
720
  isScreenWrappedInContainer={true}
736
721
  containerHeight={styles.inlineRiver.height}
737
722
  componentsMapExtraProps={{
738
- isNestedComponentsMap: R.T,
723
+ isNestedComponentsMap: true,
739
724
  }}
740
725
  />
741
726
  )}
@@ -28,7 +28,7 @@ const PlayerImageBackgroundComponent = ({
28
28
  defaultImageDimensions,
29
29
  }: Props) => {
30
30
  const source = React.useMemo(
31
- () => ({ uri: imageSrcFromMediaItem(entry, imageKey) }),
31
+ () => ({ uri: imageSrcFromMediaItem(entry, [imageKey]) }),
32
32
  [imageKey, entry]
33
33
  );
34
34
 
@@ -281,8 +281,8 @@ function ComponentsMapComponent(props: Props) {
281
281
  scrollIndicatorInsets={scrollIndicatorInsets}
282
282
  extraData={feed}
283
283
  stickyHeaderIndices={stickyHeaderIndices}
284
- onLayout={handleOnLayout}
285
284
  removeClippedSubviews={isAndroid}
285
+ onLayout={handleOnLayout}
286
286
  initialNumToRender={3}
287
287
  maxToRenderPerBatch={10}
288
288
  windowSize={12}
@@ -303,10 +303,6 @@ function ComponentsMapComponent(props: Props) {
303
303
  onMomentumScrollEnd={_onMomentumScrollEnd}
304
304
  onScrollEndDrag={_onScrollEndDrag}
305
305
  scrollEventThrottle={16}
306
- maintainVisibleContentPosition={{
307
- minIndexForVisible: 0,
308
- autoscrollToTopThreshold: 10,
309
- }}
310
306
  {...scrollViewExtraProps}
311
307
  />
312
308
  </ViewportTracker>
@@ -39,6 +39,10 @@ function getFeedUrl(feed: ZappFeed, index: number) {
39
39
  }
40
40
  }
41
41
 
42
+ const isNextIndex = (index, readyIndex) => {
43
+ return readyIndex + 1 >= index;
44
+ };
45
+
42
46
  /**
43
47
  * useLoadingState for RiverItemComponent
44
48
  * takes currentIndex and loadingState as arguments
@@ -48,24 +52,20 @@ const useLoadingState = (
48
52
  loadingState: RiverItemType["loadingState"]
49
53
  ) => {
50
54
  const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
51
- loadingState.getValue().index + 1 >= currentIndex
55
+ isNextIndex(currentIndex, loadingState.getValue().index)
52
56
  );
53
57
 
54
58
  useEffect(() => {
55
59
  const subscription = loadingState.subscribe(({ index }) => {
56
- if (index + 1 >= currentIndex) {
60
+ if (isNextIndex(currentIndex, index)) {
57
61
  setReadyToBeDisplayed(true);
58
62
  }
59
63
  });
60
64
 
61
- if (loadingState.getValue().index + 1 >= currentIndex) {
62
- setReadyToBeDisplayed(true);
63
- }
64
-
65
65
  return () => {
66
66
  subscription.unsubscribe();
67
67
  };
68
- }, [loadingState, currentIndex]);
68
+ }, [currentIndex]);
69
69
 
70
70
  return readyToBeDisplayed;
71
71
  };
@@ -151,7 +151,7 @@ function RiverItemComponent(props: RiverItemType) {
151
151
  component={item}
152
152
  componentIndex={index}
153
153
  onLoadFailed={onLoadFailed}
154
- onLoadFinished={() => onLoadFinished(index)} // Keeping it here to don't break the plugins.
154
+ onLoadFinished={() => onLoadFinished(index)}
155
155
  groupId={groupId}
156
156
  feedUrl={feedUrl}
157
157
  isLast={isLast}
@@ -26,7 +26,6 @@ type Props = {
26
26
  componentsMapExtraProps?: any;
27
27
  isInsideContainer?: boolean;
28
28
  extraAnchorPointYOffset: number;
29
- extraOffset: number;
30
29
  river?: ZappRiver | ZappEntry;
31
30
  };
32
31
 
@@ -39,7 +38,6 @@ export const River = (props: Props) => {
39
38
  componentsMapExtraProps,
40
39
  isInsideContainer,
41
40
  extraAnchorPointYOffset,
42
- extraOffset,
43
41
  } = props;
44
42
 
45
43
  const { title: screenTitle, summary: screenSummary } = useNavbarState();
@@ -120,7 +118,6 @@ export const River = (props: Props) => {
120
118
  <GeneralContentScreen
121
119
  feed={feedData}
122
120
  screenId={screenId}
123
- extraOffset={extraOffset}
124
121
  isScreenWrappedInContainer={isInsideContainer}
125
122
  extraAnchorPointYOffset={extraAnchorPointYOffset}
126
123
  componentsMapExtraProps={componentsMapExtraProps}
@@ -135,12 +135,6 @@ exports[`componentsMap renders renders components map correctly 1`] = `
135
135
  getItemCount={[Function]}
136
136
  initialNumToRender={3}
137
137
  keyExtractor={[Function]}
138
- maintainVisibleContentPosition={
139
- {
140
- "autoscrollToTopThreshold": 10,
141
- "minIndexForVisible": 0,
142
- }
143
- }
144
138
  maxToRenderPerBatch={10}
145
139
  onContentSizeChange={[Function]}
146
140
  onLayout={[Function]}