@applicaster/zapp-react-native-ui-components 16.0.0-alpha.1453660071 → 16.0.0-alpha.1454930193
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/tv/__tests__/audioPlayer.test.js +19 -0
- package/Components/AudioPlayer/tv/__tests__/index.test.tsx +120 -0
- package/Components/AudioPlayer/tv/index.tsx +5 -1
- package/Components/Cell/Cell.tsx +3 -6
- package/Components/Cell/TvOSCellComponent.tsx +0 -1
- package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +64 -0
- package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
- package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +18 -0
- package/Components/LinkHandler/LinkHandler.tsx +2 -7
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +47 -21
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +34 -6
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +420 -125
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +114 -19
- package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +19 -8
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +2 -4
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +29 -9
- package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +4 -0
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
- package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +154 -100
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/AssetComponent.tsx +15 -4
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +56 -22
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +6 -4
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +3 -1
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +32 -21
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +15 -4
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +23 -16
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +8 -3
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +2 -2
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/insertButtonsBetweenLabels.test.ts +45 -13
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +2 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -2
- package/Components/MasterCell/contexts/PressedStateContext.ts +3 -0
- package/Components/MasterCell/hooks/index.ts +2 -0
- package/Components/MasterCell/hooks/usePressedState.ts +4 -0
- package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +56 -0
- package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
- package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +24 -0
- package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +61 -0
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +392 -0
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +772 -0
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +728 -0
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +1007 -0
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +205 -0
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +113 -0
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/NowPlayingHeaderSection.test.tsx +36 -0
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +9 -0
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +356 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +521 -0
- package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +505 -50
- package/Components/ModalComponent/Button/index.tsx +5 -3
- package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
- package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
- package/Components/ModalComponent/Header/index.tsx +20 -7
- package/Components/ModalComponent/Header/utils.ts +1 -1
- package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
- package/Components/ModalComponent/SortableList.tsx +156 -0
- package/Components/ModalComponent/SortableList.web.tsx +34 -0
- package/Components/ModalComponent/TextInputContent.tsx +135 -0
- package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +343 -0
- package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +169 -0
- package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
- package/Components/ModalComponent/index.tsx +18 -9
- package/Components/ModalComponent/presets/__tests__/getCell.test.ts +90 -0
- package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
- package/Components/ModalComponent/presets/index.ts +27 -0
- package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
- package/Components/ModalComponent/presets/standardCell.tsx +41 -0
- package/Components/ModalComponent/presets/types.ts +35 -0
- package/Components/ModalComponent/showTextInput.ts +52 -0
- package/Components/ModalComponent/utils.ts +82 -21
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +4 -85
- package/Components/OfflineHandler/__tests__/index.test.tsx +78 -18
- package/Components/OfflineHandler/hooks.ts +111 -0
- package/Components/OfflineHandler/index.tsx +51 -73
- package/Components/OfflineHandler/utils/index.ts +1 -13
- package/Components/PlayerContainer/PlayerContainer.tsx +11 -7
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +66 -13
- package/Components/PreloaderWrapper/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -59
- package/Components/River/River.tsx +4 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +140 -75
- package/Components/River/__tests__/componentsMap.test.js +8 -3
- package/Components/River/__tests__/resultCallback.test.tsx +47 -0
- package/Components/Screen/__tests__/Screen.test.tsx +24 -0
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
- package/Components/Screen/index.tsx +5 -0
- package/Components/Screen/navigationHandler.ts +8 -8
- package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +5 -3
- package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +1 -1
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
- package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +21 -4
- package/Components/TopCutoffOverlay/index.tsx +2 -2
- package/Components/Transitioner/Transitioner.tsx +30 -20
- package/Components/Transitioner/__tests__/transitioner.test.js +83 -2
- package/Components/VideoLive/LiveImageManager.ts +9 -3
- package/Components/VideoLive/__tests__/LiveImageManager.test.ts +59 -0
- package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
- package/Contexts/ModalNavigationContext/index.tsx +2 -2
- package/Hooks/useEntryActionsExpander.ts +63 -0
- package/assets/empty-Info.png +0 -0
- package/package.json +6 -5
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +0 -112
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +0 -107
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +0 -153
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -66
- package/Components/OfflineHandler/NotificationView/utils.ts +0 -34
- /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as R from "ramda";
|
|
3
2
|
import { FlatList, StyleSheet, View } from "react-native";
|
|
3
|
+
import { SafeAreaView, EdgeMode, Edge } from "react-native-safe-area-context";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
import { RiverItem } from "../RiverItem";
|
|
6
6
|
import { RiverFooter } from "../RiverFooter";
|
|
@@ -40,6 +40,12 @@ type Props = {
|
|
|
40
40
|
riverId?: string;
|
|
41
41
|
getStaticComponentFeed: any;
|
|
42
42
|
stickyHeaderIndices?: number[];
|
|
43
|
+
safeArea?:
|
|
44
|
+
| {
|
|
45
|
+
edges: Record<Edge, EdgeMode>;
|
|
46
|
+
mode: "padding" | "margin" | undefined;
|
|
47
|
+
}
|
|
48
|
+
| undefined;
|
|
43
49
|
};
|
|
44
50
|
|
|
45
51
|
const styles = StyleSheet.create({
|
|
@@ -52,7 +58,7 @@ const getNearestValue = (value, optionA, optionB) =>
|
|
|
52
58
|
Math.abs(value - optionA) < Math.abs(value - optionB) ? optionA : optionB;
|
|
53
59
|
|
|
54
60
|
const scrollIndicatorInsets = { right: 1 };
|
|
55
|
-
const keyExtractor =
|
|
61
|
+
const keyExtractor = (item) => item.id.toString();
|
|
56
62
|
|
|
57
63
|
function ComponentsMapComponent(props: Props) {
|
|
58
64
|
const {
|
|
@@ -64,6 +70,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
64
70
|
riverId,
|
|
65
71
|
getStaticComponentFeed,
|
|
66
72
|
stickyHeaderIndices,
|
|
73
|
+
safeArea,
|
|
67
74
|
} = props;
|
|
68
75
|
|
|
69
76
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
@@ -77,7 +84,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
77
84
|
|
|
78
85
|
const riverComponents = React.useMemo(() => {
|
|
79
86
|
if (feed?.entry?.length < components.length) {
|
|
80
|
-
return
|
|
87
|
+
return components.slice(0, feed?.entry?.length);
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
return components;
|
|
@@ -92,7 +99,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
92
99
|
const { loadingState, onLoadFinished, onLoadFailed, shouldShowLoadingError } =
|
|
93
100
|
useLoadingState(riverComponents.length, onLoadDone);
|
|
94
101
|
|
|
95
|
-
const theme = useTheme();
|
|
102
|
+
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
96
103
|
|
|
97
104
|
const renderRiverItem = React.useCallback(
|
|
98
105
|
({ item, index }) => {
|
|
@@ -121,21 +128,13 @@ function ComponentsMapComponent(props: Props) {
|
|
|
121
128
|
|
|
122
129
|
const screenStyle = React.useMemo(
|
|
123
130
|
() => ({
|
|
124
|
-
paddingTop: ifEmptyUseFallback(
|
|
125
|
-
screenConfig.paddingTop,
|
|
126
|
-
R.prop("screen_padding_top")(theme)
|
|
127
|
-
),
|
|
128
|
-
paddingBottom: ifEmptyUseFallback(
|
|
129
|
-
screenConfig.paddingBottom,
|
|
130
|
-
R.prop("screen_padding_bottom")(theme)
|
|
131
|
-
),
|
|
132
131
|
paddingLeft: ifEmptyUseFallback(
|
|
133
132
|
screenConfig.paddingLeft,
|
|
134
|
-
|
|
133
|
+
theme.screen_padding_left
|
|
135
134
|
),
|
|
136
135
|
paddingRight: ifEmptyUseFallback(
|
|
137
136
|
screenConfig.paddingRight,
|
|
138
|
-
|
|
137
|
+
theme.screen_padding_right
|
|
139
138
|
),
|
|
140
139
|
}),
|
|
141
140
|
[riverId]
|
|
@@ -266,51 +265,79 @@ function ComponentsMapComponent(props: Props) {
|
|
|
266
265
|
numberOfComponents={riverComponents.length}
|
|
267
266
|
>
|
|
268
267
|
<ViewportTracker>
|
|
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
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
268
|
+
<>
|
|
269
|
+
<FlatList
|
|
270
|
+
ListHeaderComponent={
|
|
271
|
+
<SafeAreaView
|
|
272
|
+
mode={safeArea?.mode ?? "margin"}
|
|
273
|
+
style={{
|
|
274
|
+
paddingTop: ifEmptyUseFallback(
|
|
275
|
+
screenConfig.paddingTop,
|
|
276
|
+
theme.screen_padding_top
|
|
277
|
+
),
|
|
278
|
+
height: StyleSheet.hairlineWidth,
|
|
279
|
+
}}
|
|
280
|
+
edges={{ top: safeArea?.edges?.top ?? "off" }}
|
|
281
|
+
/>
|
|
282
|
+
}
|
|
283
|
+
testID="components-map-flat-list"
|
|
284
|
+
ref={(ref) => {
|
|
285
|
+
flatListRef.current = ref;
|
|
286
|
+
}}
|
|
287
|
+
// Fix for WebView rerender crashes on Android API 28+
|
|
288
|
+
// https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-964035468
|
|
289
|
+
overScrollMode={isAndroid ? "never" : "auto"}
|
|
290
|
+
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
291
|
+
extraData={feed}
|
|
292
|
+
stickyHeaderIndices={stickyHeaderIndices}
|
|
293
|
+
removeClippedSubviews={isAndroid}
|
|
294
|
+
onLayout={handleOnLayout}
|
|
295
|
+
initialNumToRender={3}
|
|
296
|
+
maxToRenderPerBatch={10}
|
|
297
|
+
windowSize={12}
|
|
298
|
+
keyExtractor={keyExtractor}
|
|
299
|
+
renderItem={renderRiverItem}
|
|
300
|
+
data={riverComponents}
|
|
301
|
+
contentContainerStyle={contentContainerStyle}
|
|
302
|
+
ListFooterComponent={
|
|
303
|
+
<>
|
|
304
|
+
<RiverFooter
|
|
305
|
+
flatListHeight={flatListHeight}
|
|
306
|
+
loadingState={loadingState}
|
|
307
|
+
/>
|
|
308
|
+
<SafeAreaView
|
|
309
|
+
mode={safeArea?.mode ?? "margin"}
|
|
310
|
+
style={{
|
|
311
|
+
paddingBottom: ifEmptyUseFallback(
|
|
312
|
+
screenConfig.paddingBottom,
|
|
313
|
+
theme.screen_padding_bottom
|
|
314
|
+
),
|
|
315
|
+
height: StyleSheet.hairlineWidth,
|
|
316
|
+
}}
|
|
317
|
+
edges={{ bottom: safeArea?.edges?.bottom ?? "off" }}
|
|
318
|
+
/>
|
|
319
|
+
</>
|
|
320
|
+
}
|
|
321
|
+
refreshControl={refreshControl}
|
|
322
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
323
|
+
onScroll={onScroll}
|
|
324
|
+
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
325
|
+
onScrollEndDrag={_onScrollEndDrag}
|
|
326
|
+
scrollEventThrottle={16}
|
|
327
|
+
{...scrollViewExtraProps}
|
|
328
|
+
onEndReached={
|
|
329
|
+
/* When wrapped in a parent ScrollView (e.g. tabs),
|
|
304
330
|
this FlatList doesn't scroll so onEndReached can fire repeatedly;
|
|
305
331
|
skip it here and let the parent ScrollView emit scroll-end instead. */
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
332
|
+
isScreenWrappedInContainer
|
|
333
|
+
? undefined
|
|
334
|
+
: () => {
|
|
335
|
+
if (!hasUserScrolledRef.current) return;
|
|
336
|
+
emitScrollEndReached();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/>
|
|
340
|
+
</>
|
|
314
341
|
</ViewportTracker>
|
|
315
342
|
</ScreenLoadingMeasurements>
|
|
316
343
|
</ComponentsMapRefContext.Provider>
|
|
@@ -320,6 +347,5 @@ function ComponentsMapComponent(props: Props) {
|
|
|
320
347
|
}
|
|
321
348
|
|
|
322
349
|
export const ComponentsMap = React.memo(
|
|
323
|
-
withComponentsMapProvider(ComponentsMapComponent)
|
|
324
|
-
R.equals
|
|
350
|
+
withComponentsMapProvider(ComponentsMapComponent)
|
|
325
351
|
);
|
|
@@ -20,6 +20,8 @@ type Props = ZappScreenProps & {
|
|
|
20
20
|
setIsScreenWrappedInContainer: (isInsideContainer: boolean) => void;
|
|
21
21
|
screenContext: ZappRiver;
|
|
22
22
|
river: ZappRiver;
|
|
23
|
+
/** Result channel for screens presented as a modal; forwarded to the resolved screen. */
|
|
24
|
+
resultCallback?: hookCallback;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
export class RiverComponent extends React.Component<Props> {
|
|
@@ -64,6 +66,7 @@ export class RiverComponent extends React.Component<Props> {
|
|
|
64
66
|
isInsideContainer,
|
|
65
67
|
groupId,
|
|
66
68
|
scrollViewExtraProps,
|
|
69
|
+
resultCallback,
|
|
67
70
|
} = this.props;
|
|
68
71
|
|
|
69
72
|
const { id, type } = river;
|
|
@@ -77,6 +80,7 @@ export class RiverComponent extends React.Component<Props> {
|
|
|
77
80
|
})}
|
|
78
81
|
screenId={id}
|
|
79
82
|
screenType={type}
|
|
83
|
+
resultCallback={resultCallback}
|
|
80
84
|
/>
|
|
81
85
|
);
|
|
82
86
|
}
|
|
@@ -14,95 +14,125 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
14
14
|
>
|
|
15
15
|
<RCTScrollView
|
|
16
16
|
ListFooterComponent={
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"closed": false,
|
|
27
|
-
"currentObservers": null,
|
|
28
|
-
"hasError": false,
|
|
29
|
-
"isStopped": false,
|
|
30
|
-
"observers": [
|
|
31
|
-
SafeSubscriber {
|
|
32
|
-
"_finalizers": [
|
|
33
|
-
Subscription {
|
|
34
|
-
"_finalizers": null,
|
|
35
|
-
"_parentage": [Circular],
|
|
36
|
-
"closed": false,
|
|
37
|
-
"initialTeardown": [Function],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
"_parentage": null,
|
|
41
|
-
"closed": false,
|
|
42
|
-
"destination": ConsumerObserver {
|
|
43
|
-
"partialObserver": {
|
|
44
|
-
"complete": undefined,
|
|
45
|
-
"error": undefined,
|
|
46
|
-
"next": [Function],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
"initialTeardown": undefined,
|
|
50
|
-
"isStopped": false,
|
|
17
|
+
<React.Fragment>
|
|
18
|
+
<Memo(RiverFooterComponent)
|
|
19
|
+
flatListHeight={null}
|
|
20
|
+
loadingState={
|
|
21
|
+
BehaviorSubject {
|
|
22
|
+
"_value": {
|
|
23
|
+
"done": false,
|
|
24
|
+
"index": -1,
|
|
25
|
+
"waitForAllComponents": false,
|
|
51
26
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
27
|
+
"closed": false,
|
|
28
|
+
"currentObservers": null,
|
|
29
|
+
"hasError": false,
|
|
30
|
+
"isStopped": false,
|
|
31
|
+
"observers": [
|
|
32
|
+
SafeSubscriber {
|
|
33
|
+
"_finalizers": [
|
|
34
|
+
Subscription {
|
|
35
|
+
"_finalizers": null,
|
|
36
|
+
"_parentage": [Circular],
|
|
37
|
+
"closed": false,
|
|
38
|
+
"initialTeardown": [Function],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"_parentage": null,
|
|
42
|
+
"closed": false,
|
|
43
|
+
"destination": ConsumerObserver {
|
|
44
|
+
"partialObserver": {
|
|
45
|
+
"complete": undefined,
|
|
46
|
+
"error": undefined,
|
|
47
|
+
"next": [Function],
|
|
48
|
+
},
|
|
68
49
|
},
|
|
50
|
+
"initialTeardown": undefined,
|
|
51
|
+
"isStopped": false,
|
|
69
52
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
SafeSubscriber {
|
|
54
|
+
"_finalizers": [
|
|
55
|
+
Subscription {
|
|
56
|
+
"_finalizers": null,
|
|
57
|
+
"_parentage": [Circular],
|
|
58
|
+
"closed": false,
|
|
59
|
+
"initialTeardown": [Function],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
"_parentage": null,
|
|
63
|
+
"closed": false,
|
|
64
|
+
"destination": ConsumerObserver {
|
|
65
|
+
"partialObserver": {
|
|
66
|
+
"complete": undefined,
|
|
67
|
+
"error": undefined,
|
|
68
|
+
"next": [Function],
|
|
69
|
+
},
|
|
80
70
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
"initialTeardown": undefined,
|
|
72
|
+
"isStopped": false,
|
|
73
|
+
},
|
|
74
|
+
SafeSubscriber {
|
|
75
|
+
"_finalizers": [
|
|
76
|
+
Subscription {
|
|
77
|
+
"_finalizers": null,
|
|
78
|
+
"_parentage": [Circular],
|
|
79
|
+
"closed": false,
|
|
80
|
+
"initialTeardown": [Function],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
"_parentage": null,
|
|
84
|
+
"closed": false,
|
|
85
|
+
"destination": ConsumerObserver {
|
|
86
|
+
"partialObserver": {
|
|
87
|
+
"complete": undefined,
|
|
88
|
+
"error": undefined,
|
|
89
|
+
"next": [Function],
|
|
90
|
+
},
|
|
89
91
|
},
|
|
92
|
+
"initialTeardown": undefined,
|
|
93
|
+
"isStopped": false,
|
|
90
94
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
],
|
|
96
|
+
"thrownError": null,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
<View
|
|
101
|
+
edges={
|
|
102
|
+
{
|
|
103
|
+
"bottom": "off",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
mode="margin"
|
|
107
|
+
style={
|
|
108
|
+
{
|
|
109
|
+
"height": 0.5,
|
|
110
|
+
"paddingBottom": undefined,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/>
|
|
114
|
+
</React.Fragment>
|
|
115
|
+
}
|
|
116
|
+
ListHeaderComponent={
|
|
117
|
+
<View
|
|
118
|
+
edges={
|
|
119
|
+
{
|
|
120
|
+
"top": "off",
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
mode="margin"
|
|
124
|
+
style={
|
|
125
|
+
{
|
|
126
|
+
"height": 0.5,
|
|
127
|
+
"paddingTop": undefined,
|
|
96
128
|
}
|
|
97
129
|
}
|
|
98
130
|
/>
|
|
99
131
|
}
|
|
100
132
|
contentContainerStyle={
|
|
101
133
|
{
|
|
102
|
-
"paddingBottom": undefined,
|
|
103
134
|
"paddingLeft": undefined,
|
|
104
135
|
"paddingRight": undefined,
|
|
105
|
-
"paddingTop": undefined,
|
|
106
136
|
}
|
|
107
137
|
}
|
|
108
138
|
data={
|
|
@@ -156,6 +186,25 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
156
186
|
windowSize={12}
|
|
157
187
|
>
|
|
158
188
|
<View>
|
|
189
|
+
<View
|
|
190
|
+
collapsable={false}
|
|
191
|
+
onLayout={[Function]}
|
|
192
|
+
>
|
|
193
|
+
<View
|
|
194
|
+
edges={
|
|
195
|
+
{
|
|
196
|
+
"top": "off",
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
mode="margin"
|
|
200
|
+
style={
|
|
201
|
+
{
|
|
202
|
+
"height": 0.5,
|
|
203
|
+
"paddingTop": undefined,
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/>
|
|
207
|
+
</View>
|
|
159
208
|
<View
|
|
160
209
|
onFocusCapture={[Function]}
|
|
161
210
|
onLayout={[Function]}
|
|
@@ -163,6 +212,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
163
212
|
>
|
|
164
213
|
<View
|
|
165
214
|
onLayout={[Function]}
|
|
215
|
+
style={{}}
|
|
166
216
|
>
|
|
167
217
|
<View />
|
|
168
218
|
</View>
|
|
@@ -174,6 +224,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
174
224
|
>
|
|
175
225
|
<View
|
|
176
226
|
onLayout={[Function]}
|
|
227
|
+
style={{}}
|
|
177
228
|
/>
|
|
178
229
|
</View>
|
|
179
230
|
<View
|
|
@@ -198,6 +249,20 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
198
249
|
size="large"
|
|
199
250
|
/>
|
|
200
251
|
</View>
|
|
252
|
+
<View
|
|
253
|
+
edges={
|
|
254
|
+
{
|
|
255
|
+
"bottom": "off",
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
mode="margin"
|
|
259
|
+
style={
|
|
260
|
+
{
|
|
261
|
+
"height": 0.5,
|
|
262
|
+
"paddingBottom": undefined,
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/>
|
|
201
266
|
</View>
|
|
202
267
|
</View>
|
|
203
268
|
</RCTScrollView>
|
|
@@ -11,9 +11,14 @@ jest.mock(
|
|
|
11
11
|
() => () => null
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
jest.mock("react-native-safe-area-context", () =>
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
jest.mock("react-native-safe-area-context", () => {
|
|
15
|
+
const { View } = jest.requireActual("react-native");
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
SafeAreaView: View,
|
|
19
|
+
useSafeAreaInsets: () => ({ top: 50 }),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
17
22
|
|
|
18
23
|
jest.mock("react-native", () => {
|
|
19
24
|
const RN = jest.genMockFromModule("react-native");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { RiverComponent } from "../River";
|
|
5
|
+
|
|
6
|
+
const mockResolverProps: any[] = [];
|
|
7
|
+
|
|
8
|
+
jest.mock("../../ScreenResolver", () => ({
|
|
9
|
+
ScreenResolver: (props: any) => {
|
|
10
|
+
mockResolverProps.push(props);
|
|
11
|
+
|
|
12
|
+
return null;
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const river = { id: "river-parent-lock", type: "parent_lock" } as any;
|
|
17
|
+
|
|
18
|
+
const baseProps = {
|
|
19
|
+
river,
|
|
20
|
+
screenData: {},
|
|
21
|
+
groupId: "group-1",
|
|
22
|
+
scrollViewExtraProps: {},
|
|
23
|
+
setIsScreenWrappedInContainer: jest.fn(),
|
|
24
|
+
screenContext: { navBar: { setTitle: jest.fn(), setSummary: jest.fn() } },
|
|
25
|
+
} as any;
|
|
26
|
+
|
|
27
|
+
const resolved = () => mockResolverProps[mockResolverProps.length - 1];
|
|
28
|
+
|
|
29
|
+
describe("RiverComponent", () => {
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
mockResolverProps.length = 0;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("forwards resultCallback to the screen it resolves", () => {
|
|
35
|
+
const resultCallback = jest.fn();
|
|
36
|
+
|
|
37
|
+
render(<RiverComponent {...baseProps} resultCallback={resultCallback} />);
|
|
38
|
+
|
|
39
|
+
expect(resolved().resultCallback).toBe(resultCallback);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("resolves the screen without a resultCallback when none was given", () => {
|
|
43
|
+
render(<RiverComponent {...baseProps} />);
|
|
44
|
+
|
|
45
|
+
expect(resolved().resultCallback).toBeUndefined();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -141,6 +141,10 @@ const {
|
|
|
141
141
|
useGetScreenOrientation,
|
|
142
142
|
} = require("@applicaster/zapp-react-native-utils/appUtils/orientationHelper");
|
|
143
143
|
|
|
144
|
+
const {
|
|
145
|
+
useIsScreenActive,
|
|
146
|
+
} = require("@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive");
|
|
147
|
+
|
|
144
148
|
const navigator = {};
|
|
145
149
|
const navBarProps = { nav_items: [] };
|
|
146
150
|
const screenData = {};
|
|
@@ -195,4 +199,24 @@ describe("<Screen Component />", () => {
|
|
|
195
199
|
expect(toJSON()).toMatchSnapshot();
|
|
196
200
|
});
|
|
197
201
|
});
|
|
202
|
+
|
|
203
|
+
describe("when the screen is inactive", () => {
|
|
204
|
+
afterEach(() => {
|
|
205
|
+
useIsScreenActive.mockReturnValue(true);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("hides the screen from VoiceOver (iOS) and TalkBack (Android)", () => {
|
|
209
|
+
useIsScreenActive.mockReturnValue(false);
|
|
210
|
+
|
|
211
|
+
const { UNSAFE_root } = renderWithProviders(
|
|
212
|
+
<Screen {...screenProps} />,
|
|
213
|
+
store
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
expect(UNSAFE_root.findByType(View).props).toMatchObject({
|
|
217
|
+
accessibilityElementsHidden: true,
|
|
218
|
+
importantForAccessibility: "no-hide-descendants",
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|
|
198
222
|
});
|
|
@@ -13,6 +13,7 @@ exports[`<Screen Component /> when the navbar should be hidden renders correctly
|
|
|
13
13
|
}
|
|
14
14
|
>
|
|
15
15
|
<View
|
|
16
|
+
accessibilityElementsHidden={false}
|
|
16
17
|
importantForAccessibility="yes"
|
|
17
18
|
style={
|
|
18
19
|
{
|
|
@@ -58,6 +59,7 @@ exports[`<Screen Component /> when the navbar should show renders correctly 1`]
|
|
|
58
59
|
}
|
|
59
60
|
>
|
|
60
61
|
<View
|
|
62
|
+
accessibilityElementsHidden={false}
|
|
61
63
|
importantForAccessibility="yes"
|
|
62
64
|
style={
|
|
63
65
|
{
|
|
@@ -121,6 +121,11 @@ export function Screen(_props: Props) {
|
|
|
121
121
|
ref={ref}
|
|
122
122
|
style={style}
|
|
123
123
|
importantForAccessibility={!isActive ? "no-hide-descendants" : "yes"}
|
|
124
|
+
// `importantForAccessibility` only affects Android (see RN docs).
|
|
125
|
+
// Without the iOS counterpart below, VoiceOver keeps traversing and
|
|
126
|
+
// focusing elements on an inactive/underlying screen (e.g. Albums In
|
|
127
|
+
// Order) even after a new screen (e.g. an Album) is pushed on top.
|
|
128
|
+
accessibilityElementsHidden={!isActive}
|
|
124
129
|
>
|
|
125
130
|
{isReady ? (
|
|
126
131
|
<>
|
|
@@ -18,10 +18,9 @@ function shouldShowNavigation(route, screenData) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
) {
|
|
21
|
+
const currentScreenData = screenData?.targetScreen || screenData;
|
|
22
|
+
|
|
23
|
+
if (currentScreenData.type === "qb_search_screen") {
|
|
25
24
|
return false;
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -31,10 +30,11 @@ function shouldShowNavigation(route, screenData) {
|
|
|
31
30
|
return hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (currentScreenData?.general?.hide_menu) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (currentScreenData?.general?.allow_screen_plugin_presentation) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -8,9 +8,11 @@ import { componentsLogger } from "../../Helpers/logger";
|
|
|
8
8
|
const logger = componentsLogger.addSubsystem("ScreenFeedLoader");
|
|
9
9
|
|
|
10
10
|
/** Loads and provides `feedData` and store to */
|
|
11
|
-
export const ScreenFeedLoader: React.FC<
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const ScreenFeedLoader: React.FC<{
|
|
12
|
+
id: string;
|
|
13
|
+
feedData: any;
|
|
14
|
+
children: React.ReactElement | null;
|
|
15
|
+
}> = ({ id, feedData, children }) => {
|
|
14
16
|
const { source: feedUrl, mapping } = feedData;
|
|
15
17
|
|
|
16
18
|
const { data, loading, error } = useFeedLoader({
|