@applicaster/zapp-react-native-ui-components 12.0.0-rc.10 → 12.0.0-rc.101
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/AudioPlayer/AudioPlayer.tsx +9 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.tsx +3 -3
- package/Components/Cell/Cell.tsx +32 -11
- package/Components/Cell/CellWithFocusable.tsx +40 -19
- package/Components/Cell/TvOSCellComponent.tsx +5 -9
- package/Components/ErrorScreen/index.tsx +1 -1
- package/Components/Focusable/Focusable.tsx +6 -1
- package/Components/FocusableCell/index.tsx +7 -7
- package/Components/FocusableGroup/index.tsx +11 -2
- package/Components/FocusableList/FocusableChild.ts +24 -14
- package/Components/FocusableList/FocusableItem.tsx +1 -1
- package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
- package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
- package/Components/FocusableList/index.tsx +26 -25
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +4 -1
- package/Components/HookRenderer/index.tsx +1 -6
- package/Components/Image/Image.android.tsx +3 -26
- package/Components/Image/Image.tsx +18 -2
- package/Components/Image/utils/index.ts +39 -0
- package/Components/Layout/TV/ScreenContainer.tsx +79 -5
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +20 -108
- package/Components/Layout/TV/index.tsx +15 -84
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +88 -113
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +37 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
- package/Components/MasterCell/dataAdapter.ts +21 -7
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/index.tsx +3 -1
- package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
- package/Components/MasterCell/utils/index.ts +33 -35
- package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
- package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
- package/Components/ModalComponent/Button/Item.tsx +82 -0
- package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
- package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
- package/Components/ModalComponent/Button/assets.ts +4 -0
- package/Components/ModalComponent/Button/index.tsx +111 -0
- package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
- package/Components/ModalComponent/Header/Title.tsx +70 -0
- package/Components/ModalComponent/Header/assets.ts +4 -0
- package/Components/ModalComponent/Header/index.tsx +71 -0
- package/Components/ModalComponent/Header/utils.ts +79 -0
- package/Components/ModalComponent/index.tsx +38 -0
- package/Components/ModalComponent/utils.ts +126 -0
- package/Components/Navigator/StackNavigator.tsx +57 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +66 -31
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
- package/Components/PlayerImageBackground/index.tsx +34 -8
- package/Components/River/ComponentsMap/ComponentsMap.tsx +97 -2
- package/Components/River/RefreshControl.tsx +55 -1
- package/Components/River/River.tsx +8 -5
- package/Components/River/TV/River.tsx +2 -25
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/River/__tests__/componentsMap.test.js +7 -0
- package/Components/River/useScreenConfiguration.ts +2 -2
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
- package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
- package/Components/RouteManager/index.tsx +4 -2
- package/Components/Screen/TV/hooks/index.ts +3 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
- package/Components/Screen/TV/index.web.tsx +165 -0
- package/Components/Screen/__tests__/Screen.test.tsx +91 -74
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
- package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
- package/Components/Screen/index.tsx +110 -54
- package/Components/Screen/navigationHandler.ts +5 -82
- package/Components/ScreenResolver/index.tsx +10 -13
- package/Components/Tabs/TV/styles.ts +1 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/Transitioner/Scene.tsx +32 -26
- package/Components/Transitioner/Transitioner.tsx +21 -28
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +70 -14
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +132 -95
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +21 -29
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +66 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +355 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +161 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +456 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +182 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +302 -0
- package/Components/VideoModal/PlayerDetails.tsx +6 -3
- package/Components/VideoModal/PlayerWrapper.tsx +81 -49
- package/Components/VideoModal/VideoModal.tsx +23 -40
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +266 -166
- package/Components/VideoModal/hooks/useModalSize.ts +10 -12
- package/Components/VideoModal/utils.ts +8 -5
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
- package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
- package/Components/Viewport/ViewportTracker/index.tsx +1 -0
- package/Components/Viewport/utils.js +1 -1
- package/Components/ZappUIComponent/index.tsx +22 -12
- package/Components/index.js +2 -0
- package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
- package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
- package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
- package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
- package/Contexts/FocusableGroupContext/index.ts +7 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
- package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
- package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
- package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
- package/Contexts/ScreenContext/index.tsx +95 -29
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
- package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
- package/Decorators/RiverResolver/index.tsx +0 -4
- package/Decorators/index.tsx +0 -4
- package/events/index.ts +1 -0
- package/package.json +5 -6
- package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
- package/Components/VideoModal/hooks/usePosition.ts +0 -50
- /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
- /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
- /package/Contexts/{index.js → index.ts} +0 -0
|
@@ -2,58 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Layout TV renders 1`] = `
|
|
4
4
|
<View
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"height": 1080,
|
|
9
|
-
"width": 1920,
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
testID="layout-container"
|
|
5
|
+
excludeFromFocusSearching={true}
|
|
6
|
+
id="/river/A1234"
|
|
7
|
+
preferredFocus={true}
|
|
13
8
|
>
|
|
14
9
|
<View
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
style={
|
|
20
|
-
Array [
|
|
21
|
-
Object {
|
|
22
|
-
"position": "absolute",
|
|
23
|
-
"top": 0,
|
|
24
|
-
"width": 1920,
|
|
25
|
-
"zIndex": 10,
|
|
26
|
-
},
|
|
27
|
-
Object {
|
|
28
|
-
"maxHeight": 10,
|
|
29
|
-
},
|
|
30
|
-
]
|
|
10
|
+
Components={
|
|
11
|
+
Object {
|
|
12
|
+
"Background": [Function],
|
|
13
|
+
"NavBar": [Function],
|
|
31
14
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
isVisible={true}
|
|
36
|
-
menuPlugin={
|
|
37
|
-
Object {
|
|
38
|
-
"module": [Function],
|
|
39
|
-
"name": "resolved-menu-plug",
|
|
40
|
-
"type": "menu",
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
navigationProps={
|
|
44
|
-
Object {
|
|
45
|
-
"assets": undefined,
|
|
46
|
-
"home": undefined,
|
|
47
|
-
"nav_items": undefined,
|
|
48
|
-
"rules": undefined,
|
|
49
|
-
"selected": undefined,
|
|
50
|
-
"styles": undefined,
|
|
51
|
-
"title": "",
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
testID="nav-bar-component"
|
|
55
|
-
/>
|
|
56
|
-
</View>
|
|
57
|
-
</View>
|
|
15
|
+
}
|
|
16
|
+
route="/river/A1234"
|
|
17
|
+
/>
|
|
58
18
|
</View>
|
|
59
19
|
`;
|
|
@@ -1,91 +1,49 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { omit } from "ramda";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { render } from "@testing-library/react-native";
|
|
5
5
|
import { Provider } from "react-redux";
|
|
6
|
-
import { createStore } from "redux";
|
|
7
6
|
import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
|
|
7
|
+
import configureStore from "redux-mock-store";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const withoutChildren = omit(["children"]);
|
|
10
10
|
|
|
11
|
-
jest.mock("
|
|
12
|
-
|
|
11
|
+
jest.mock("../../../Screen/TV/index.web", () => ({
|
|
12
|
+
Screen: View,
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
useCurrentScreenData: jest.fn(() => ({
|
|
17
|
-
navigations: [
|
|
18
|
-
{
|
|
19
|
-
category: "menu",
|
|
20
|
-
navigation_type: "menu",
|
|
21
|
-
styles: {
|
|
22
|
-
hide_secondary_level_menu: false,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
})),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
const Layout = require("..").default;
|
|
30
|
-
|
|
31
|
-
const ResolvedMenuPlug = () => <View testID="resolved-menu-plug" />;
|
|
15
|
+
const Layout = require("../index.web").default;
|
|
32
16
|
|
|
33
|
-
const
|
|
34
|
-
{
|
|
35
|
-
module: ResolvedMenuPlug,
|
|
36
|
-
type: "menu",
|
|
37
|
-
name: "resolved-menu-plug",
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
const bgImage = "http://applicaster.com";
|
|
42
|
-
const isNavBarVisible = true;
|
|
43
|
-
|
|
44
|
-
const store = createStore(() => ({
|
|
17
|
+
const mockStore = configureStore()({
|
|
45
18
|
appState: { appReady: true },
|
|
46
|
-
|
|
47
|
-
plugins,
|
|
48
|
-
}));
|
|
19
|
+
});
|
|
49
20
|
|
|
50
21
|
describe("Layout TV", () => {
|
|
51
|
-
const themes = {
|
|
52
|
-
myTheme: { screen_margin_top: 10, screen_margin_bottom: 10 },
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const selectedThemeId = "myTheme";
|
|
56
|
-
|
|
57
22
|
const navigator = {
|
|
58
|
-
activeRiver: {
|
|
59
|
-
navigations: [{ category: "menu", navigation_type: "menu" }],
|
|
60
|
-
},
|
|
61
|
-
canGoBack: () => false,
|
|
62
23
|
currentRoute: "/river/A1234",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
24
|
+
canGoBack: jest.fn(),
|
|
25
|
+
mainStack: [
|
|
26
|
+
{
|
|
27
|
+
route: "/river/A1234",
|
|
28
|
+
state: { screen: {} },
|
|
29
|
+
},
|
|
30
|
+
],
|
|
67
31
|
};
|
|
68
32
|
|
|
69
33
|
const wrapper = ({ children }) => (
|
|
70
|
-
<Provider store={
|
|
34
|
+
<Provider store={mockStore}>
|
|
71
35
|
<NavigationContext.Provider value={navigator}>
|
|
72
|
-
|
|
73
|
-
{children}
|
|
74
|
-
</ThemeContext.Provider>
|
|
36
|
+
{children}
|
|
75
37
|
</NavigationContext.Provider>
|
|
76
38
|
</Provider>
|
|
77
39
|
);
|
|
78
40
|
|
|
79
|
-
const Screen = (props) => (
|
|
80
|
-
<View testID="screen-component" {...R.omit(["children"])(props)} />
|
|
81
|
-
);
|
|
82
|
-
|
|
83
41
|
const NavBar = (props) => (
|
|
84
|
-
<View testID="nav-bar-component" {...
|
|
42
|
+
<View testID="nav-bar-component" {...withoutChildren(props)} />
|
|
85
43
|
);
|
|
86
44
|
|
|
87
45
|
const Background = (props: Record<any, any>) => (
|
|
88
|
-
<View testID="background-component" {...
|
|
46
|
+
<View testID="background-component" {...withoutChildren(props)}>
|
|
89
47
|
{props.children}
|
|
90
48
|
</View>
|
|
91
49
|
);
|
|
@@ -96,54 +54,8 @@ describe("Layout TV", () => {
|
|
|
96
54
|
};
|
|
97
55
|
|
|
98
56
|
it("renders", () => {
|
|
99
|
-
const { toJSON } = render(
|
|
100
|
-
<Layout Components={Components}>
|
|
101
|
-
<Screen />
|
|
102
|
-
</Layout>,
|
|
103
|
-
{ wrapper }
|
|
104
|
-
);
|
|
57
|
+
const { toJSON } = render(<Layout Components={Components} />, { wrapper });
|
|
105
58
|
|
|
106
59
|
expect(toJSON()).toMatchSnapshot();
|
|
107
60
|
});
|
|
108
|
-
|
|
109
|
-
describe("props passed to background component", () => {
|
|
110
|
-
it("passes correct props", () => {
|
|
111
|
-
const { getByTestId } = render(
|
|
112
|
-
<Layout
|
|
113
|
-
Components={Components}
|
|
114
|
-
ComponentsExtraProps={{
|
|
115
|
-
Background: { testProp: true },
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
<Screen />
|
|
119
|
-
</Layout>,
|
|
120
|
-
{ wrapper }
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const bgComponent = getByTestId("background-component");
|
|
124
|
-
expect(bgComponent.props.backgroundImageUrl).toBe(bgImage);
|
|
125
|
-
expect(bgComponent.props.testProp).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
describe("props passed to navbar component", () => {
|
|
130
|
-
it("passes correct props", () => {
|
|
131
|
-
const { getByTestId } = render(
|
|
132
|
-
<Layout
|
|
133
|
-
Components={Components}
|
|
134
|
-
ComponentsExtraProps={{
|
|
135
|
-
NavBar: { testProp: true },
|
|
136
|
-
}}
|
|
137
|
-
>
|
|
138
|
-
<Screen />
|
|
139
|
-
</Layout>,
|
|
140
|
-
{ wrapper }
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
const navbarComponent = getByTestId("nav-bar-component");
|
|
144
|
-
expect(navbarComponent.props.isVisible).toBe(isNavBarVisible);
|
|
145
|
-
expect(navbarComponent.props.menuPlugin).toBe(plugins[0]);
|
|
146
|
-
expect(navbarComponent.props.testProp).toBe(true);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
61
|
});
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
4
|
-
import {
|
|
5
|
-
useIsNavBarVisible,
|
|
6
|
-
useNavigation,
|
|
7
|
-
} from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
4
|
+
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
8
5
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
9
6
|
|
|
10
|
-
import {
|
|
11
|
-
getNavigationProps,
|
|
12
|
-
resolveNavigationPlugin,
|
|
13
|
-
routeIsPlayerScreen,
|
|
14
|
-
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
15
|
-
|
|
16
7
|
import { getBackgroundImageUrl } from "../utils";
|
|
17
8
|
import { LayoutContainer } from "./LayoutContainer";
|
|
18
|
-
import { NavBarContainer } from "./NavBarContainer";
|
|
19
9
|
import { ScreenContainer } from "./ScreenContainer";
|
|
20
|
-
import { TransitionOverlay } from "./TransitionOverlay";
|
|
21
10
|
|
|
22
11
|
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
23
|
-
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
24
12
|
import { PathnameContext } from "../../../Contexts/PathnameContext";
|
|
25
|
-
import {
|
|
13
|
+
import { ScreenDataContext } from "../../../Contexts/ScreenDataContext";
|
|
14
|
+
import { ScreenContextProvider } from "../../../Contexts/ScreenContext";
|
|
26
15
|
|
|
27
16
|
type Components = {
|
|
28
17
|
NavBar: React.ComponentType<any>;
|
|
@@ -43,20 +32,9 @@ type Props = {
|
|
|
43
32
|
const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
44
33
|
const navigator = useNavigation();
|
|
45
34
|
const theme = useTheme();
|
|
46
|
-
const { title } = useNavbarState();
|
|
47
|
-
const { activeRiver, currentRoute } = navigator;
|
|
48
|
-
|
|
49
|
-
const {
|
|
50
|
-
appState: { appReady = false } = {},
|
|
51
|
-
remoteConfigurations,
|
|
52
|
-
plugins = [],
|
|
53
|
-
} = usePickFromState(["appState", "remoteConfigurations", "plugins"]);
|
|
54
35
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
title,
|
|
58
|
-
category: "menu",
|
|
59
|
-
});
|
|
36
|
+
const { appState: { appReady = false } = {}, remoteConfigurations } =
|
|
37
|
+
usePickFromState(["appState", "remoteConfigurations", "plugins"]);
|
|
60
38
|
|
|
61
39
|
const backgroundColor = React.useMemo(() => theme.app_background_color, []);
|
|
62
40
|
|
|
@@ -65,25 +43,6 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
65
43
|
[remoteConfigurations]
|
|
66
44
|
);
|
|
67
45
|
|
|
68
|
-
const menuPlugin = React.useMemo(
|
|
69
|
-
() =>
|
|
70
|
-
resolveNavigationPlugin({
|
|
71
|
-
category: "menu",
|
|
72
|
-
navigations: activeRiver?.navigations,
|
|
73
|
-
plugins,
|
|
74
|
-
}) as QuickBrickPlugin,
|
|
75
|
-
[]
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const NavBar = React.useMemo(
|
|
79
|
-
() => Components.NavBar || (menuPlugin.module as React.ComponentType<any>),
|
|
80
|
-
[]
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const navBarVisible = useIsNavBarVisible();
|
|
84
|
-
|
|
85
|
-
const [navBarReady, setNavBarReady] = React.useState(false);
|
|
86
|
-
|
|
87
46
|
if (!appReady) {
|
|
88
47
|
return null;
|
|
89
48
|
}
|
|
@@ -96,46 +55,18 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
96
55
|
backgroundImageUrl={backgroundImageUrl}
|
|
97
56
|
{...R.omit(["ref"])(ComponentsExtraProps?.Background)}
|
|
98
57
|
>
|
|
99
|
-
{
|
|
100
|
-
<NavBarContainer isVisible={navBarVisible} onReady={setNavBarReady}>
|
|
101
|
-
<NavBar
|
|
102
|
-
ref={ComponentsExtraProps?.NavBar?.ref}
|
|
103
|
-
isVisible={navBarVisible && !routeIsPlayerScreen(currentRoute)}
|
|
104
|
-
menuPlugin={menuPlugin}
|
|
105
|
-
navigationProps={navigationProps}
|
|
106
|
-
{...R.omit(["ref"])(ComponentsExtraProps?.NavBar)}
|
|
107
|
-
/>
|
|
108
|
-
</NavBarContainer>
|
|
109
|
-
) : null}
|
|
110
|
-
|
|
111
|
-
{navBarReady ? (
|
|
112
|
-
/**
|
|
113
|
-
Need to re-mount this component on each navigation event
|
|
114
|
-
It's a hack to work around the fact that we don't support
|
|
115
|
-
correct screen rendering in our navigator (shared currentRoute state)
|
|
116
|
-
**/
|
|
58
|
+
<ScreenDataContext.Provider value={navigator.data}>
|
|
117
59
|
<PathnameContext.Provider value={navigator.currentRoute}>
|
|
118
|
-
<
|
|
60
|
+
<ScreenContextProvider pathname={navigator.currentRoute}>
|
|
61
|
+
<ScreenContainer
|
|
62
|
+
ComponentsExtraProps={ComponentsExtraProps}
|
|
63
|
+
NavBar={Components.NavBar}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</ScreenContainer>
|
|
67
|
+
</ScreenContextProvider>
|
|
119
68
|
</PathnameContext.Provider>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{isApplePlatform() ? (
|
|
123
|
-
/**
|
|
124
|
-
Render NavBarContainer over ScreenContainer to let tvOS native
|
|
125
|
-
focus manager works correctly to focus nav bar items first
|
|
126
|
-
**/
|
|
127
|
-
<NavBarContainer isVisible={navBarVisible} onReady={setNavBarReady}>
|
|
128
|
-
<NavBar
|
|
129
|
-
ref={ComponentsExtraProps?.NavBar?.ref}
|
|
130
|
-
isVisible={navBarVisible && !routeIsPlayerScreen(currentRoute)}
|
|
131
|
-
menuPlugin={menuPlugin}
|
|
132
|
-
navigationProps={navigationProps}
|
|
133
|
-
{...R.omit(["ref"])(ComponentsExtraProps?.NavBar)}
|
|
134
|
-
/>
|
|
135
|
-
</NavBarContainer>
|
|
136
|
-
) : null}
|
|
137
|
-
|
|
138
|
-
<TransitionOverlay />
|
|
69
|
+
</ScreenDataContext.Provider>
|
|
139
70
|
</Components.Background>
|
|
140
71
|
</ScreenLayoutContextProvider>
|
|
141
72
|
</LayoutContainer>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { pathOr } from "ramda";
|
|
3
|
+
|
|
4
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
|
+
|
|
6
|
+
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
7
|
+
import { StackNavigator } from "../../Navigator";
|
|
8
|
+
|
|
9
|
+
type Components = {
|
|
10
|
+
NavBar: React.ComponentType<any>;
|
|
11
|
+
Background: React.ComponentType<any>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Props = {
|
|
15
|
+
Components: Components;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Layout = ({ Components }: Props) => {
|
|
19
|
+
const { appState } = usePickFromState(["appState"]);
|
|
20
|
+
const appReady = pathOr(false, ["appReady"], appState);
|
|
21
|
+
|
|
22
|
+
if (!appReady) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ScreenLayoutContextProvider>
|
|
28
|
+
<StackNavigator Components={Components} />
|
|
29
|
+
</ScreenLayoutContextProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default Layout;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
isTV,
|
|
4
|
+
platformSelect,
|
|
5
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
6
|
|
|
6
7
|
import Mobile from "./Mobile";
|
|
7
|
-
import TV from "./TV";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import TVWeb from "./TV/index.web";
|
|
10
|
+
import TVDefault from "./TV/index";
|
|
11
|
+
|
|
12
|
+
const TV = platformSelect({
|
|
13
|
+
samsung_tv: TVWeb,
|
|
14
|
+
lg_tv: TVWeb,
|
|
15
|
+
web: TVWeb,
|
|
16
|
+
default: TVDefault,
|
|
17
|
+
});
|
|
11
18
|
|
|
19
|
+
export default function Layout(props) {
|
|
12
20
|
if (isTV()) {
|
|
13
|
-
return
|
|
14
|
-
<ScreenContextProvider pathname={pathname}>
|
|
15
|
-
<TV {...props} />
|
|
16
|
-
</ScreenContextProvider>
|
|
17
|
-
);
|
|
21
|
+
return <TV {...props} />;
|
|
18
22
|
} else {
|
|
19
23
|
return <Mobile {...props} />;
|
|
20
24
|
}
|
|
@@ -25,6 +25,7 @@ type Props = {
|
|
|
25
25
|
testID?: string;
|
|
26
26
|
accessibilityLabel?: string;
|
|
27
27
|
cellUUID?: string;
|
|
28
|
+
extraProps?: Record<string, any>;
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
function isStringAsset(asset) {
|
|
@@ -52,6 +53,7 @@ export function ActionButton(props: Props) {
|
|
|
52
53
|
const { item, action, asset, flavour = "flavour_1", cellUUID } = props;
|
|
53
54
|
const actionContext = useActions(action?.identifier);
|
|
54
55
|
|
|
56
|
+
// TODO: add subscription API for action availability
|
|
55
57
|
const actionDisabled =
|
|
56
58
|
typeof actionContext?.isActionAvailable === "function" &&
|
|
57
59
|
!actionContext.isActionAvailable(item);
|
|
@@ -67,7 +69,7 @@ export function ActionButton(props: Props) {
|
|
|
67
69
|
if (actionDisabled || !actionContext) return;
|
|
68
70
|
|
|
69
71
|
setActionState(actionContext.initialEntryState(item));
|
|
70
|
-
}, [actionDisabled, item?.id]);
|
|
72
|
+
}, [actionDisabled, item?.id, actionContext]);
|
|
71
73
|
|
|
72
74
|
const onPress = useCallback(() => {
|
|
73
75
|
actionContext.invokeAction(item, {
|
|
@@ -108,6 +110,7 @@ export function ActionButton(props: Props) {
|
|
|
108
110
|
flavour={flavour}
|
|
109
111
|
asset={getAssetValue(asset, flavour)}
|
|
110
112
|
cellUUID={cellUUID}
|
|
113
|
+
{...(props?.extraProps ?? {})}
|
|
111
114
|
/>
|
|
112
115
|
)}
|
|
113
116
|
</TouchableOpacity>
|