@applicaster/zapp-react-native-ui-components 12.0.0-rc.7 → 12.0.0-rc.70
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 +1 -1
- package/Components/Cell/Cell.tsx +7 -7
- package/Components/Cell/CellWithFocusable.tsx +38 -19
- package/Components/Cell/TvOSCellComponent.tsx +2 -2
- package/Components/ErrorScreen/index.tsx +1 -1
- package/Components/FocusableCell/index.tsx +7 -7
- package/Components/FocusableGroup/index.tsx +1 -0
- 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/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +18 -107
- package/Components/Layout/TV/index.tsx +9 -121
- package/Components/Layout/index.tsx +1 -9
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +80 -110
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- 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 +17 -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 +4 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/utils/index.ts +16 -5
- 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 +48 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +64 -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 +5 -6
- 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 +179 -0
- package/Components/Screen/__tests__/Screen.test.tsx +48 -36
- 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 +103 -44
- package/Components/Screen/navigationHandler.ts +0 -82
- package/Components/Screen/orientationHandler.ts +1 -1
- package/Components/ScreenResolver/index.tsx +4 -2
- package/Components/Tabs/TV/styles.ts +1 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/Transitioner/Scene.tsx +24 -19
- package/Components/Transitioner/Transitioner.tsx +9 -2
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +60 -14
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +18 -28
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +342 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +151 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +438 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +154 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
- package/Components/VideoModal/PlayerDetails.tsx +6 -3
- package/Components/VideoModal/PlayerWrapper.tsx +82 -50
- 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 +246 -166
- package/Components/VideoModal/hooks/useModalSize.ts +13 -4
- package/Components/VideoModal/utils.ts +3 -3
- 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/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.ts +3 -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/Contexts/{index.js → index.ts} +0 -0
|
@@ -1,183 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isMenuVisible } from "../navigationHandler";
|
|
2
2
|
|
|
3
3
|
describe("NavigationHandler", () => {
|
|
4
|
-
describe("isNavBarVisible", () => {
|
|
5
|
-
it("returns false when the route is a player route", () => {
|
|
6
|
-
const navBarVisible = isNavBarVisible(
|
|
7
|
-
"/playable/some_vod_item",
|
|
8
|
-
{},
|
|
9
|
-
undefined,
|
|
10
|
-
false
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
expect(navBarVisible).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("returns false when the next screen is the QB search screen", () => {
|
|
17
|
-
const navBarVisible = isNavBarVisible(
|
|
18
|
-
"/river/A1234",
|
|
19
|
-
{
|
|
20
|
-
type: "qb_search_screen",
|
|
21
|
-
},
|
|
22
|
-
undefined,
|
|
23
|
-
false
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
expect(navBarVisible).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe("when screen is a hook", () => {
|
|
30
|
-
it("returns true if the `showNavBar` flag is set to true", () => {
|
|
31
|
-
const navBarVisible = isNavBarVisible(
|
|
32
|
-
"",
|
|
33
|
-
{
|
|
34
|
-
hookPlugin: {
|
|
35
|
-
module: {
|
|
36
|
-
showNavBar: true,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
undefined,
|
|
41
|
-
false
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
expect(navBarVisible).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("returns true if presentFullScreen flag is set to false", () => {
|
|
48
|
-
const navBarVisible = isNavBarVisible(
|
|
49
|
-
"",
|
|
50
|
-
{
|
|
51
|
-
hookPlugin: {
|
|
52
|
-
module: {
|
|
53
|
-
presentFullScreen: false,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
undefined,
|
|
58
|
-
false
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
expect(navBarVisible).toBe(true);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("returns false if presentFullScreen flag is set to true", () => {
|
|
65
|
-
const navBarVisible = isNavBarVisible(
|
|
66
|
-
"",
|
|
67
|
-
{
|
|
68
|
-
hookPlugin: {
|
|
69
|
-
module: {
|
|
70
|
-
presentFullScreen: true,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
undefined,
|
|
75
|
-
false
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
expect(navBarVisible).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("returns false if the screen's general settings allow screen presentation", () => {
|
|
83
|
-
const navBarVisible = isNavBarVisible(
|
|
84
|
-
"",
|
|
85
|
-
{
|
|
86
|
-
general: {
|
|
87
|
-
allow_screen_plugin_presentation: true,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
undefined,
|
|
91
|
-
false
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
expect(navBarVisible).toBe(false);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("returns false if the screen's general settings hide app nav bar", () => {
|
|
98
|
-
const navBarVisible = isNavBarVisible(
|
|
99
|
-
"",
|
|
100
|
-
{
|
|
101
|
-
general: {
|
|
102
|
-
hide_app_nav_bar: true,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
undefined,
|
|
106
|
-
false
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
expect(navBarVisible).toBe(false);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("returns false if it's secondary nav bar and hide_secondary_level_menu is true", () => {
|
|
113
|
-
const navBarVisible = isNavBarVisible(
|
|
114
|
-
"",
|
|
115
|
-
{
|
|
116
|
-
navigations: [
|
|
117
|
-
{
|
|
118
|
-
styles: {
|
|
119
|
-
hide_secondary_level_menu: true,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
undefined,
|
|
125
|
-
true
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
expect(navBarVisible).toBe(false);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("returns true if it's secondary nav bar and hide_secondary_level_menu is false", () => {
|
|
132
|
-
const navBarVisible = isNavBarVisible(
|
|
133
|
-
"",
|
|
134
|
-
{
|
|
135
|
-
navigations: [
|
|
136
|
-
{
|
|
137
|
-
styles: {
|
|
138
|
-
hide_secondary_level_menu: false,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
undefined,
|
|
144
|
-
true
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
expect(navBarVisible).toBe(true);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it("returns true if it's first level menu and hide_secondary_level_menu is true", () => {
|
|
151
|
-
const navBarVisible = isNavBarVisible(
|
|
152
|
-
"",
|
|
153
|
-
{
|
|
154
|
-
navigations: [
|
|
155
|
-
{
|
|
156
|
-
styles: {
|
|
157
|
-
hide_secondary_level_menu: false,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
undefined,
|
|
163
|
-
false
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
expect(navBarVisible).toBe(true);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("returns true otherwise", () => {
|
|
170
|
-
const navBarVisible = isNavBarVisible(
|
|
171
|
-
"",
|
|
172
|
-
{ navigations: [] },
|
|
173
|
-
undefined,
|
|
174
|
-
false
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
expect(navBarVisible).toBe(true);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
4
|
describe("isMenuVisible", () => {
|
|
182
5
|
it("returns false when the route is a player route", () => {
|
|
183
6
|
const menuVisible = isMenuVisible("/playable/some_vod_item", {});
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import * as R from "ramda";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import { RouteManager } from "../RouteManager";
|
|
6
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
|
-
import { useScreenOrientationHandler } from "./orientationHandler";
|
|
8
|
-
import { useScreenConfiguration } from "../River/useScreenConfiguration";
|
|
9
|
-
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
10
|
-
import type { ZappNavigationProps } from "@applicaster/zapp-react-native-flow-types/index";
|
|
11
5
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
|
+
|
|
7
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
8
|
+
import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
9
|
+
import {
|
|
10
|
+
getNavigationPropsV2,
|
|
11
|
+
resolveNavigationPlugin,
|
|
12
|
+
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
13
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
14
|
+
import {
|
|
15
|
+
useDimensions,
|
|
16
|
+
useRoute,
|
|
17
|
+
useCurrentScreenData,
|
|
18
|
+
useNavbarState,
|
|
19
|
+
useScreenData,
|
|
20
|
+
useNavigation,
|
|
21
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
22
|
+
import { getNavigationPluginModule } from "@applicaster/zapp-react-native-app/App/Layout/layoutHelpers";
|
|
23
|
+
|
|
12
24
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
25
|
+
import { RouteManager } from "../RouteManager";
|
|
26
|
+
import { useScreenConfiguration } from "../River/useScreenConfiguration";
|
|
27
|
+
import { useScreenOrientationHandler } from "./orientationHandler";
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
toggleMenu: () => void;
|
|
24
|
-
openMenu: () => void;
|
|
25
|
-
setOpenMenu: () => void;
|
|
26
|
-
closeMenu: () => void;
|
|
27
|
-
setCloseMenu: () => void;
|
|
28
|
-
dimensions: { window: number };
|
|
29
|
-
navigator: ZappNavigationProps;
|
|
30
|
-
bottomTabBarHeight: number;
|
|
31
|
-
isRTL: boolean;
|
|
32
|
-
category: string;
|
|
33
|
-
} & QuickBrickAppNavigator;
|
|
29
|
+
const getScreenId = (
|
|
30
|
+
screenData: LegacyNavigationScreenData,
|
|
31
|
+
fallbackRiver: ZappRiver
|
|
32
|
+
) => {
|
|
33
|
+
return screenData?.targetScreen
|
|
34
|
+
? screenData?.targetScreen?.id ?? fallbackRiver.id
|
|
35
|
+
: "screen_id" in screenData
|
|
36
|
+
? screenData.screen_id
|
|
37
|
+
: fallbackRiver.id;
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
function colorIsNotTransparent(color) {
|
|
@@ -50,25 +54,75 @@ function isValidColor(string) {
|
|
|
50
54
|
return string && string !== "transparent" && colorIsNotTransparent(string);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
type Props = {
|
|
58
|
+
pathname: unknown;
|
|
59
|
+
screenData: unknown;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function Screen(_props: Props) {
|
|
63
|
+
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
64
|
+
const navigation = useNavigation();
|
|
55
65
|
const { plugins } = usePickFromState(["plugins"]);
|
|
56
66
|
|
|
57
|
-
|
|
67
|
+
// Gets the data for the current screen configuration
|
|
68
|
+
const currentScreenData = useCurrentScreenData();
|
|
69
|
+
const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
|
|
70
|
+
const insets = useSafeAreaInsets();
|
|
71
|
+
|
|
72
|
+
const { width: screenWidth } = useDimensions("screen", {
|
|
73
|
+
fullDimensions: true,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const { screenData, pathname } = useRoute();
|
|
77
|
+
|
|
78
|
+
const currentRiver = useScreenData(
|
|
79
|
+
getScreenId(screenData, navigation.activeRiver)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const { title } = useNavbarState();
|
|
83
|
+
|
|
84
|
+
const hasMenu =
|
|
85
|
+
resolveNavigationPlugin({
|
|
86
|
+
category: "menu",
|
|
87
|
+
navigations: currentRiver.navigations,
|
|
88
|
+
plugins,
|
|
89
|
+
})?.identifier === "quick_brick_side_menu";
|
|
90
|
+
|
|
91
|
+
const navBarProps = React.useMemo<MobileNavBarPluginProps | null>(() => {
|
|
92
|
+
const props = getNavigationPropsV2({
|
|
93
|
+
currentRiver,
|
|
94
|
+
title,
|
|
95
|
+
category: "nav_bar",
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (props) {
|
|
99
|
+
return {
|
|
100
|
+
...props,
|
|
101
|
+
id: pathname,
|
|
102
|
+
pathname: pathname,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return null;
|
|
107
|
+
}, [currentRiver, pathname]);
|
|
108
|
+
|
|
109
|
+
const NavBar = React.useMemo(
|
|
58
110
|
() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
111
|
+
getNavigationPluginModule(
|
|
112
|
+
"nav_bar",
|
|
113
|
+
currentRiver,
|
|
114
|
+
plugins
|
|
115
|
+
) as React.ComponentType<MobileNavBarPluginProps & { hasMenu: boolean }>,
|
|
116
|
+
[]
|
|
64
117
|
);
|
|
65
118
|
|
|
66
|
-
const
|
|
119
|
+
const offlinePlugin = getComponentModule({
|
|
120
|
+
plugins,
|
|
121
|
+
components: {},
|
|
122
|
+
componentType: "offline-experience",
|
|
123
|
+
});
|
|
67
124
|
|
|
68
|
-
|
|
69
|
-
const currentScreenData = useCurrentScreenData();
|
|
70
|
-
const theme = useTheme();
|
|
71
|
-
const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
|
|
125
|
+
const { OfflineFallbackScreen } = offlinePlugin;
|
|
72
126
|
|
|
73
127
|
const style = React.useMemo(
|
|
74
128
|
() => ({
|
|
@@ -76,21 +130,26 @@ export function Screen(props: Props) {
|
|
|
76
130
|
backgroundColor: isValidColor(backgroundColor)
|
|
77
131
|
? backgroundColor
|
|
78
132
|
: theme.app_background_color,
|
|
133
|
+
paddingTop: 0,
|
|
134
|
+
// paddingBottom: insets.bottom, // Should be applied directly by UI plugin
|
|
135
|
+
// paddingLeft: insets.left, // Should be applied directly by UI plugin
|
|
136
|
+
// paddingRight: insets.right, // Should be applied directly by UI plugin
|
|
79
137
|
}),
|
|
80
|
-
[theme.app_background_color, backgroundColor]
|
|
138
|
+
[insets, screenWidth, theme.app_background_color, backgroundColor]
|
|
81
139
|
);
|
|
82
140
|
|
|
83
141
|
const targetScreenData =
|
|
84
|
-
currentScreenData || screenData?.targetScreen || screenData;
|
|
142
|
+
currentScreenData || (screenData as any)?.targetScreen || screenData;
|
|
85
143
|
|
|
86
144
|
useScreenOrientationHandler({ screenData: targetScreenData });
|
|
87
145
|
|
|
88
146
|
return (
|
|
89
147
|
<ScreenContextProvider pathname={pathname}>
|
|
90
148
|
<View style={style}>
|
|
91
|
-
<NavBar
|
|
149
|
+
{navBarProps && <NavBar {...navBarProps} hasMenu={hasMenu} />}
|
|
92
150
|
|
|
93
|
-
<OfflineFallbackScreen screenData={
|
|
151
|
+
<OfflineFallbackScreen screenData={targetScreenData}>
|
|
152
|
+
{/* @TODO RouteManager doesn't use props, can they be removed ? */}
|
|
94
153
|
<RouteManager pathname={pathname} screenData={screenData} />
|
|
95
154
|
</OfflineFallbackScreen>
|
|
96
155
|
</View>
|
|
@@ -1,85 +1,3 @@
|
|
|
1
|
-
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This function helps to decide wether the navbar should be presented on the screen
|
|
5
|
-
* based on route and / or screen Data
|
|
6
|
-
*
|
|
7
|
-
* Currently the scenarios include
|
|
8
|
-
* - players => false
|
|
9
|
-
* - search screen plugin => false
|
|
10
|
-
* - hooks with `showNavBar: true` or `presentFullScreen` not set to true, defaults to no navbar for hook screens
|
|
11
|
-
* - screens with `allow_screen_plugin_presentation` in general property => false
|
|
12
|
-
*
|
|
13
|
-
* @param {String} route current route of the screen
|
|
14
|
-
* @param {Object} screenData payload associated with the currently presented screen
|
|
15
|
-
* @returns {Boolean}
|
|
16
|
-
*/
|
|
17
|
-
export function isNavBarVisible(
|
|
18
|
-
route,
|
|
19
|
-
screenData,
|
|
20
|
-
showNavBar,
|
|
21
|
-
canGoBack,
|
|
22
|
-
videoModalState: QuickBrickVideoModalState | null = null
|
|
23
|
-
) {
|
|
24
|
-
/* screenData is not actual navigator.data
|
|
25
|
-
* or navigator.screenData,
|
|
26
|
-
* but navigator.data.screen */
|
|
27
|
-
if (route.includes("playable")) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
videoModalState?.mode === "FULLSCREEN" &&
|
|
33
|
-
videoModalState?.visible === true
|
|
34
|
-
) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (screenData?.type === "qb_search_screen" && !isTV()) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Match if screen is Hook */
|
|
43
|
-
if (route.startsWith("/hooks/")) {
|
|
44
|
-
const module = screenData?.module;
|
|
45
|
-
|
|
46
|
-
if (module?.presentFullScreen) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return module?.showNavBar ?? false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (screenData?.hookPlugin) {
|
|
54
|
-
const hookPlugin = screenData?.hookPlugin?.module;
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true || false
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
screenData?.general?.allow_screen_plugin_presentation ||
|
|
63
|
-
screenData?.general?.hide_app_nav_bar
|
|
64
|
-
) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const hideSecondaryLevel = screenData?.navigations?.some(
|
|
69
|
-
(navigation) => navigation.styles?.hide_secondary_level_menu
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (canGoBack && hideSecondaryLevel) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (typeof showNavBar === "boolean" && !showNavBar) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
1
|
/**
|
|
84
2
|
* This function helps to decide wether the menu should be presented on the screen
|
|
85
3
|
* based on route and / or screen Data
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
10
|
import { findPluginByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
11
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks
|
|
11
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { ZappHookModalContext } from "../../Contexts";
|
|
13
13
|
import { HookModalContextT } from "../../Contexts/ZappHookModalContext";
|
|
14
14
|
|
|
@@ -32,12 +32,13 @@ type Props = {
|
|
|
32
32
|
nextFocusLeft?: React.Ref<any>;
|
|
33
33
|
nextFocusUp?: React.Ref<any>;
|
|
34
34
|
};
|
|
35
|
+
groupId?: string;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export function ScreenResolverComponent(props: Props) {
|
|
38
39
|
useScreenAnalytics(props);
|
|
39
40
|
|
|
40
|
-
const { screenType, screenId, screenData } = props;
|
|
41
|
+
const { screenType, screenId, screenData, groupId } = props;
|
|
41
42
|
|
|
42
43
|
const { hookPlugin } = screenData || {};
|
|
43
44
|
|
|
@@ -81,6 +82,7 @@ export function ScreenResolverComponent(props: Props) {
|
|
|
81
82
|
item={screenData}
|
|
82
83
|
mode={mode === "PIP" ? "PIP" : "FULLSCREEN"}
|
|
83
84
|
isModal={false}
|
|
85
|
+
groupId={groupId}
|
|
84
86
|
/>
|
|
85
87
|
);
|
|
86
88
|
}
|
|
@@ -91,7 +93,7 @@ export function ScreenResolverComponent(props: Props) {
|
|
|
91
93
|
<HookRenderer
|
|
92
94
|
screenData={screenData}
|
|
93
95
|
focused={props.focused}
|
|
94
|
-
parentFocus={props.parentFocus}
|
|
96
|
+
parentFocus={props.parentFocus as ParentFocus}
|
|
95
97
|
/>
|
|
96
98
|
)
|
|
97
99
|
);
|
|
@@ -17,9 +17,12 @@ type TrackedViewProps = {
|
|
|
17
17
|
export const TrackedView = memo(function TrackedView(props: TrackedViewProps) {
|
|
18
18
|
const children = props.children;
|
|
19
19
|
|
|
20
|
-
const onPositionUpdated = useCallback(
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const onPositionUpdated = useCallback(
|
|
21
|
+
(event: TrackedViewNativeProps) => {
|
|
22
|
+
props.onPositionUpdated(event.nativeEvent);
|
|
23
|
+
},
|
|
24
|
+
[props.onPositionUpdated]
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
if (isTV()) {
|
|
25
28
|
return <View {...(props as any)}>{children}</View>;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
9
9
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
10
|
+
import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
|
|
10
11
|
|
|
11
12
|
type Props = {
|
|
12
13
|
children: any;
|
|
@@ -16,6 +17,8 @@ type Props = {
|
|
|
16
17
|
animating: boolean;
|
|
17
18
|
contentStyle: ViewStyle;
|
|
18
19
|
pathname: string;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
screenData: NavigationScreenData;
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
/**
|
|
@@ -38,34 +41,36 @@ export function Scene({
|
|
|
38
41
|
animating,
|
|
39
42
|
contentStyle,
|
|
40
43
|
pathname,
|
|
44
|
+
isActive = false,
|
|
45
|
+
screenData,
|
|
41
46
|
}: Props) {
|
|
47
|
+
const [initialScreenData, setInitialScreenData] = React.useState(screenData);
|
|
48
|
+
|
|
49
|
+
React.useLayoutEffect(() => {
|
|
50
|
+
if (isActive) {
|
|
51
|
+
setInitialScreenData(screenData);
|
|
52
|
+
}
|
|
53
|
+
}, [screenData, isActive]);
|
|
54
|
+
|
|
42
55
|
const frame = useSafeAreaFrame();
|
|
43
56
|
const { height, width } = useWindowDimensions();
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<Animated.View
|
|
50
|
-
pointerEvents={pointerEvents}
|
|
51
|
-
style={[style, contentStyle, { height, width }]}
|
|
52
|
-
>
|
|
53
|
-
<PathnameContext.Provider value={pathname}>
|
|
54
|
-
{children}
|
|
55
|
-
</PathnameContext.Provider>
|
|
56
|
-
<Animated.View style={overlayStyle} />
|
|
57
|
-
</Animated.View>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
58
|
+
// Safe frame takes too long to update,
|
|
59
|
+
// so we can not rely on it there, and use height and width instead.
|
|
60
|
+
const isAnimating = animating && overlayStyle;
|
|
61
|
+
const dimensions = isAnimating ? { height, width } : frame;
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
64
|
<Animated.View
|
|
63
65
|
pointerEvents={pointerEvents}
|
|
64
|
-
style={[style, contentStyle,
|
|
66
|
+
style={[style, contentStyle, dimensions]}
|
|
65
67
|
>
|
|
66
|
-
<
|
|
67
|
-
{
|
|
68
|
-
|
|
68
|
+
<ScreenDataContext.Provider value={initialScreenData}>
|
|
69
|
+
<PathnameContext.Provider value={pathname}>
|
|
70
|
+
{children}
|
|
71
|
+
</PathnameContext.Provider>
|
|
72
|
+
</ScreenDataContext.Provider>
|
|
73
|
+
{isAnimating && <Animated.View style={overlayStyle} />}
|
|
69
74
|
</Animated.View>
|
|
70
75
|
);
|
|
71
76
|
}
|
|
@@ -278,7 +278,8 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
278
278
|
// instead of dangerous nulls or duplicates.
|
|
279
279
|
renderSingleScene({ scenes, to }) {
|
|
280
280
|
const { contentStyle, layoutData } = this.props;
|
|
281
|
-
const screenData =
|
|
281
|
+
const screenData = this.props.children.props.screenData;
|
|
282
|
+
const pathname = scenes[to.index].key;
|
|
282
283
|
|
|
283
284
|
const orientation = getScreenOrientation({
|
|
284
285
|
screenData,
|
|
@@ -296,10 +297,12 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
296
297
|
}) && (
|
|
297
298
|
<Scene
|
|
298
299
|
{...{ style: to.style }}
|
|
299
|
-
pathname={
|
|
300
|
+
pathname={pathname}
|
|
301
|
+
isActive={pathname === this.props.navigator.currentRoute}
|
|
300
302
|
contentStyle={contentStyle}
|
|
301
303
|
key={scenes[to.index].key}
|
|
302
304
|
screenUniqueId={scenes[to.index].screenUniqueId}
|
|
305
|
+
screenData={screenData}
|
|
303
306
|
>
|
|
304
307
|
{scenes[to.index].children}
|
|
305
308
|
</Scene>
|
|
@@ -319,12 +322,14 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
319
322
|
<Scene
|
|
320
323
|
key={scenes[from.index].key}
|
|
321
324
|
pathname={scenes[from.index].key}
|
|
325
|
+
isActive={scenes[from.index].key === this.props.navigator.currentRoute}
|
|
322
326
|
style={from.style}
|
|
323
327
|
pointerEvents="none"
|
|
324
328
|
overlayStyle={from.overlayStyle}
|
|
325
329
|
animating={this.state.animating}
|
|
326
330
|
contentStyle={contentStyle}
|
|
327
331
|
screenUniqueId={scenes[from.index].screenUniqueId}
|
|
332
|
+
screenData={scenes[from.index].children.props.screenData}
|
|
328
333
|
>
|
|
329
334
|
{scenes[from.index].children}
|
|
330
335
|
</Scene>
|
|
@@ -333,12 +338,14 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
333
338
|
const toScene = scenes[to.index] && (
|
|
334
339
|
<Scene
|
|
335
340
|
pathname={scenes[to.index].key}
|
|
341
|
+
isActive={scenes[to.index].key === this.props.navigator.currentRoute}
|
|
336
342
|
key={scenes[to.index].key}
|
|
337
343
|
style={to.style}
|
|
338
344
|
overlayStyle={to.overlayStyle}
|
|
339
345
|
animating={this.state.animating}
|
|
340
346
|
contentStyle={contentStyle}
|
|
341
347
|
screenUniqueId={scenes[to.index].screenUniqueId}
|
|
348
|
+
screenData={this.props.children.props.screenData}
|
|
342
349
|
>
|
|
343
350
|
{scenes[to.index].children}
|
|
344
351
|
</Scene>
|
|
@@ -21,7 +21,9 @@ exports[`<Scene /> renders correctly 1`] = `
|
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
>
|
|
24
|
-
<ContextProvider
|
|
24
|
+
<ContextProvider>
|
|
25
|
+
<ContextProvider />
|
|
26
|
+
</ContextProvider>
|
|
25
27
|
</ForwardRef(AnimatedComponentWrapper)>
|
|
26
28
|
`;
|
|
27
29
|
|
|
@@ -43,7 +45,9 @@ exports[`<Scene /> renders the overlay while animating 1`] = `
|
|
|
43
45
|
]
|
|
44
46
|
}
|
|
45
47
|
>
|
|
46
|
-
<ContextProvider
|
|
48
|
+
<ContextProvider>
|
|
49
|
+
<ContextProvider />
|
|
50
|
+
</ContextProvider>
|
|
47
51
|
<ForwardRef(AnimatedComponentWrapper)
|
|
48
52
|
style={
|
|
49
53
|
Object {
|