@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3011001369 → 14.0.0-alpha.3065652724
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/Cell/Cell.tsx +91 -64
- package/Components/Cell/CellWithFocusable.tsx +3 -0
- package/Components/FeedLoader/FeedLoader.tsx +1 -1
- package/Components/Focusable/Focusable.tsx +10 -3
- package/Components/Focusable/FocusableTvOS.tsx +2 -2
- package/Components/Focusable/Touchable.tsx +5 -3
- package/Components/Focusable/index.android.tsx +8 -4
- package/Components/FocusableGroup/FocusableTvOS.tsx +1 -1
- package/Components/FocusableList/FocusableItem.tsx +4 -3
- package/Components/FocusableList/FocusableListItemWrapper.tsx +2 -1
- package/Components/FocusableList/hooks/useCellState.android.ts +13 -3
- package/Components/FocusableList/index.tsx +16 -9
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +9 -11
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +0 -12
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +65 -17
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +21 -3
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +6 -3
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +26 -6
- package/Components/PlayerContainer/PlayerContainer.tsx +4 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -42
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapHeightContext.ts +8 -0
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapRefContext.ts +8 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +14 -4
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
- package/Components/Screen/__tests__/navigationHandler.test.ts +133 -22
- package/Components/Screen/index.tsx +22 -5
- package/Components/Screen/navigationHandler.ts +20 -2
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +2 -2
- package/Components/ScreenRevealManager/utils/index.ts +23 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +12 -0
- package/Components/Tabs/TV/Tabs.android.tsx +1 -1
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
- package/Components/TextInputTv/index.tsx +11 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +3 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +294 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +93 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +42 -22
- package/Components/VideoModal/PlayerDetails.tsx +5 -5
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +9 -1
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +40 -15
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +2 -2
- package/Components/VideoModal/hooks/utils/index.ts +4 -0
- package/Contexts/CellFocusedStateContext/index.tsx +27 -0
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +6 -10
- package/events/index.ts +2 -0
- package/package.json +5 -5
|
@@ -28,17 +28,10 @@ interface Props {
|
|
|
28
28
|
onAsyncRender: () => void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
displayMode,
|
|
36
|
-
imageSizing,
|
|
37
|
-
fitPosition,
|
|
38
|
-
fixedHeight,
|
|
39
|
-
fixedWidth,
|
|
40
|
-
onAsyncRender,
|
|
41
|
-
} = props;
|
|
31
|
+
/** Secondary Image Dynamic does not render until the image is loaded */
|
|
32
|
+
const SecondaryImageDynamic = (props: Props) => {
|
|
33
|
+
const { uri, style, displayMode, imageSizing, fitPosition, onAsyncRender } =
|
|
34
|
+
props;
|
|
42
35
|
|
|
43
36
|
const imageDimension = useGetImageDimensions(
|
|
44
37
|
uri,
|
|
@@ -46,13 +39,9 @@ const SecondaryImageComponent = (props: Props) => {
|
|
|
46
39
|
isImageSizingFit(imageSizing) ? undefined : (style.height as number)
|
|
47
40
|
);
|
|
48
41
|
|
|
49
|
-
const containerHeight =
|
|
50
|
-
? fixedHeight
|
|
51
|
-
: imageDimension?.height;
|
|
42
|
+
const containerHeight = imageDimension?.height;
|
|
52
43
|
|
|
53
|
-
const containerWidth =
|
|
54
|
-
? fixedWidth
|
|
55
|
-
: style?.width;
|
|
44
|
+
const containerWidth = style?.width;
|
|
56
45
|
|
|
57
46
|
if (isNil(imageDimension?.aspectRatio)) {
|
|
58
47
|
return null;
|
|
@@ -80,4 +69,63 @@ const SecondaryImageComponent = (props: Props) => {
|
|
|
80
69
|
);
|
|
81
70
|
};
|
|
82
71
|
|
|
72
|
+
/** Secondary Image Fixed does not render the image until the image is loaded, but keep container rendered */
|
|
73
|
+
const SecondaryImageFixed = (props: Props) => {
|
|
74
|
+
const {
|
|
75
|
+
uri,
|
|
76
|
+
style,
|
|
77
|
+
displayMode,
|
|
78
|
+
imageSizing,
|
|
79
|
+
fitPosition,
|
|
80
|
+
fixedHeight,
|
|
81
|
+
fixedWidth,
|
|
82
|
+
onAsyncRender,
|
|
83
|
+
} = props;
|
|
84
|
+
|
|
85
|
+
const imageDimension = useGetImageDimensions(
|
|
86
|
+
uri,
|
|
87
|
+
style.width as number,
|
|
88
|
+
isImageSizingFit(imageSizing) ? undefined : (style.height as number)
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<View style={style} onLayout={onAsyncRender}>
|
|
93
|
+
{isNil(imageDimension?.aspectRatio) ? null : (
|
|
94
|
+
<Image
|
|
95
|
+
{...props}
|
|
96
|
+
source={{ uri }}
|
|
97
|
+
style={{
|
|
98
|
+
...getStyle({
|
|
99
|
+
imageSizing,
|
|
100
|
+
fitPosition,
|
|
101
|
+
displayMode,
|
|
102
|
+
imageDimension,
|
|
103
|
+
containerHeight: fixedHeight,
|
|
104
|
+
containerWidth: fixedWidth,
|
|
105
|
+
}),
|
|
106
|
+
borderRadius: style.borderRadius,
|
|
107
|
+
aspectRatio: imageDimension.aspectRatio,
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
</View>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const SecondaryImageComponent = (props: Props) => {
|
|
116
|
+
const { uri, displayMode } = props;
|
|
117
|
+
|
|
118
|
+
if (!uri) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const isFixed = isDisplayModeFixed(displayMode);
|
|
123
|
+
|
|
124
|
+
return isFixed ? (
|
|
125
|
+
<SecondaryImageFixed {...props} />
|
|
126
|
+
) : (
|
|
127
|
+
<SecondaryImageDynamic {...props} />
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
83
131
|
export const SecondaryImage = withAsyncRenderHOC(SecondaryImageComponent);
|
|
@@ -4,9 +4,26 @@ import { render } from "@testing-library/react-native";
|
|
|
4
4
|
import { SecondaryImage } from "../Image";
|
|
5
5
|
|
|
6
6
|
describe("SecondaryImage - Image", () => {
|
|
7
|
-
it("SecondaryImage should not render if no
|
|
7
|
+
it("SecondaryImage should not render if no uri", async () => {
|
|
8
8
|
const wrapper = await render(
|
|
9
|
-
<SecondaryImage
|
|
9
|
+
<SecondaryImage
|
|
10
|
+
displayMode="dynamic"
|
|
11
|
+
uri={undefined}
|
|
12
|
+
style={{ width: 100 }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(wrapper.toJSON()).toEqual(null);
|
|
17
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("SecondaryImage should not render if no aspect ratio (dynamic)", async () => {
|
|
21
|
+
const wrapper = await render(
|
|
22
|
+
<SecondaryImage
|
|
23
|
+
displayMode="dynamic"
|
|
24
|
+
uri="someurl"
|
|
25
|
+
style={{ width: 100 }}
|
|
26
|
+
/>
|
|
10
27
|
);
|
|
11
28
|
|
|
12
29
|
expect(wrapper.toJSON()).toEqual(null);
|
|
@@ -16,7 +33,8 @@ describe("SecondaryImage - Image", () => {
|
|
|
16
33
|
it("SecondaryImage should render if known dimensions", async () => {
|
|
17
34
|
const wrapper = await render(
|
|
18
35
|
<SecondaryImage
|
|
19
|
-
uri=""
|
|
36
|
+
uri="someUrl"
|
|
37
|
+
displayMode="dynamic"
|
|
20
38
|
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
21
39
|
/>
|
|
22
40
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`SecondaryImage - Image SecondaryImage should not render if no aspect ratio 1`] = `null`;
|
|
3
|
+
exports[`SecondaryImage - Image SecondaryImage should not render if no aspect ratio (dynamic) 1`] = `null`;
|
|
4
|
+
|
|
5
|
+
exports[`SecondaryImage - Image SecondaryImage should not render if no uri 1`] = `null`;
|
|
4
6
|
|
|
5
7
|
exports[`SecondaryImage - Image SecondaryImage should render if known dimensions 1`] = `
|
|
6
8
|
<View
|
|
@@ -14,10 +16,11 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
14
16
|
}
|
|
15
17
|
>
|
|
16
18
|
<Image
|
|
19
|
+
displayMode="dynamic"
|
|
17
20
|
onAsyncRender={[Function]}
|
|
18
21
|
source={
|
|
19
22
|
{
|
|
20
|
-
"uri": "",
|
|
23
|
+
"uri": "someUrl",
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
style={
|
|
@@ -28,7 +31,7 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
28
31
|
"width": 100,
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
|
-
uri=""
|
|
34
|
+
uri="someUrl"
|
|
32
35
|
/>
|
|
33
36
|
</View>
|
|
34
37
|
`;
|
|
@@ -11,6 +11,8 @@ import { withScaledLineHeight } from "./utils";
|
|
|
11
11
|
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
12
12
|
import { MeasurementPortalContext } from "../../../MeasurmentsPortal";
|
|
13
13
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
14
|
+
import { CellFocusedStateContext } from "@applicaster/zapp-react-native-ui-components/Contexts/CellFocusedStateContext";
|
|
15
|
+
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
14
16
|
|
|
15
17
|
type Props = {
|
|
16
18
|
style: any;
|
|
@@ -35,10 +37,9 @@ const _Text = ({
|
|
|
35
37
|
}: Props) => {
|
|
36
38
|
const _label = useTextLabel({ label, entry });
|
|
37
39
|
const isMeasurement = React.useContext(MeasurementPortalContext);
|
|
40
|
+
const cellFocused = React.useContext(CellFocusedStateContext);
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
+
const accessibilityManager = useAccessibilityManager({});
|
|
42
43
|
|
|
43
44
|
// set maximum possible height for the text in case of measurement
|
|
44
45
|
const height =
|
|
@@ -46,6 +47,27 @@ const _Text = ({
|
|
|
46
47
|
? toNumber(otherProps.numberOfLines) * toNumber(style.lineHeight)
|
|
47
48
|
: undefined;
|
|
48
49
|
|
|
50
|
+
const textLabel = dateTransformEnabled
|
|
51
|
+
? dateFormat(dateTransform, label)
|
|
52
|
+
: textTransform(transformText, _label);
|
|
53
|
+
|
|
54
|
+
React.useLayoutEffect(() => {
|
|
55
|
+
// For FocusableCells with action buttons
|
|
56
|
+
if (otherProps.state) {
|
|
57
|
+
if (otherProps.state === "focused" && cellFocused === true) {
|
|
58
|
+
accessibilityManager.addHeading(textLabel);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (cellFocused === true) {
|
|
62
|
+
accessibilityManager.addHeading(textLabel);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [cellFocused, otherProps.state, textLabel]);
|
|
66
|
+
|
|
67
|
+
if (isNilOrEmpty(_label)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
49
71
|
return (
|
|
50
72
|
<Text
|
|
51
73
|
style={[
|
|
@@ -55,9 +77,7 @@ const _Text = ({
|
|
|
55
77
|
allowFontScaling={false}
|
|
56
78
|
{...withoutLabel(otherProps)}
|
|
57
79
|
>
|
|
58
|
-
{
|
|
59
|
-
? dateFormat(dateTransform, label)
|
|
60
|
-
: textTransform(transformText, _label)}
|
|
80
|
+
{textLabel}
|
|
61
81
|
</Text>
|
|
62
82
|
);
|
|
63
83
|
};
|
|
@@ -423,7 +423,10 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
423
423
|
id: playerContainerId,
|
|
424
424
|
listener: {
|
|
425
425
|
onVideoEnd,
|
|
426
|
-
onError
|
|
426
|
+
onError: (err: Error) => {
|
|
427
|
+
// Adapt Error to the expected shape for onError
|
|
428
|
+
onError({ error: err });
|
|
429
|
+
},
|
|
427
430
|
onLoad,
|
|
428
431
|
onPlayerClose: close,
|
|
429
432
|
onPlayerDetached: close,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import {
|
|
3
|
+
import { FlatList, StyleSheet, View } from "react-native";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
import { RiverItem } from "../RiverItem";
|
|
6
6
|
import { RiverFooter } from "../RiverFooter";
|
|
@@ -9,8 +9,8 @@ import { useScreenConfiguration } from "../useScreenConfiguration";
|
|
|
9
9
|
import { RefreshControl } from "../RefreshControl";
|
|
10
10
|
import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
11
11
|
import {
|
|
12
|
-
useProfilerLogging,
|
|
13
12
|
usePipesCacheReset,
|
|
13
|
+
useProfilerLogging,
|
|
14
14
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
15
15
|
import { useLoadingState } from "./hooks/useLoadingState";
|
|
16
16
|
import { ViewportTracker } from "../../Viewport";
|
|
@@ -25,6 +25,8 @@ import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHo
|
|
|
25
25
|
import { useShallow } from "zustand/react/shallow";
|
|
26
26
|
|
|
27
27
|
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
28
|
+
import { ComponentsMapHeightContext } from "./ContextProviders/ComponentsMapHeightContext";
|
|
29
|
+
import { ComponentsMapRefContext } from "./ContextProviders/ComponentsMapRefContext";
|
|
28
30
|
|
|
29
31
|
const isAndroid = isAndroidPlatform();
|
|
30
32
|
|
|
@@ -70,6 +72,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
70
72
|
} = props;
|
|
71
73
|
|
|
72
74
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
75
|
+
const flatListWrapperRef = React.useRef<View | null>(null);
|
|
73
76
|
const screenConfig = useScreenConfiguration(riverId);
|
|
74
77
|
const screenData = useScreenData(riverId);
|
|
75
78
|
const pullToRefreshEnabled = screenData?.rules?.pull_to_refresh_enabled;
|
|
@@ -265,47 +268,51 @@ function ComponentsMapComponent(props: Props) {
|
|
|
265
268
|
// The Screen Picker in Mobile is completly different than the TV
|
|
266
269
|
// so the various offsets / margins in TV do not apply here.
|
|
267
270
|
return (
|
|
268
|
-
<View style={styles.container}>
|
|
269
|
-
<
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
271
|
+
<View style={styles.container} ref={flatListWrapperRef}>
|
|
272
|
+
<ComponentsMapHeightContext.Provider value={flatListHeight}>
|
|
273
|
+
<ComponentsMapRefContext.Provider value={flatListWrapperRef}>
|
|
274
|
+
<ScreenLoadingMeasurements
|
|
275
|
+
riverId={riverId}
|
|
276
|
+
numberOfComponents={riverComponents.length}
|
|
277
|
+
>
|
|
278
|
+
<ViewportTracker>
|
|
279
|
+
<FlatList
|
|
280
|
+
ref={(ref) => {
|
|
281
|
+
flatListRef.current = ref;
|
|
282
|
+
}}
|
|
283
|
+
// Fix for WebView rerender crashes on Android API 28+
|
|
284
|
+
// https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-964035468
|
|
285
|
+
overScrollMode={isAndroid ? "never" : "auto"}
|
|
286
|
+
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
287
|
+
extraData={feed}
|
|
288
|
+
stickyHeaderIndices={stickyHeaderIndices}
|
|
289
|
+
removeClippedSubviews={isAndroid}
|
|
290
|
+
onLayout={handleOnLayout}
|
|
291
|
+
initialNumToRender={3}
|
|
292
|
+
maxToRenderPerBatch={10}
|
|
293
|
+
windowSize={12}
|
|
294
|
+
keyExtractor={keyExtractor}
|
|
295
|
+
renderItem={renderRiverItem}
|
|
296
|
+
data={riverComponents}
|
|
297
|
+
contentContainerStyle={contentContainerStyle}
|
|
298
|
+
ListFooterComponent={
|
|
299
|
+
<RiverFooter
|
|
300
|
+
flatListHeight={flatListHeight}
|
|
301
|
+
loadingState={loadingState}
|
|
302
|
+
/>
|
|
303
|
+
}
|
|
304
|
+
refreshControl={refreshControl}
|
|
305
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
306
|
+
onScroll={onScroll}
|
|
307
|
+
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
308
|
+
onScrollEndDrag={_onScrollEndDrag}
|
|
309
|
+
scrollEventThrottle={16}
|
|
310
|
+
{...scrollViewExtraProps}
|
|
297
311
|
/>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
303
|
-
onScrollEndDrag={_onScrollEndDrag}
|
|
304
|
-
scrollEventThrottle={16}
|
|
305
|
-
{...scrollViewExtraProps}
|
|
306
|
-
/>
|
|
307
|
-
</ViewportTracker>
|
|
308
|
-
</ScreenLoadingMeasurements>
|
|
312
|
+
</ViewportTracker>
|
|
313
|
+
</ScreenLoadingMeasurements>
|
|
314
|
+
</ComponentsMapRefContext.Provider>
|
|
315
|
+
</ComponentsMapHeightContext.Provider>
|
|
309
316
|
</View>
|
|
310
317
|
);
|
|
311
318
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
|
|
4
|
+
export const ComponentsMapRefContext =
|
|
5
|
+
React.createContext<React.RefObject<View | null> | null>(null);
|
|
6
|
+
|
|
7
|
+
export const useComponentsMapRef = () =>
|
|
8
|
+
React.useContext(ComponentsMapRefContext);
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
setFocusOnMenu,
|
|
11
11
|
} from "@applicaster/zapp-react-native-utils/appUtils/focusManagerAux";
|
|
12
12
|
|
|
13
|
+
import { waitUntilScreenRevealManagerIsReady } from "@applicaster/zapp-react-native-ui-components/Components/ScreenRevealManager/utils";
|
|
14
|
+
|
|
13
15
|
type Return =
|
|
14
16
|
| {
|
|
15
17
|
onContent: true;
|
|
@@ -57,14 +59,22 @@ export const useInitialFocus = (): void => {
|
|
|
57
59
|
React.useEffect(() => {
|
|
58
60
|
const initialFocus = getInitialFocus(focusOnContent, isNavBarVisible);
|
|
59
61
|
|
|
60
|
-
if (initialFocus.
|
|
61
|
-
|
|
62
|
+
if (initialFocus.onMenu) {
|
|
63
|
+
setFocusOnMenu(currentRoute);
|
|
62
64
|
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
if (initialFocus.
|
|
67
|
-
|
|
68
|
+
if (initialFocus.onContent) {
|
|
69
|
+
const subscription = waitUntilScreenRevealManagerIsReady().subscribe(
|
|
70
|
+
() => {
|
|
71
|
+
setFocusOnContent(currentRoute);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return () => {
|
|
76
|
+
subscription.unsubscribe();
|
|
77
|
+
};
|
|
68
78
|
}
|
|
69
79
|
}, []);
|
|
70
80
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<Screen Component /> when the navbar should be hidden renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
|
+
importantForAccessibility="yes"
|
|
5
6
|
style={
|
|
6
7
|
{
|
|
7
8
|
"backgroundColor": "blue",
|
|
@@ -34,6 +35,7 @@ exports[`<Screen Component /> when the navbar should be hidden renders correctly
|
|
|
34
35
|
|
|
35
36
|
exports[`<Screen Component /> when the navbar should show renders correctly 1`] = `
|
|
36
37
|
<View
|
|
38
|
+
importantForAccessibility="yes"
|
|
37
39
|
style={
|
|
38
40
|
{
|
|
39
41
|
"backgroundColor": "blue",
|
|
@@ -3,61 +3,172 @@ import { isMenuVisible } from "../navigationHandler";
|
|
|
3
3
|
describe("NavigationHandler", () => {
|
|
4
4
|
describe("isMenuVisible", () => {
|
|
5
5
|
it("returns false when the route is a player route", () => {
|
|
6
|
-
const menuVisible = isMenuVisible("/playable/some_vod_item", {}
|
|
6
|
+
const menuVisible = isMenuVisible("/playable/some_vod_item", {}, [
|
|
7
|
+
{
|
|
8
|
+
identifier: "quick-brick-bottom-tabs",
|
|
9
|
+
category: "menu",
|
|
10
|
+
name: "Bottom Tabs",
|
|
11
|
+
},
|
|
12
|
+
]);
|
|
13
|
+
|
|
7
14
|
expect(menuVisible).toBe(false);
|
|
8
15
|
});
|
|
9
16
|
|
|
10
17
|
describe("when screen is a hook", () => {
|
|
11
18
|
it("returns true if the `showNavBar` flag is set to true", () => {
|
|
12
|
-
const menuVisible = isMenuVisible(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const menuVisible = isMenuVisible(
|
|
20
|
+
"",
|
|
21
|
+
{
|
|
22
|
+
hookPlugin: {
|
|
23
|
+
module: {
|
|
24
|
+
showNavBar: true,
|
|
25
|
+
},
|
|
16
26
|
},
|
|
27
|
+
navigations: [
|
|
28
|
+
{
|
|
29
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
30
|
+
identifier: "quick-brick-bottom-tabs",
|
|
31
|
+
category: "menu",
|
|
32
|
+
name: "Bottom Tabs",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
17
35
|
},
|
|
18
|
-
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
identifier: "quick-brick-bottom-tabs",
|
|
39
|
+
category: "menu",
|
|
40
|
+
name: "Bottom Tabs",
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
);
|
|
19
44
|
|
|
20
45
|
expect(menuVisible).toBe(true);
|
|
21
46
|
});
|
|
22
47
|
|
|
23
48
|
it("returns true if presentFullScreen flag is set to false", () => {
|
|
24
|
-
const menuVisible = isMenuVisible(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
const menuVisible = isMenuVisible(
|
|
50
|
+
"",
|
|
51
|
+
{
|
|
52
|
+
hookPlugin: {
|
|
53
|
+
module: {
|
|
54
|
+
presentFullScreen: false,
|
|
55
|
+
},
|
|
28
56
|
},
|
|
57
|
+
navigations: [
|
|
58
|
+
{
|
|
59
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
60
|
+
identifier: "quick-brick-bottom-tabs",
|
|
61
|
+
category: "menu",
|
|
62
|
+
name: "Bottom Tabs",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
29
65
|
},
|
|
30
|
-
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
identifier: "quick-brick-bottom-tabs",
|
|
69
|
+
category: "menu",
|
|
70
|
+
name: "Bottom Tabs",
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
);
|
|
31
74
|
|
|
32
75
|
expect(menuVisible).toBe(true);
|
|
33
76
|
});
|
|
34
77
|
|
|
35
78
|
it("returns false if presentFullScreen flag is set to true", () => {
|
|
36
|
-
const menuVisible = isMenuVisible(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
const menuVisible = isMenuVisible(
|
|
80
|
+
"",
|
|
81
|
+
{
|
|
82
|
+
hookPlugin: {
|
|
83
|
+
module: {
|
|
84
|
+
presentFullScreen: true,
|
|
85
|
+
},
|
|
40
86
|
},
|
|
87
|
+
navigations: [
|
|
88
|
+
{
|
|
89
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
90
|
+
identifier: "quick-brick-bottom-tabs",
|
|
91
|
+
category: "menu",
|
|
92
|
+
name: "Bottom Tabs",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
41
95
|
},
|
|
42
|
-
|
|
96
|
+
[
|
|
97
|
+
{
|
|
98
|
+
identifier: "quick-brick-bottom-tabs",
|
|
99
|
+
category: "menu",
|
|
100
|
+
name: "Bottom Tabs",
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
);
|
|
43
104
|
|
|
44
105
|
expect(menuVisible).toBe(false);
|
|
45
106
|
});
|
|
46
107
|
});
|
|
47
108
|
|
|
48
109
|
it("returns false if the screen's general settings allow screen presentation", () => {
|
|
49
|
-
const menuVisible = isMenuVisible(
|
|
50
|
-
|
|
51
|
-
|
|
110
|
+
const menuVisible = isMenuVisible(
|
|
111
|
+
"",
|
|
112
|
+
{
|
|
113
|
+
general: {
|
|
114
|
+
allow_screen_plugin_presentation: true,
|
|
115
|
+
},
|
|
116
|
+
navigations: [
|
|
117
|
+
{
|
|
118
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
119
|
+
identifier: "quick-brick-bottom-tabs",
|
|
120
|
+
category: "menu",
|
|
121
|
+
name: "Bottom Tabs",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
52
124
|
},
|
|
53
|
-
|
|
125
|
+
[
|
|
126
|
+
{
|
|
127
|
+
identifier: "quick-brick-bottom-tabs",
|
|
128
|
+
category: "menu",
|
|
129
|
+
name: "Bottom Tabs",
|
|
130
|
+
},
|
|
131
|
+
]
|
|
132
|
+
);
|
|
54
133
|
|
|
55
134
|
expect(menuVisible).toBe(false);
|
|
56
135
|
});
|
|
57
136
|
|
|
58
|
-
it("returns
|
|
59
|
-
const menuVisible = isMenuVisible(
|
|
137
|
+
it("returns false otherwise", () => {
|
|
138
|
+
const menuVisible = isMenuVisible(
|
|
139
|
+
"any",
|
|
140
|
+
{
|
|
141
|
+
navigations: [
|
|
142
|
+
{
|
|
143
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
144
|
+
identifier: "quick-brick-bottom-tabs",
|
|
145
|
+
category: "menu",
|
|
146
|
+
name: "Bottom Tabs",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
identifier: "quick-brick-bottom-tabs",
|
|
153
|
+
category: "menu",
|
|
154
|
+
name: "Bottom Tabs",
|
|
155
|
+
},
|
|
156
|
+
]
|
|
157
|
+
);
|
|
158
|
+
|
|
60
159
|
expect(menuVisible).toBe(true);
|
|
61
160
|
});
|
|
161
|
+
|
|
162
|
+
it("returns false otherwise", () => {
|
|
163
|
+
const menuVisible = isMenuVisible("", {}, [
|
|
164
|
+
{
|
|
165
|
+
identifier: "quick-brick-bottom-tabs",
|
|
166
|
+
category: "menu",
|
|
167
|
+
name: "Bottom Tabs",
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
expect(menuVisible).toBe(false);
|
|
172
|
+
});
|
|
62
173
|
});
|
|
63
174
|
});
|