@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1212224153 → 13.0.0-alpha.1244047241
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.
- package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AudioPlayer/AudioPlayer.tsx +5 -9
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/AudioPlayer/helpers.tsx +1 -2
- package/Components/BaseFocusable/index.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +2 -3
- package/Components/Cell/Cell.tsx +10 -16
- package/Components/Cell/CellWithFocusable.tsx +50 -59
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
- package/Components/CellRendererResolver/index.ts +2 -1
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/ErrorScreen/index.tsx +14 -6
- package/Components/Focusable/Focusable.tsx +1 -0
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/FocusableScrollView/index.tsx +6 -3
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
- package/Components/Layout/TV/LayoutBackground.tsx +28 -0
- package/Components/Layout/TV/NavBarContainer.tsx +14 -19
- package/Components/Layout/TV/ScreenContainer.tsx +8 -2
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
- package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
- package/Components/Layout/TV/index.tsx +6 -20
- package/Components/Layout/TV/index.web.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +9 -14
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +9 -135
- package/Components/ModalComponent/BottomSheetModalContent.tsx +49 -41
- package/Components/ModalComponent/Button/Item.tsx +6 -5
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +45 -62
- package/Components/ModalComponent/Header/index.tsx +12 -11
- package/Components/ModalComponent/utils.ts +55 -7
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +42 -15
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +53 -68
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +43 -3
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +107 -32
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/componentsMap.test.js +17 -5
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/__tests__/Screen.test.tsx +22 -14
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/Screen/hooks.ts +53 -0
- package/Components/Screen/index.tsx +16 -42
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Tabs/Tab.tsx +11 -9
- package/Components/TextInputTv/index.tsx +4 -3
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/Scene.tsx +53 -24
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -49
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -5
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +54 -30
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +47 -22
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +12 -6
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
- package/Components/VideoModal/ModalAnimation/const.ts +5 -0
- package/Components/VideoModal/ModalAnimation/index.ts +2 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +32 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +18 -10
- package/Components/VideoModal/PlayerWrapper.tsx +51 -57
- package/Components/VideoModal/VideoModal.tsx +17 -11
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +4 -5
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +4 -17
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +8 -5
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +6 -12
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +6 -2
- package/package.json +7 -11
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
-
import { PluginConfiguration } from "./
|
|
2
|
+
import { PluginConfiguration } from "./";
|
|
3
|
+
import { ItemIconProps } from "./Button/ItemIcon";
|
|
4
|
+
import { ItemLabelProps } from "./Button/ItemLabel";
|
|
5
|
+
import { ItemProps } from "./Button/Item";
|
|
3
6
|
|
|
4
7
|
export function defaultItemProps(
|
|
5
8
|
config: PluginConfiguration,
|
|
6
9
|
maxWidth: number
|
|
7
|
-
) {
|
|
10
|
+
): ItemProps {
|
|
8
11
|
const {
|
|
9
12
|
modal_bottom_sheet_item_background_color,
|
|
10
13
|
modal_bottom_sheet_item_focus_background_color,
|
|
11
14
|
modal_bottom_sheet_item_selected_background_color,
|
|
12
|
-
|
|
15
|
+
modal_bottom_sheet_item_focused_selected_background_color,
|
|
13
16
|
modal_bottom_sheet_item_corner_radius,
|
|
14
17
|
modal_bottom_sheet_item_margin_bottom,
|
|
15
18
|
modal_bottom_sheet_item_margin_left,
|
|
@@ -25,8 +28,8 @@ export function defaultItemProps(
|
|
|
25
28
|
backgroundColor: modal_bottom_sheet_item_background_color,
|
|
26
29
|
focusedBackgroundColor: modal_bottom_sheet_item_focus_background_color,
|
|
27
30
|
selectedBackgroundColor: modal_bottom_sheet_item_selected_background_color,
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
focusedSelectedBackgroundColor:
|
|
32
|
+
modal_bottom_sheet_item_focused_selected_background_color,
|
|
30
33
|
borderRadius: modal_bottom_sheet_item_corner_radius,
|
|
31
34
|
marginBottom: modal_bottom_sheet_item_margin_bottom,
|
|
32
35
|
marginTop: modal_bottom_sheet_item_margin_top,
|
|
@@ -43,7 +46,7 @@ export function defaultItemProps(
|
|
|
43
46
|
export function defaultItemLabelProps(
|
|
44
47
|
config: PluginConfiguration,
|
|
45
48
|
sheetWidth: number
|
|
46
|
-
) {
|
|
49
|
+
): ItemLabelProps {
|
|
47
50
|
const {
|
|
48
51
|
modal_bottom_sheet_item_label_android_letter_spacing,
|
|
49
52
|
modal_bottom_sheet_item_label_ios_letter_spacing,
|
|
@@ -103,7 +106,9 @@ export function defaultItemLabelProps(
|
|
|
103
106
|
};
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
export function defaultItemIconProps(
|
|
109
|
+
export function defaultItemIconProps(
|
|
110
|
+
config: PluginConfiguration
|
|
111
|
+
): ItemIconProps {
|
|
107
112
|
const {
|
|
108
113
|
modal_bottom_sheet_item_icon_height,
|
|
109
114
|
modal_bottom_sheet_item_icon_width,
|
|
@@ -124,3 +129,46 @@ export function defaultItemIconProps(config: PluginConfiguration) {
|
|
|
124
129
|
marginRight: modal_bottom_sheet_item_icon_margin_right,
|
|
125
130
|
};
|
|
126
131
|
}
|
|
132
|
+
|
|
133
|
+
export function getItemIconProps(
|
|
134
|
+
theme: PluginConfiguration,
|
|
135
|
+
iconProps?: ((theme: PluginConfiguration) => ItemIconProps) | ItemIconProps
|
|
136
|
+
) {
|
|
137
|
+
if (iconProps) {
|
|
138
|
+
return typeof iconProps === "function" ? iconProps(theme) : iconProps;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return defaultItemIconProps(theme);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function getItemLabelProps(
|
|
145
|
+
theme: PluginConfiguration,
|
|
146
|
+
width: number,
|
|
147
|
+
labelProps?:
|
|
148
|
+
| ((theme: PluginConfiguration, width: number) => ItemLabelProps)
|
|
149
|
+
| ItemLabelProps
|
|
150
|
+
) {
|
|
151
|
+
if (labelProps) {
|
|
152
|
+
return typeof labelProps === "function"
|
|
153
|
+
? labelProps(theme, width)
|
|
154
|
+
: labelProps;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return defaultItemLabelProps(theme, width);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function getItemProps(
|
|
161
|
+
theme: PluginConfiguration,
|
|
162
|
+
width: number,
|
|
163
|
+
itemProps?:
|
|
164
|
+
| ((theme: PluginConfiguration, width: number) => ItemProps)
|
|
165
|
+
| ItemProps
|
|
166
|
+
) {
|
|
167
|
+
if (itemProps) {
|
|
168
|
+
return typeof itemProps === "function"
|
|
169
|
+
? itemProps(theme, width)
|
|
170
|
+
: itemProps;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return defaultItemProps(theme, width);
|
|
174
|
+
}
|
|
@@ -90,7 +90,7 @@ export const NotificationView = (props: Props) => {
|
|
|
90
90
|
return (
|
|
91
91
|
<div onClick={onClose}>
|
|
92
92
|
{children}
|
|
93
|
-
{open
|
|
93
|
+
{open ? (
|
|
94
94
|
<div style={styles.body}>
|
|
95
95
|
<div style={styles.title}>
|
|
96
96
|
<h2>{MSG}</h2>
|
|
@@ -98,7 +98,7 @@ export const NotificationView = (props: Props) => {
|
|
|
98
98
|
|
|
99
99
|
<h4 style={styles.subtitle}>{EXTRA_MSG}</h4>
|
|
100
100
|
</div>
|
|
101
|
-
)}
|
|
101
|
+
) : null}
|
|
102
102
|
</div>
|
|
103
103
|
);
|
|
104
104
|
};
|
|
@@ -85,7 +85,7 @@ export const NotificationView = (props: Props) => {
|
|
|
85
85
|
return (
|
|
86
86
|
<div onClick={onClose}>
|
|
87
87
|
{children}
|
|
88
|
-
{shown
|
|
88
|
+
{shown ? (
|
|
89
89
|
<div style={styles.body}>
|
|
90
90
|
<div style={styles.title}>
|
|
91
91
|
<h2>{title}</h2>
|
|
@@ -93,7 +93,7 @@ export const NotificationView = (props: Props) => {
|
|
|
93
93
|
|
|
94
94
|
<h4 style={styles.subtitle}>{subtitle}</h4>
|
|
95
95
|
</div>
|
|
96
|
-
)}
|
|
96
|
+
) : null}
|
|
97
97
|
</div>
|
|
98
98
|
);
|
|
99
99
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, Animated } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { shallow } from "enzyme";
|
|
5
4
|
import renderer from "react-test-renderer";
|
|
6
5
|
|
|
7
6
|
jest.useFakeTimers();
|
|
@@ -40,10 +39,6 @@ const {
|
|
|
40
39
|
} = require("../NotificationView");
|
|
41
40
|
|
|
42
41
|
describe("NotificationView", () => {
|
|
43
|
-
it("renders", () => {
|
|
44
|
-
shallow(<NotificationView dismiss={dismiss} />);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
42
|
it("Show online message when Online", () => {
|
|
48
43
|
const component = renderer.create(
|
|
49
44
|
<NotificationView online dismiss={dismiss} />
|
|
@@ -57,7 +57,7 @@ export const useNotificationHeight = () => {
|
|
|
57
57
|
|
|
58
58
|
const navBarHeight = platformSelect({ ios: 44, android: 56 });
|
|
59
59
|
|
|
60
|
-
const statusHeight =
|
|
60
|
+
const statusHeight = insets.top;
|
|
61
61
|
const notificationHeight = statusHeight + navBarHeight;
|
|
62
62
|
|
|
63
63
|
return { statusHeight, notificationHeight };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { useEffect, useReducer } from "react";
|
|
2
3
|
// @ts-ignore
|
|
3
|
-
import { View, ViewStyle
|
|
4
|
+
import { TVMenuControl, View, ViewStyle } from "react-native";
|
|
4
5
|
import * as R from "ramda";
|
|
5
6
|
import uuid from "uuid/v4";
|
|
6
7
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
7
8
|
import {
|
|
8
9
|
isApplePlatform,
|
|
9
|
-
platformSelect,
|
|
10
10
|
isTV,
|
|
11
|
+
platformSelect,
|
|
12
|
+
isAndroidTVPlatform,
|
|
11
13
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
12
14
|
|
|
13
15
|
import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
|
|
14
|
-
import { useEffect, useReducer } from "react";
|
|
15
16
|
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
16
17
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
17
18
|
import {
|
|
@@ -29,10 +30,10 @@ import {
|
|
|
29
30
|
import { ProgramInfo } from "./ProgramInfo";
|
|
30
31
|
import { AudioPlayer } from "../AudioPlayer";
|
|
31
32
|
import {
|
|
32
|
-
playerContainerLogger,
|
|
33
33
|
log_debug,
|
|
34
34
|
log_info,
|
|
35
35
|
log_warning,
|
|
36
|
+
playerContainerLogger,
|
|
36
37
|
} from "./logger";
|
|
37
38
|
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
38
39
|
import { useSetNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
@@ -53,8 +54,8 @@ import { usePlayNextOverlay } from "@applicaster/zapp-react-native-utils/appUtil
|
|
|
53
54
|
import { PlayNextState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/OverlaysObserver";
|
|
54
55
|
|
|
55
56
|
import {
|
|
56
|
-
useModalAnimationContext,
|
|
57
57
|
PlayerAnimationStateEnum,
|
|
58
|
+
useModalAnimationContext,
|
|
58
59
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
59
60
|
|
|
60
61
|
type Props = {
|
|
@@ -93,6 +94,20 @@ export type PlayNextData = {
|
|
|
93
94
|
|
|
94
95
|
const focusableBottomContainerId = "player-container-bottom";
|
|
95
96
|
|
|
97
|
+
const isAndroidTV = isAndroidTVPlatform();
|
|
98
|
+
|
|
99
|
+
const withBorderHack = () => {
|
|
100
|
+
if (isAndroidTV) {
|
|
101
|
+
/* @HACK: see GH#7269 */
|
|
102
|
+
return {
|
|
103
|
+
borderWidth: 1,
|
|
104
|
+
borderColor: "transparent",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {};
|
|
109
|
+
};
|
|
110
|
+
|
|
96
111
|
// Styles
|
|
97
112
|
const webStyles = {
|
|
98
113
|
focusableGroup: {
|
|
@@ -335,9 +350,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
335
350
|
|
|
336
351
|
const resumeTime = Number(item?.extensions?.resumeTime);
|
|
337
352
|
|
|
338
|
-
//
|
|
353
|
+
// Сhecking that the player itself knows where to start playing, and there is no need to call seekTo after returning from the Сhromecast
|
|
339
354
|
if (
|
|
340
|
-
|
|
355
|
+
!playerManager.getActivePlayer()?.hasResumePosition() &&
|
|
341
356
|
!isNaN(resumeTime)
|
|
342
357
|
) {
|
|
343
358
|
player?.seekTo(resumeTime);
|
|
@@ -514,6 +529,12 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
514
529
|
useEffect(() => {
|
|
515
530
|
playerEvent("source_changed", { item });
|
|
516
531
|
|
|
532
|
+
return () => {
|
|
533
|
+
playerEvent("player_did_close", { item });
|
|
534
|
+
};
|
|
535
|
+
}, [item?.id, Player]);
|
|
536
|
+
|
|
537
|
+
useEffect(() => {
|
|
517
538
|
if (!isModal) {
|
|
518
539
|
showNavBar(false);
|
|
519
540
|
}
|
|
@@ -523,13 +544,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
523
544
|
}
|
|
524
545
|
|
|
525
546
|
return () => {
|
|
526
|
-
playerEvent("player_did_close", { item });
|
|
527
|
-
|
|
528
547
|
if (!isModal) {
|
|
529
548
|
showNavBar(true);
|
|
530
549
|
}
|
|
531
550
|
};
|
|
532
|
-
}, [showNavBar,
|
|
551
|
+
}, [showNavBar, isModal, Player]);
|
|
533
552
|
|
|
534
553
|
useEffect(() => {
|
|
535
554
|
if (prevItemId && !R.equals(prevItemId, item?.id)) {
|
|
@@ -578,7 +597,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
578
597
|
);
|
|
579
598
|
}
|
|
580
599
|
|
|
581
|
-
if (screen_background_color) {
|
|
600
|
+
if (screen_background_color && mode !== VideoModalMode.FULLSCREEN) {
|
|
582
601
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
583
602
|
}
|
|
584
603
|
|
|
@@ -596,6 +615,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
596
615
|
tv_component_container_height,
|
|
597
616
|
screen_background_color,
|
|
598
617
|
isInlineTV,
|
|
618
|
+
mode,
|
|
599
619
|
]);
|
|
600
620
|
|
|
601
621
|
const applePlayerProps = {
|
|
@@ -640,7 +660,14 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
640
660
|
testID={"player-screen-container"}
|
|
641
661
|
>
|
|
642
662
|
{/* Player container */}
|
|
643
|
-
<View
|
|
663
|
+
<View
|
|
664
|
+
style={[
|
|
665
|
+
styles.playerWrapper,
|
|
666
|
+
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
667
|
+
withBorderHack(),
|
|
668
|
+
]}
|
|
669
|
+
testID={"player-wrapper"}
|
|
670
|
+
>
|
|
644
671
|
<PlayerFocusableWrapperView
|
|
645
672
|
nextFocusDown={context.bottomFocusableId}
|
|
646
673
|
>
|
|
@@ -683,10 +710,10 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
683
710
|
|
|
684
711
|
{renderRestPlayers(restPlayerProps)}
|
|
685
712
|
|
|
686
|
-
{state.error
|
|
713
|
+
{state.error ? <ErrorDisplay error={state.error} /> : null}
|
|
687
714
|
</View>
|
|
688
715
|
{/* Components container */}
|
|
689
|
-
{isInlineTV && context.showComponentsContainer
|
|
716
|
+
{isInlineTV && context.showComponentsContainer ? (
|
|
690
717
|
<View
|
|
691
718
|
style={styles.inlineRiver}
|
|
692
719
|
testID={"inline-river-component-wrapper"}
|
|
@@ -717,7 +744,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
717
744
|
)}
|
|
718
745
|
</ComponentFocusableWrapperView>
|
|
719
746
|
</View>
|
|
720
|
-
)}
|
|
747
|
+
) : null}
|
|
721
748
|
</View>
|
|
722
749
|
</FocusableGroup>
|
|
723
750
|
</TVEventHandlerComponent>
|
|
@@ -114,12 +114,12 @@ function ProgramInfoComponent({
|
|
|
114
114
|
return (
|
|
115
115
|
<View style={container}>
|
|
116
116
|
<View style={programStyles.programInfo.container}>
|
|
117
|
-
{logo
|
|
117
|
+
{logo ? (
|
|
118
118
|
<Image
|
|
119
119
|
source={{ uri: logo }}
|
|
120
120
|
style={programStyles.programInfo.logo}
|
|
121
121
|
/>
|
|
122
|
-
)}
|
|
122
|
+
) : null}
|
|
123
123
|
{!isAudioContent && transportInfo}
|
|
124
124
|
</View>
|
|
125
125
|
</View>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { View, StyleSheet,
|
|
3
|
+
import { View, StyleSheet, FlatList } from "react-native";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
import { RiverItem } from "../RiverItem";
|
|
6
6
|
import { RiverFooter } from "../RiverFooter";
|
|
@@ -24,6 +24,10 @@ import { withComponentsMapProvider } from "@applicaster/zapp-react-native-ui-com
|
|
|
24
24
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
25
25
|
import { useShallow } from "zustand/react/shallow";
|
|
26
26
|
|
|
27
|
+
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
28
|
+
|
|
29
|
+
const isAndroid = isAndroidPlatform();
|
|
30
|
+
|
|
27
31
|
type Props = {
|
|
28
32
|
feed: ZappFeed;
|
|
29
33
|
groupId?: string;
|
|
@@ -34,6 +38,7 @@ type Props = {
|
|
|
34
38
|
getStaticComponentFeed: any;
|
|
35
39
|
pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
|
|
36
40
|
refreshingPipesV1?: boolean;
|
|
41
|
+
stickyHeaderIndices?: number[];
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
const styles = StyleSheet.create({
|
|
@@ -61,6 +66,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
61
66
|
// TODO: Remove when pipes v1 is deprecated.
|
|
62
67
|
pullToRefreshPipesV1RefreshingStateUpdater,
|
|
63
68
|
refreshingPipesV1,
|
|
69
|
+
stickyHeaderIndices,
|
|
64
70
|
} = props;
|
|
65
71
|
|
|
66
72
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
@@ -70,21 +76,6 @@ function ComponentsMapComponent(props: Props) {
|
|
|
70
76
|
|
|
71
77
|
const [flatListHeight, setFlatListHeight] = React.useState(null);
|
|
72
78
|
|
|
73
|
-
const {
|
|
74
|
-
isAnyLoading,
|
|
75
|
-
isAllLoaded,
|
|
76
|
-
waitForAllComponents,
|
|
77
|
-
onLoadFinished,
|
|
78
|
-
onLoadFailed,
|
|
79
|
-
shouldShowLoadingError,
|
|
80
|
-
isAnyLoaded,
|
|
81
|
-
arePreviousComponentsLoaded,
|
|
82
|
-
} = useLoadingState(feed?.entry?.length || components.length);
|
|
83
|
-
|
|
84
|
-
const theme = useTheme();
|
|
85
|
-
|
|
86
|
-
const logTimestamp = useProfilerLogging();
|
|
87
|
-
|
|
88
79
|
const riverComponents = React.useMemo(() => {
|
|
89
80
|
if (feed?.entry?.length < components.length) {
|
|
90
81
|
return R.slice(0, feed?.entry?.length, components);
|
|
@@ -93,55 +84,42 @@ function ComponentsMapComponent(props: Props) {
|
|
|
93
84
|
return components;
|
|
94
85
|
}, [components, feed]);
|
|
95
86
|
|
|
87
|
+
const logTimestamp = useProfilerLogging();
|
|
88
|
+
|
|
89
|
+
const onLoadDone = React.useCallback(() => {
|
|
90
|
+
logTimestamp(riverId?.toString());
|
|
91
|
+
}, [logTimestamp]);
|
|
92
|
+
|
|
93
|
+
const { loadingState, onLoadFinished, onLoadFailed, shouldShowLoadingError } =
|
|
94
|
+
useLoadingState(riverComponents.length, onLoadDone);
|
|
95
|
+
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
|
|
96
98
|
const renderRiverItem = React.useCallback(
|
|
97
99
|
({ item, index }) => {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const riverItemProps = {
|
|
101
|
+
riverId,
|
|
102
|
+
item,
|
|
103
|
+
index,
|
|
104
|
+
isScreenWrappedInContainer,
|
|
105
|
+
feed,
|
|
106
|
+
groupId,
|
|
107
|
+
onLoadFailed,
|
|
108
|
+
onLoadFinished,
|
|
109
|
+
getStaticComponentFeed,
|
|
110
|
+
isLast: isLast(index, riverComponents.length),
|
|
111
|
+
loadingState,
|
|
102
112
|
};
|
|
103
113
|
|
|
104
114
|
return (
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
{...{
|
|
109
|
-
readyToBeDisplayed,
|
|
110
|
-
riverId,
|
|
111
|
-
item,
|
|
112
|
-
index,
|
|
113
|
-
isScreenWrappedInContainer,
|
|
114
|
-
feed,
|
|
115
|
-
groupId,
|
|
116
|
-
onLoadFailed,
|
|
117
|
-
onLoadFinished,
|
|
118
|
-
getStaticComponentFeed,
|
|
119
|
-
isLast: isLast(index, riverComponents.length),
|
|
120
|
-
}}
|
|
121
|
-
/>
|
|
122
|
-
</ScreenLoadingMeasurementsListItemWrapper>
|
|
123
|
-
</View>
|
|
115
|
+
<ScreenLoadingMeasurementsListItemWrapper index={index}>
|
|
116
|
+
<RiverItem {...riverItemProps} />
|
|
117
|
+
</ScreenLoadingMeasurementsListItemWrapper>
|
|
124
118
|
);
|
|
125
119
|
},
|
|
126
|
-
[
|
|
127
|
-
feed,
|
|
128
|
-
getStaticComponentFeed,
|
|
129
|
-
arePreviousComponentsLoaded,
|
|
130
|
-
onLoadFailed,
|
|
131
|
-
onLoadFinished,
|
|
132
|
-
]
|
|
120
|
+
[feed, getStaticComponentFeed, onLoadFailed, onLoadFinished]
|
|
133
121
|
);
|
|
134
122
|
|
|
135
|
-
const renderFooter = React.useCallback(() => {
|
|
136
|
-
return (
|
|
137
|
-
<RiverFooter
|
|
138
|
-
visible={isAnyLoading}
|
|
139
|
-
flatListHeight={flatListHeight}
|
|
140
|
-
isAnyLoaded={isAnyLoaded || waitForAllComponents}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
}, [flatListHeight, isAnyLoading, isAnyLoaded]);
|
|
144
|
-
|
|
145
123
|
const screenStyle = React.useMemo(
|
|
146
124
|
() => ({
|
|
147
125
|
paddingTop: ifEmptyUseFallback(
|
|
@@ -179,12 +157,6 @@ function ComponentsMapComponent(props: Props) {
|
|
|
179
157
|
|
|
180
158
|
usePipesCacheReset(riverId, riverComponents);
|
|
181
159
|
|
|
182
|
-
React.useEffect(() => {
|
|
183
|
-
if (isAllLoaded) {
|
|
184
|
-
logTimestamp(riverId?.toString());
|
|
185
|
-
}
|
|
186
|
-
}, [isAllLoaded]);
|
|
187
|
-
|
|
188
160
|
const refreshControl = React.useMemo(
|
|
189
161
|
() =>
|
|
190
162
|
pullToRefreshEnabled ? (
|
|
@@ -280,6 +252,11 @@ function ComponentsMapComponent(props: Props) {
|
|
|
280
252
|
}
|
|
281
253
|
}, []);
|
|
282
254
|
|
|
255
|
+
const contentContainerStyle = React.useMemo(
|
|
256
|
+
() => (isScreenWrappedInContainer ? {} : screenStyle),
|
|
257
|
+
[isScreenWrappedInContainer, screenStyle]
|
|
258
|
+
);
|
|
259
|
+
|
|
283
260
|
if (shouldShowLoadingError) {
|
|
284
261
|
return <RiverError />;
|
|
285
262
|
}
|
|
@@ -291,7 +268,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
291
268
|
<View style={styles.container}>
|
|
292
269
|
<ScreenLoadingMeasurements
|
|
293
270
|
riverId={riverId}
|
|
294
|
-
numberOfComponents={
|
|
271
|
+
numberOfComponents={riverComponents.length}
|
|
295
272
|
>
|
|
296
273
|
<ViewportTracker>
|
|
297
274
|
<FlatList
|
|
@@ -300,11 +277,12 @@ function ComponentsMapComponent(props: Props) {
|
|
|
300
277
|
}}
|
|
301
278
|
// Fix for WebView rerender crashes on Android API 28+
|
|
302
279
|
// https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-964035468
|
|
303
|
-
overScrollMode={
|
|
280
|
+
overScrollMode={isAndroid ? "never" : "auto"}
|
|
304
281
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
305
282
|
extraData={feed}
|
|
283
|
+
stickyHeaderIndices={stickyHeaderIndices}
|
|
306
284
|
onLayout={handleOnLayout}
|
|
307
|
-
removeClippedSubviews
|
|
285
|
+
removeClippedSubviews={isAndroid}
|
|
308
286
|
initialNumToRender={3}
|
|
309
287
|
maxToRenderPerBatch={10}
|
|
310
288
|
windowSize={12}
|
|
@@ -312,16 +290,23 @@ function ComponentsMapComponent(props: Props) {
|
|
|
312
290
|
keyExtractor={keyExtractor}
|
|
313
291
|
renderItem={renderRiverItem}
|
|
314
292
|
data={riverComponents}
|
|
315
|
-
contentContainerStyle={
|
|
316
|
-
|
|
293
|
+
contentContainerStyle={contentContainerStyle}
|
|
294
|
+
ListFooterComponent={
|
|
295
|
+
<RiverFooter
|
|
296
|
+
flatListHeight={flatListHeight}
|
|
297
|
+
loadingState={loadingState}
|
|
298
|
+
/>
|
|
317
299
|
}
|
|
318
|
-
ListFooterComponent={renderFooter}
|
|
319
300
|
refreshControl={refreshControl}
|
|
320
301
|
onScrollBeginDrag={onScrollBeginDrag}
|
|
321
302
|
onScroll={onScroll}
|
|
322
303
|
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
323
304
|
onScrollEndDrag={_onScrollEndDrag}
|
|
324
305
|
scrollEventThrottle={16}
|
|
306
|
+
maintainVisibleContentPosition={{
|
|
307
|
+
minIndexForVisible: 0,
|
|
308
|
+
autoscrollToTopThreshold: 10,
|
|
309
|
+
}}
|
|
325
310
|
{...scrollViewExtraProps}
|
|
326
311
|
/>
|
|
327
312
|
</ViewportTracker>
|