@applicaster/zapp-react-native-ui-components 12.0.0-rc.9 → 12.0.0-rc.91
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 +12 -7
- 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 +84 -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 +2 -0
- 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 +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 +10 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -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 +65 -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 +169 -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 +131 -44
- package/Components/Screen/navigationHandler.ts +0 -82
- 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 +21 -28
- 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 +70 -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 +352 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +158 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +455 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +162 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +301 -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/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
|
@@ -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,44 @@
|
|
|
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
|
+
import {
|
|
7
|
+
isOrientationCompatible,
|
|
8
|
+
useGetScreenOrientation,
|
|
9
|
+
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
10
|
+
|
|
11
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
12
|
+
import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
13
|
+
import {
|
|
14
|
+
getNavigationPropsV2,
|
|
15
|
+
resolveNavigationPlugin,
|
|
16
|
+
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
17
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
18
|
+
import {
|
|
19
|
+
useDimensions,
|
|
20
|
+
useRoute,
|
|
21
|
+
useCurrentScreenData,
|
|
22
|
+
useNavbarState,
|
|
23
|
+
useScreenData,
|
|
24
|
+
useNavigation,
|
|
25
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
26
|
+
import { getNavigationPluginModule } from "@applicaster/zapp-react-native-app/App/Layout/layoutHelpers";
|
|
27
|
+
|
|
12
28
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
29
|
+
import { RouteManager } from "../RouteManager";
|
|
30
|
+
import { useScreenConfiguration } from "../River/useScreenConfiguration";
|
|
31
|
+
import { useScreenOrientationHandler } from "./orientationHandler";
|
|
13
32
|
|
|
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;
|
|
33
|
+
const getScreenId = (
|
|
34
|
+
screenData: LegacyNavigationScreenData,
|
|
35
|
+
fallbackRiver: ZappRiver
|
|
36
|
+
) => {
|
|
37
|
+
return screenData?.targetScreen
|
|
38
|
+
? screenData?.targetScreen?.id ?? fallbackRiver.id
|
|
39
|
+
: "screen_id" in screenData
|
|
40
|
+
? screenData.screen_id
|
|
41
|
+
: fallbackRiver.id;
|
|
34
42
|
};
|
|
35
43
|
|
|
36
44
|
function colorIsNotTransparent(color) {
|
|
@@ -50,25 +58,86 @@ function isValidColor(string) {
|
|
|
50
58
|
return string && string !== "transparent" && colorIsNotTransparent(string);
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
type Props = {
|
|
62
|
+
pathname: unknown;
|
|
63
|
+
screenData: unknown;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function Screen(_props: Props) {
|
|
67
|
+
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
68
|
+
const navigation = useNavigation();
|
|
55
69
|
const { plugins } = usePickFromState(["plugins"]);
|
|
56
70
|
|
|
57
|
-
|
|
71
|
+
// Gets the data for the current screen configuration
|
|
72
|
+
const currentScreenData = useCurrentScreenData();
|
|
73
|
+
const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
|
|
74
|
+
const insets = useSafeAreaInsets();
|
|
75
|
+
|
|
76
|
+
const {
|
|
77
|
+
width: screenWidth,
|
|
78
|
+
height,
|
|
79
|
+
deviceInfo,
|
|
80
|
+
} = useDimensions("screen", {
|
|
81
|
+
fullDimensions: true,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const { screenData, pathname } = useRoute();
|
|
85
|
+
|
|
86
|
+
const currentRiver = useScreenData(
|
|
87
|
+
getScreenId(screenData, navigation.activeRiver)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const { title } = useNavbarState();
|
|
91
|
+
|
|
92
|
+
const isTablet = deviceInfo?.isTablet;
|
|
93
|
+
|
|
94
|
+
const { appData } = usePickFromState(["appData"]);
|
|
95
|
+
const isTabletPortrait = appData?.isTabletPortrait;
|
|
96
|
+
|
|
97
|
+
const layoutData = { isTablet, isTabletPortrait, width: screenWidth, height };
|
|
98
|
+
|
|
99
|
+
const hasMenu =
|
|
100
|
+
resolveNavigationPlugin({
|
|
101
|
+
category: "menu",
|
|
102
|
+
navigations: currentRiver.navigations,
|
|
103
|
+
plugins,
|
|
104
|
+
})?.identifier === "quick_brick_side_menu";
|
|
105
|
+
|
|
106
|
+
const navBarProps = React.useMemo<MobileNavBarPluginProps | null>(() => {
|
|
107
|
+
const props = getNavigationPropsV2({
|
|
108
|
+
currentRiver,
|
|
109
|
+
title,
|
|
110
|
+
category: "nav_bar",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
if (props) {
|
|
114
|
+
return {
|
|
115
|
+
...props,
|
|
116
|
+
id: pathname,
|
|
117
|
+
pathname: pathname,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return null;
|
|
122
|
+
}, [currentRiver, pathname]);
|
|
123
|
+
|
|
124
|
+
const NavBar = React.useMemo(
|
|
58
125
|
() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
126
|
+
getNavigationPluginModule(
|
|
127
|
+
"nav_bar",
|
|
128
|
+
currentRiver,
|
|
129
|
+
plugins
|
|
130
|
+
) as React.ComponentType<MobileNavBarPluginProps & { hasMenu: boolean }>,
|
|
131
|
+
[]
|
|
64
132
|
);
|
|
65
133
|
|
|
66
|
-
const
|
|
134
|
+
const offlinePlugin = getComponentModule({
|
|
135
|
+
plugins,
|
|
136
|
+
components: {},
|
|
137
|
+
componentType: "offline-experience",
|
|
138
|
+
});
|
|
67
139
|
|
|
68
|
-
|
|
69
|
-
const currentScreenData = useCurrentScreenData();
|
|
70
|
-
const theme = useTheme();
|
|
71
|
-
const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
|
|
140
|
+
const { OfflineFallbackScreen } = offlinePlugin;
|
|
72
141
|
|
|
73
142
|
const style = React.useMemo(
|
|
74
143
|
() => ({
|
|
@@ -76,21 +145,39 @@ export function Screen(props: Props) {
|
|
|
76
145
|
backgroundColor: isValidColor(backgroundColor)
|
|
77
146
|
? backgroundColor
|
|
78
147
|
: theme.app_background_color,
|
|
148
|
+
paddingTop: 0,
|
|
149
|
+
// paddingBottom: insets.bottom, // Should be applied directly by UI plugin
|
|
150
|
+
// paddingLeft: insets.left, // Should be applied directly by UI plugin
|
|
151
|
+
// paddingRight: insets.right, // Should be applied directly by UI plugin
|
|
79
152
|
}),
|
|
80
|
-
[theme.app_background_color, backgroundColor]
|
|
153
|
+
[insets, screenWidth, theme.app_background_color, backgroundColor]
|
|
81
154
|
);
|
|
82
155
|
|
|
83
156
|
const targetScreenData =
|
|
84
|
-
currentScreenData || screenData?.targetScreen || screenData;
|
|
157
|
+
currentScreenData || (screenData as any)?.targetScreen || screenData;
|
|
85
158
|
|
|
86
159
|
useScreenOrientationHandler({ screenData: targetScreenData });
|
|
87
160
|
|
|
161
|
+
const orientation = useGetScreenOrientation(targetScreenData);
|
|
162
|
+
|
|
163
|
+
// We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
|
|
164
|
+
// This saves unnecessary re-renders and user will not see distorted aspect screen.
|
|
165
|
+
if (
|
|
166
|
+
!isOrientationCompatible({
|
|
167
|
+
orientation,
|
|
168
|
+
layoutData,
|
|
169
|
+
})
|
|
170
|
+
) {
|
|
171
|
+
return <View style={style} />;
|
|
172
|
+
}
|
|
173
|
+
|
|
88
174
|
return (
|
|
89
175
|
<ScreenContextProvider pathname={pathname}>
|
|
90
176
|
<View style={style}>
|
|
91
|
-
<NavBar
|
|
177
|
+
{navBarProps && <NavBar {...navBarProps} hasMenu={hasMenu} />}
|
|
92
178
|
|
|
93
|
-
<OfflineFallbackScreen screenData={
|
|
179
|
+
<OfflineFallbackScreen screenData={targetScreenData}>
|
|
180
|
+
{/* @TODO RouteManager doesn't use props, can they be removed ? */}
|
|
94
181
|
<RouteManager pathname={pathname} screenData={screenData} />
|
|
95
182
|
</OfflineFallbackScreen>
|
|
96
183
|
</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
|
|
@@ -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
|
}
|