@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3640541630 → 13.0.0-alpha.3732093334
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.tsx +1 -2
- package/Components/Cell/Cell.tsx +4 -13
- package/Components/Cell/CellWithFocusable.tsx +50 -59
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/TvOSCellComponent.tsx +20 -22
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/index.js +3 -1
- 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/FocusableTvOS.tsx +5 -1
- 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/FocusableList/index.tsx +26 -9
- package/Components/FocusableScrollView/index.tsx +43 -13
- 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 +19 -23
- 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 +3 -2
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
- 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/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- 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 +8 -134
- package/Components/ModalComponent/BottomSheetModalContent.tsx +59 -43
- 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 +9 -8
- 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 +3 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
- package/Components/River/RiverItem.tsx +2 -1
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +37 -85
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- 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 +3 -6
- package/Components/Screen/index.tsx +4 -4
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Tabs/Tab.tsx +5 -3
- package/Components/TextInputTv/index.tsx +2 -1
- 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 +1 -1
- 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 +12 -68
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +46 -30
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +45 -21
- 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 +30 -0
- package/Components/VideoModal/PlayerDetails.tsx +18 -10
- package/Components/VideoModal/PlayerWrapper.tsx +37 -24
- package/Components/VideoModal/VideoModal.tsx +19 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/utils.ts +3 -4
- 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 +49 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +3 -10
- 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__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
- 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,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>
|
|
@@ -34,6 +34,7 @@ type Props = {
|
|
|
34
34
|
getStaticComponentFeed: any;
|
|
35
35
|
pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
|
|
36
36
|
refreshingPipesV1?: boolean;
|
|
37
|
+
stickyHeaderIndices?: number[];
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
const styles = StyleSheet.create({
|
|
@@ -61,6 +62,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
61
62
|
// TODO: Remove when pipes v1 is deprecated.
|
|
62
63
|
pullToRefreshPipesV1RefreshingStateUpdater,
|
|
63
64
|
refreshingPipesV1,
|
|
65
|
+
stickyHeaderIndices,
|
|
64
66
|
} = props;
|
|
65
67
|
|
|
66
68
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
@@ -274,6 +276,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
274
276
|
overScrollMode={Platform.OS === "android" ? "never" : "auto"}
|
|
275
277
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
276
278
|
extraData={feed}
|
|
279
|
+
stickyHeaderIndices={stickyHeaderIndices}
|
|
277
280
|
onLayout={handleOnLayout}
|
|
278
281
|
removeClippedSubviews
|
|
279
282
|
initialNumToRender={3}
|
|
@@ -28,10 +28,10 @@ type Return = {
|
|
|
28
28
|
// TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
|
|
29
29
|
const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
|
|
30
30
|
|
|
31
|
-
const createLoadingStateObservable = () =>
|
|
31
|
+
const createLoadingStateObservable = (count: number) =>
|
|
32
32
|
new BehaviorSubject<LoadingState>({
|
|
33
33
|
index: -1,
|
|
34
|
-
done:
|
|
34
|
+
done: count === 0,
|
|
35
35
|
waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
|
|
36
36
|
});
|
|
37
37
|
|
|
@@ -43,7 +43,7 @@ export const useLoadingState = (
|
|
|
43
43
|
const [loadingError, setLoadingError] = React.useState(null);
|
|
44
44
|
|
|
45
45
|
const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
|
|
46
|
-
createLoadingStateObservable
|
|
46
|
+
() => createLoadingStateObservable(count)
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const arePreviousComponentsLoaded = React.useCallback((index) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
+
import { isGroup } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
3
4
|
|
|
4
5
|
import { applyDecorators } from "../../Decorators";
|
|
5
6
|
|
|
@@ -112,7 +113,7 @@ function RiverItemComponent(props: RiverItemType) {
|
|
|
112
113
|
jsOnly: true,
|
|
113
114
|
});
|
|
114
115
|
|
|
115
|
-
if (!CellRenderer && item
|
|
116
|
+
if (!CellRenderer && !isGroup(item)) {
|
|
116
117
|
riverLogger.warning({
|
|
117
118
|
message: "Cell Renderer is null - will fallback to default cell",
|
|
118
119
|
data: { item, CellRenderer },
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { compose } from "ramda";
|
|
1
2
|
import { River as RiverComponent } from "./River";
|
|
2
3
|
import { withTvEventHandler } from "./withTVEventHandler";
|
|
4
|
+
import { withComponentsMapOffsetContext } from "../../../Contexts/ComponentsMapOffsetContext";
|
|
3
5
|
|
|
4
|
-
export const River =
|
|
6
|
+
export const River = compose(
|
|
7
|
+
withTvEventHandler,
|
|
8
|
+
withComponentsMapOffsetContext
|
|
9
|
+
)(RiverComponent);
|
|
@@ -22,126 +22,78 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
22
22
|
flatListHeight={null}
|
|
23
23
|
loadingState={
|
|
24
24
|
BehaviorSubject {
|
|
25
|
-
"_isScalar": false,
|
|
26
25
|
"_value": {
|
|
27
26
|
"done": false,
|
|
28
27
|
"index": -1,
|
|
29
28
|
"waitForAllComponents": false,
|
|
30
29
|
},
|
|
31
30
|
"closed": false,
|
|
31
|
+
"currentObservers": null,
|
|
32
32
|
"hasError": false,
|
|
33
33
|
"isStopped": false,
|
|
34
34
|
"observers": [
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"_subscriptions": null,
|
|
35
|
+
SafeSubscriber {
|
|
36
|
+
"_finalizers": [
|
|
37
|
+
Subscription {
|
|
38
|
+
"_finalizers": null,
|
|
39
|
+
"_parentage": [Circular],
|
|
41
40
|
"closed": false,
|
|
42
|
-
"
|
|
43
|
-
"subscriber": [Circular],
|
|
41
|
+
"initialTeardown": [Function],
|
|
44
42
|
},
|
|
45
43
|
],
|
|
44
|
+
"_parentage": null,
|
|
46
45
|
"closed": false,
|
|
47
|
-
"destination":
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"_next": [Function],
|
|
52
|
-
"_parentOrParents": null,
|
|
53
|
-
"_parentSubscriber": [Circular],
|
|
54
|
-
"_subscriptions": null,
|
|
55
|
-
"closed": false,
|
|
56
|
-
"destination": {
|
|
57
|
-
"closed": true,
|
|
58
|
-
"complete": [Function],
|
|
59
|
-
"error": [Function],
|
|
46
|
+
"destination": ConsumerObserver {
|
|
47
|
+
"partialObserver": {
|
|
48
|
+
"complete": undefined,
|
|
49
|
+
"error": undefined,
|
|
60
50
|
"next": [Function],
|
|
61
51
|
},
|
|
62
|
-
"isStopped": false,
|
|
63
|
-
"syncErrorThrowable": false,
|
|
64
|
-
"syncErrorThrown": false,
|
|
65
|
-
"syncErrorValue": null,
|
|
66
52
|
},
|
|
53
|
+
"initialTeardown": undefined,
|
|
67
54
|
"isStopped": false,
|
|
68
|
-
"syncErrorThrowable": true,
|
|
69
|
-
"syncErrorThrown": false,
|
|
70
|
-
"syncErrorValue": null,
|
|
71
55
|
},
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"_subscriptions": null,
|
|
56
|
+
SafeSubscriber {
|
|
57
|
+
"_finalizers": [
|
|
58
|
+
Subscription {
|
|
59
|
+
"_finalizers": null,
|
|
60
|
+
"_parentage": [Circular],
|
|
78
61
|
"closed": false,
|
|
79
|
-
"
|
|
80
|
-
"subscriber": [Circular],
|
|
62
|
+
"initialTeardown": [Function],
|
|
81
63
|
},
|
|
82
64
|
],
|
|
65
|
+
"_parentage": null,
|
|
83
66
|
"closed": false,
|
|
84
|
-
"destination":
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"_next": [Function],
|
|
89
|
-
"_parentOrParents": null,
|
|
90
|
-
"_parentSubscriber": [Circular],
|
|
91
|
-
"_subscriptions": null,
|
|
92
|
-
"closed": false,
|
|
93
|
-
"destination": {
|
|
94
|
-
"closed": true,
|
|
95
|
-
"complete": [Function],
|
|
96
|
-
"error": [Function],
|
|
67
|
+
"destination": ConsumerObserver {
|
|
68
|
+
"partialObserver": {
|
|
69
|
+
"complete": undefined,
|
|
70
|
+
"error": undefined,
|
|
97
71
|
"next": [Function],
|
|
98
72
|
},
|
|
99
|
-
"isStopped": false,
|
|
100
|
-
"syncErrorThrowable": false,
|
|
101
|
-
"syncErrorThrown": false,
|
|
102
|
-
"syncErrorValue": null,
|
|
103
73
|
},
|
|
74
|
+
"initialTeardown": undefined,
|
|
104
75
|
"isStopped": false,
|
|
105
|
-
"syncErrorThrowable": true,
|
|
106
|
-
"syncErrorThrown": false,
|
|
107
|
-
"syncErrorValue": null,
|
|
108
76
|
},
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
"_subscriptions": null,
|
|
77
|
+
SafeSubscriber {
|
|
78
|
+
"_finalizers": [
|
|
79
|
+
Subscription {
|
|
80
|
+
"_finalizers": null,
|
|
81
|
+
"_parentage": [Circular],
|
|
115
82
|
"closed": false,
|
|
116
|
-
"
|
|
117
|
-
"subscriber": [Circular],
|
|
83
|
+
"initialTeardown": [Function],
|
|
118
84
|
},
|
|
119
85
|
],
|
|
86
|
+
"_parentage": null,
|
|
120
87
|
"closed": false,
|
|
121
|
-
"destination":
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"_next": [Function],
|
|
126
|
-
"_parentOrParents": null,
|
|
127
|
-
"_parentSubscriber": [Circular],
|
|
128
|
-
"_subscriptions": null,
|
|
129
|
-
"closed": false,
|
|
130
|
-
"destination": {
|
|
131
|
-
"closed": true,
|
|
132
|
-
"complete": [Function],
|
|
133
|
-
"error": [Function],
|
|
88
|
+
"destination": ConsumerObserver {
|
|
89
|
+
"partialObserver": {
|
|
90
|
+
"complete": undefined,
|
|
91
|
+
"error": undefined,
|
|
134
92
|
"next": [Function],
|
|
135
93
|
},
|
|
136
|
-
"isStopped": false,
|
|
137
|
-
"syncErrorThrowable": false,
|
|
138
|
-
"syncErrorThrown": false,
|
|
139
|
-
"syncErrorValue": null,
|
|
140
94
|
},
|
|
95
|
+
"initialTeardown": undefined,
|
|
141
96
|
"isStopped": false,
|
|
142
|
-
"syncErrorThrowable": true,
|
|
143
|
-
"syncErrorThrown": false,
|
|
144
|
-
"syncErrorValue": null,
|
|
145
97
|
},
|
|
146
98
|
],
|
|
147
99
|
"thrownError": null,
|
|
@@ -1,89 +1,27 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`When River has a general_content type
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<RiverWithData
|
|
8
|
-
appData={
|
|
9
|
-
{
|
|
10
|
-
"layoutVersion": "v1",
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
dispatch={[Function]}
|
|
14
|
-
rivers={
|
|
15
|
-
{
|
|
16
|
-
"A1234": {
|
|
17
|
-
"home": true,
|
|
18
|
-
"id": "A1234",
|
|
19
|
-
"name": "foo",
|
|
20
|
-
"type": "general_content",
|
|
21
|
-
"ui_components": [
|
|
22
|
-
{
|
|
23
|
-
"component_type": "hero",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"component_type": "grid",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
"B4567": {
|
|
31
|
-
"id": "B4567",
|
|
32
|
-
},
|
|
33
|
-
"C0987": {
|
|
34
|
-
"home": false,
|
|
35
|
-
"id": "C0987",
|
|
36
|
-
"name": "Some-Screen-Plugin",
|
|
37
|
-
"type": "some-screen-plugin",
|
|
38
|
-
"ui_components": [],
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
screenId="A1234"
|
|
43
|
-
store={
|
|
44
|
-
{
|
|
45
|
-
"clearActions": [Function],
|
|
46
|
-
"dispatch": [Function],
|
|
47
|
-
"getActions": [Function],
|
|
48
|
-
"getState": [Function],
|
|
49
|
-
"replaceReducer": [Function],
|
|
50
|
-
"subscribe": [Function],
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/>
|
|
54
|
-
</ContextProvider>
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
exports[`When River has a general_content type <RiverComponent /> renders correctly 1`] = `
|
|
58
|
-
<GeneralContentScreen
|
|
59
|
-
groupId="ZF-C4"
|
|
60
|
-
screenId="A1234"
|
|
61
|
-
/>
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
exports[`When River has any other type other than general_content <RiverComponent /> renders correctly 1`] = `
|
|
65
|
-
<WithProvider
|
|
66
|
-
screenData={
|
|
3
|
+
exports[`When River has a general_content type renders River component correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
onLayout={[Function]}
|
|
6
|
+
style={
|
|
67
7
|
{
|
|
68
|
-
"
|
|
69
|
-
"home": false,
|
|
70
|
-
"id": "C0987",
|
|
71
|
-
"name": "Some-Screen-Plugin",
|
|
72
|
-
"type": "some-screen-plugin",
|
|
73
|
-
"ui_components": [],
|
|
8
|
+
"flex": 1,
|
|
74
9
|
}
|
|
75
10
|
}
|
|
76
|
-
|
|
77
|
-
screenType="some-screen-plugin"
|
|
78
|
-
/>
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
exports[`When River has feed url <RiverComponent /> renders correctly 1`] = `
|
|
82
|
-
<Connect(FeedLoaderComponent)
|
|
83
|
-
feedUrl="https://some-feed-url.net"
|
|
84
|
-
refreshCallback={[Function]}
|
|
85
|
-
refreshing={false}
|
|
11
|
+
testID="on-layout-view"
|
|
86
12
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
13
|
+
<View
|
|
14
|
+
style={
|
|
15
|
+
{
|
|
16
|
+
"display": "none",
|
|
17
|
+
"flex": 1,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
<View
|
|
22
|
+
screenId="A1234"
|
|
23
|
+
testID="general-content-screen"
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
</View>
|
|
89
27
|
`;
|
|
@@ -1,13 +1,50 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
2
|
+
import { render, screen } from "@testing-library/react-native";
|
|
4
3
|
import configureStore from "redux-mock-store";
|
|
4
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
5
|
+
import { Provider } from "react-redux";
|
|
5
6
|
|
|
6
|
-
import {
|
|
7
|
-
import { FeedLoader } from "../../FeedLoader";
|
|
8
|
-
import { River } from "../index";
|
|
9
|
-
import { RiverComponent } from "../River";
|
|
7
|
+
import { River } from "../";
|
|
10
8
|
import { ScreenResolver } from "../../ScreenResolver";
|
|
9
|
+
import { RiverComponent } from "../River";
|
|
10
|
+
|
|
11
|
+
jest.mock(
|
|
12
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
|
|
13
|
+
() => ({
|
|
14
|
+
useIsScreenActive: jest.fn(() => true),
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
jest.mock(
|
|
19
|
+
"@applicaster/zapp-react-native-ui-components/Components/GeneralContentScreen",
|
|
20
|
+
() => {
|
|
21
|
+
const { View } = jest.requireActual("react-native");
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
GeneralContentScreen: (props) => (
|
|
25
|
+
<View testID="general-content-screen" {...props} />
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
jest.mock(
|
|
32
|
+
"@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks",
|
|
33
|
+
() => ({
|
|
34
|
+
useScreenAnalytics: jest.fn(),
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
jest.mock(
|
|
39
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
|
|
40
|
+
() => ({
|
|
41
|
+
useNavigation: jest.fn(() => ({
|
|
42
|
+
videoModalState: {
|
|
43
|
+
mode: "test",
|
|
44
|
+
},
|
|
45
|
+
})),
|
|
46
|
+
})
|
|
47
|
+
);
|
|
11
48
|
|
|
12
49
|
const river = {
|
|
13
50
|
home: true,
|
|
@@ -55,24 +92,24 @@ const appData = { layoutVersion: "v1" };
|
|
|
55
92
|
const store = configureStore()({ rivers, appData });
|
|
56
93
|
|
|
57
94
|
describe("When River has a general_content type", () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
expect(wrapper.find(GeneralContentScreen).length).toBe(1);
|
|
67
|
-
});
|
|
95
|
+
it("renders GeneralContentScreen correctly", () => {
|
|
96
|
+
const { getByTestId } = render(
|
|
97
|
+
<Provider store={store}>
|
|
98
|
+
<RiverComponent {...riverProps} />
|
|
99
|
+
</Provider>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
expect(getByTestId("general-content-screen")).toBeTruthy();
|
|
68
103
|
});
|
|
69
104
|
|
|
70
|
-
|
|
71
|
-
const wrapper =
|
|
105
|
+
it("renders River component correctly", () => {
|
|
106
|
+
const wrapper = render(
|
|
107
|
+
<Provider store={store}>
|
|
108
|
+
<River screenId="A1234" />
|
|
109
|
+
</Provider>
|
|
110
|
+
);
|
|
72
111
|
|
|
73
|
-
|
|
74
|
-
expect(shallowToJson(wrapper)).toMatchSnapshot();
|
|
75
|
-
});
|
|
112
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
76
113
|
});
|
|
77
114
|
});
|
|
78
115
|
|
|
@@ -83,16 +120,10 @@ describe("When River has any other type other than general_content", () => {
|
|
|
83
120
|
appData,
|
|
84
121
|
};
|
|
85
122
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
describe("<RiverComponent />", () => {
|
|
89
|
-
it("renders correctly", () => {
|
|
90
|
-
expect(shallowToJson(wrapper)).toMatchSnapshot();
|
|
91
|
-
});
|
|
123
|
+
it("renders ScreenResolver correctly", () => {
|
|
124
|
+
renderWithProviders(<RiverComponent {...riverPropsWithScreenPlugin} />);
|
|
92
125
|
|
|
93
|
-
|
|
94
|
-
expect(wrapper.find(ScreenResolver).length).toBe(1);
|
|
95
|
-
});
|
|
126
|
+
expect(screen.UNSAFE_getByType(ScreenResolver)).toBeDefined();
|
|
96
127
|
});
|
|
97
128
|
});
|
|
98
129
|
|
|
@@ -104,15 +135,19 @@ describe("When River has feed url", () => {
|
|
|
104
135
|
appData: { layoutVersion: "v1" },
|
|
105
136
|
};
|
|
106
137
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
138
|
+
it("renders FeedLoader when layout is v1", () => {
|
|
139
|
+
const wrapper = renderWithProviders(
|
|
140
|
+
<RiverComponent {...riverPropsWithFeedUrl} />,
|
|
141
|
+
{
|
|
142
|
+
zappPipes: {
|
|
143
|
+
"https://some-feed-url.net": {
|
|
144
|
+
loading: false,
|
|
145
|
+
data: { entry: [] },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
expect(wrapper.getByTestId("general-content-screen")).toBeDefined();
|
|
117
152
|
});
|
|
118
153
|
});
|