@applicaster/zapp-react-native-ui-components 11.0.0-rc.99 → 12.0.0-rc.1
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/BaseFocusable/index.ios.ts +1 -1
- package/Components/Cell/Cell.tsx +5 -13
- package/Components/Cell/{CellWithFocusable.js → CellWithFocusable.tsx} +13 -11
- package/Components/Cell/TvOSCellComponent.tsx +12 -10
- package/Components/FastImage/index.ios.js +3 -0
- package/Components/Focusable/FocusableTvOS.tsx +4 -1
- package/Components/FocusableCell/{index.js → index.tsx} +8 -5
- package/Components/FocusableGroup/FocusableTvOS.tsx +2 -2
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +13 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +2 -2
- package/Components/HookRenderer/HookRenderer.tsx +9 -6
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/Layout/TV/index.tsx +9 -13
- package/Components/Layout/index.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +3 -1
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +22 -19
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +1 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +2 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/CollapsibleTextContainer.tsx +9 -3
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +7 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +12 -4
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +23 -9
- package/Components/MasterCell/hoc/withAsyncRender.tsx +8 -4
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +12 -6
- package/Components/MasterCell/hooks/useAsyncRendering/__tests__/MasterCellAsyncRenderManager.test.ts +21 -0
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +15 -13
- package/Components/MasterCell/utils/index.ts +143 -19
- package/Components/PlayerContainer/PlayerContainer.tsx +10 -6
- package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
- package/Components/River/River.tsx +3 -4
- package/Components/River/TV/River.tsx +9 -4
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -0
- package/Components/River/index.tsx +3 -1
- package/Components/Screen/__tests__/Screen.test.tsx +6 -3
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -0
- package/Components/Screen/index.tsx +12 -44
- package/Components/Screen/navigationHandler.ts +1 -1
- package/Components/Spinner/SpinnerComponent.tsx +6 -2
- package/Components/VideoLive/LiveImageManager.ts +24 -9
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +23 -1
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +74 -0
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +47 -0
- package/Components/VideoLive/__tests__/utils.test.ts +109 -0
- package/Components/VideoLive/utils.ts +40 -0
- package/Components/VideoModal/PlayerDetails.tsx +42 -6
- package/Components/VideoModal/PlayerWrapper.tsx +32 -29
- package/Components/VideoModal/VideoModal.tsx +20 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +21 -9
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +14 -24
- package/Contexts/InteractionManagerContext/index.ts +0 -2
- package/Contexts/ScreenContext/index.tsx +118 -0
- package/package.json +5 -5
|
@@ -29,6 +29,7 @@ import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtil
|
|
|
29
29
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
30
30
|
import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
31
31
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
32
|
+
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
32
33
|
|
|
33
34
|
const styles = StyleSheet.create({
|
|
34
35
|
container: {
|
|
@@ -139,6 +140,8 @@ const VideoModalComponent = () => {
|
|
|
139
140
|
logTimestamp(item?.id?.toString());
|
|
140
141
|
}, []);
|
|
141
142
|
|
|
143
|
+
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
|
|
144
|
+
|
|
142
145
|
return (
|
|
143
146
|
<View
|
|
144
147
|
style={[
|
|
@@ -151,23 +154,23 @@ const VideoModalComponent = () => {
|
|
|
151
154
|
},
|
|
152
155
|
]}
|
|
153
156
|
>
|
|
154
|
-
<
|
|
155
|
-
value={
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</
|
|
157
|
+
<ScreenContextProvider pathname={pathname}>
|
|
158
|
+
<PathnameContext.Provider value={pathname}>
|
|
159
|
+
{itemIdHooksFinished === item?.id ? (
|
|
160
|
+
<HandlePlayable
|
|
161
|
+
item={item}
|
|
162
|
+
isModal={mode !== "PIP"}
|
|
163
|
+
modalHeight={docked ? height : modalSize.height}
|
|
164
|
+
modalWidth={modalSize.width}
|
|
165
|
+
mode={mode}
|
|
166
|
+
/>
|
|
167
|
+
) : (
|
|
168
|
+
<View style={styles.loaderContainer}>
|
|
169
|
+
<Spinner />
|
|
170
|
+
</View>
|
|
171
|
+
)}
|
|
172
|
+
</PathnameContext.Provider>
|
|
173
|
+
</ScreenContextProvider>
|
|
171
174
|
</View>
|
|
172
175
|
);
|
|
173
176
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
|
|
5
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
6
|
+
|
|
5
7
|
const props = {
|
|
6
8
|
entry: { id: "test" },
|
|
7
9
|
style: {
|
|
@@ -35,18 +37,30 @@ jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
|
35
37
|
platformSelect: jest.fn((props) => props.android),
|
|
36
38
|
}));
|
|
37
39
|
|
|
40
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
41
|
+
useRoute: jest.fn(() => ({
|
|
42
|
+
pathname: "/river/testId",
|
|
43
|
+
})),
|
|
44
|
+
useNavigation: jest.fn(() => ({
|
|
45
|
+
canGoBack: () => false,
|
|
46
|
+
currentRoute: "/river/testId",
|
|
47
|
+
data: { screen: { id: "testId" } },
|
|
48
|
+
})),
|
|
49
|
+
}));
|
|
50
|
+
|
|
38
51
|
jest.mock("../utils", () => ({ playerDimesionsHack: {} }));
|
|
39
52
|
|
|
40
53
|
const { PlayerWrapper, defaultAspectRatioWidth } = require("../PlayerWrapper");
|
|
41
54
|
|
|
42
55
|
jest.useFakeTimers();
|
|
56
|
+
const children = jest.fn(() => {});
|
|
43
57
|
|
|
44
58
|
describe("PlayerWrapper", () => {
|
|
45
59
|
it("renders properly", () => {
|
|
46
60
|
useIsTablet.mockReturnValue(false);
|
|
47
61
|
|
|
48
|
-
const element =
|
|
49
|
-
<PlayerWrapper {...props}>{
|
|
62
|
+
const element = renderWithProviders(
|
|
63
|
+
<PlayerWrapper {...props}>{children}</PlayerWrapper>
|
|
50
64
|
);
|
|
51
65
|
|
|
52
66
|
expect(element).toMatchSnapshot();
|
|
@@ -55,9 +69,7 @@ describe("PlayerWrapper", () => {
|
|
|
55
69
|
it("renders inline", () => {
|
|
56
70
|
useIsTablet.mockReturnValue(false);
|
|
57
71
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const element = renderer.create(
|
|
72
|
+
const element = renderWithProviders(
|
|
61
73
|
<PlayerWrapper {...props} inline={true} isModal={true}>
|
|
62
74
|
{children}
|
|
63
75
|
</PlayerWrapper>
|
|
@@ -69,9 +81,9 @@ describe("PlayerWrapper", () => {
|
|
|
69
81
|
it("renders inline on tablet in landscape orientation", () => {
|
|
70
82
|
useIsTablet.mockReturnValue(true);
|
|
71
83
|
|
|
72
|
-
const element =
|
|
84
|
+
const element = renderWithProviders(
|
|
73
85
|
<PlayerWrapper {...props} inline={true} isModal={true}>
|
|
74
|
-
{
|
|
86
|
+
{children}
|
|
75
87
|
</PlayerWrapper>
|
|
76
88
|
);
|
|
77
89
|
|
|
@@ -84,7 +96,7 @@ describe("PlayerWrapper", () => {
|
|
|
84
96
|
const children = jest.fn(() => {});
|
|
85
97
|
const dimensions = { height: 50, width: props.style.width };
|
|
86
98
|
|
|
87
|
-
const element =
|
|
99
|
+
const element = renderWithProviders(
|
|
88
100
|
<PlayerWrapper
|
|
89
101
|
{...props}
|
|
90
102
|
inline={true}
|
|
@@ -2,19 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`PlayerDetails renders properly 1`] = `
|
|
4
4
|
<View
|
|
5
|
+
collapsable={false}
|
|
5
6
|
style={
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"paddingTop": -8,
|
|
13
|
-
},
|
|
14
|
-
Object {
|
|
15
|
-
"backgroundColor": "transparent",
|
|
16
|
-
},
|
|
17
|
-
]
|
|
7
|
+
Object {
|
|
8
|
+
"backgroundColor": "transparent",
|
|
9
|
+
"flex": 1,
|
|
10
|
+
"marginTop": -8,
|
|
11
|
+
"paddingTop": -8,
|
|
12
|
+
}
|
|
18
13
|
}
|
|
19
14
|
>
|
|
20
15
|
<View
|
|
@@ -27,19 +22,14 @@ exports[`PlayerDetails renders properly 1`] = `
|
|
|
27
22
|
|
|
28
23
|
exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
|
|
29
24
|
<View
|
|
25
|
+
collapsable={false}
|
|
30
26
|
style={
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"paddingTop": 40,
|
|
38
|
-
},
|
|
39
|
-
Object {
|
|
40
|
-
"backgroundColor": "transparent",
|
|
41
|
-
},
|
|
42
|
-
]
|
|
27
|
+
Object {
|
|
28
|
+
"backgroundColor": "transparent",
|
|
29
|
+
"flex": 1,
|
|
30
|
+
"marginTop": -20,
|
|
31
|
+
"paddingTop": 40,
|
|
32
|
+
}
|
|
43
33
|
}
|
|
44
34
|
>
|
|
45
35
|
<View
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { createContext, ReactNode, useMemo, useState } from "react";
|
|
2
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
|
+
import {
|
|
4
|
+
useCurrentScreenData,
|
|
5
|
+
useNavigation,
|
|
6
|
+
useRoute,
|
|
7
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
8
|
+
import { useModalNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ModalNavigationContext";
|
|
9
|
+
import { useNestedNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NestedNavigationContext";
|
|
10
|
+
import { isNavBarVisible } from "../../Components/Screen/navigationHandler";
|
|
11
|
+
|
|
12
|
+
type ScreenContextType = {
|
|
13
|
+
navBar: {
|
|
14
|
+
visible: boolean;
|
|
15
|
+
title: string;
|
|
16
|
+
summary: string;
|
|
17
|
+
setVisible: (state: boolean) => void;
|
|
18
|
+
setTitle: (title: string) => void;
|
|
19
|
+
setSummary: (subtitle: string) => void;
|
|
20
|
+
};
|
|
21
|
+
legacyFormatScreenData: LegacyNavigationScreenData | null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ScreenContext = createContext<ScreenContextType>({
|
|
25
|
+
navBar: {
|
|
26
|
+
visible: true,
|
|
27
|
+
title: "",
|
|
28
|
+
summary: "",
|
|
29
|
+
setVisible: (_state) => {},
|
|
30
|
+
setTitle: (_title) => {},
|
|
31
|
+
setSummary: (_subtitle) => {},
|
|
32
|
+
},
|
|
33
|
+
legacyFormatScreenData: {} as LegacyNavigationScreenData,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function ScreenContextProvider({
|
|
37
|
+
children,
|
|
38
|
+
pathname,
|
|
39
|
+
}: {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
pathname: string;
|
|
42
|
+
}) {
|
|
43
|
+
const { data, modalData, videoModalState, canGoBack } = useNavigation();
|
|
44
|
+
|
|
45
|
+
const { rivers: _rivers } = usePickFromState(["rivers", "plugins"]);
|
|
46
|
+
|
|
47
|
+
// There are 4 route scenarios
|
|
48
|
+
// For regular screens take date from navigator stack.
|
|
49
|
+
// is path is model grab screenData from modal state
|
|
50
|
+
// if path is video modal grab screenData from video state
|
|
51
|
+
// if path is hook modal grab screenData from hook state
|
|
52
|
+
|
|
53
|
+
const { screenData: routeScreenData } = useRoute();
|
|
54
|
+
|
|
55
|
+
const isModal = useModalNavigationContext();
|
|
56
|
+
const isNested = useNestedNavigationContext();
|
|
57
|
+
const currentScreenScreenData = useCurrentScreenData();
|
|
58
|
+
|
|
59
|
+
const [navBarTitle, setNavBarTitle] = useState("");
|
|
60
|
+
const [navBarSummary, setNavBarSummary] = useState("");
|
|
61
|
+
const [navBarVisible, setNavBarVisible] = useState(true);
|
|
62
|
+
|
|
63
|
+
const isHook = pathname.includes("hook");
|
|
64
|
+
|
|
65
|
+
// screenData is replacement of useScreenContext()
|
|
66
|
+
const screenData = useMemo(() => {
|
|
67
|
+
if (isModal && modalData) return modalData ?? ({} as NavigationScreenData);
|
|
68
|
+
|
|
69
|
+
if (isNested && data?.nested) {
|
|
70
|
+
return data?.nested ?? ({} as ScreenData);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return data ?? ({} as ScreenData);
|
|
74
|
+
}, [isModal, isNested, modalData, data]);
|
|
75
|
+
|
|
76
|
+
const isVisible = isNavBarVisible(
|
|
77
|
+
pathname,
|
|
78
|
+
currentScreenScreenData, // what fallback should be if currentScreenData is not available?
|
|
79
|
+
navBarVisible,
|
|
80
|
+
canGoBack(isHook, pathname),
|
|
81
|
+
videoModalState
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const navBarState = useMemo(() => {
|
|
85
|
+
return {
|
|
86
|
+
title: navBarTitle,
|
|
87
|
+
summary: navBarSummary,
|
|
88
|
+
visible: isVisible,
|
|
89
|
+
setTitle: setNavBarTitle,
|
|
90
|
+
setSummary: setNavBarSummary,
|
|
91
|
+
setVisible: setNavBarVisible,
|
|
92
|
+
};
|
|
93
|
+
}, [isVisible, navBarTitle, navBarSummary]);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<ScreenContext.Provider
|
|
97
|
+
value={useMemo(
|
|
98
|
+
() => ({
|
|
99
|
+
navBar: navBarState,
|
|
100
|
+
legacyFormatScreenData: routeScreenData,
|
|
101
|
+
}),
|
|
102
|
+
[navBarState, screenData, routeScreenData]
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</ScreenContext.Provider>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function withScreenContext(Component: React.ComponentType<any>) {
|
|
111
|
+
return function WithScreenContextWrapper(props) {
|
|
112
|
+
return (
|
|
113
|
+
<ScreenContext.Consumer>
|
|
114
|
+
{(value) => <Component {...props} screenContext={value} />}
|
|
115
|
+
</ScreenContext.Consumer>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-rc.1",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"redux-mock-store": "^1.5.3"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@applicaster/applicaster-types": "
|
|
39
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
40
|
-
"@applicaster/zapp-react-native-redux": "
|
|
41
|
-
"@applicaster/zapp-react-native-utils": "
|
|
38
|
+
"@applicaster/applicaster-types": "12.0.0-rc.1",
|
|
39
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.1",
|
|
40
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.1",
|
|
41
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.1",
|
|
42
42
|
"promise": "^8.3.0",
|
|
43
43
|
"react-router-native": "^5.1.2",
|
|
44
44
|
"url": "^0.11.0",
|