@applicaster/zapp-react-native-ui-components 16.0.0-alpha.1020865559 → 16.0.0-alpha.1035454037
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/components/ActionButtonController.tsx +19 -4
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +2 -4
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
- package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -2
- 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 +87 -97
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +87 -126
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +140 -83
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +252 -123
- 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 +3 -3
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +356 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +521 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +498 -66
- 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__/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__/index.test.tsx +109 -0
- package/Components/OfflineHandler/hooks.ts +0 -12
- package/Components/OfflineHandler/index.tsx +42 -4
- package/Components/PlayerContainer/PlayerContainer.tsx +10 -5
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +65 -13
- package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -82
- package/Components/River/River.tsx +4 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -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/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/Transitioner/AnimationManager.js +1 -1
- package/Components/Transitioner/Scene.tsx +4 -3
- package/Components/Transitioner/Transitioner.tsx +71 -33
- package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
- package/Components/VideoLive/LiveImageManager.ts +8 -2
- 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/ModalComponent/AudioPlayer/Components/Action.tsx +0 -332
- /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
|
@@ -29,12 +29,22 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
29
29
|
const { online } = parseConnectionInfo(connectionInfo);
|
|
30
30
|
const prevOnline = usePrevious(online);
|
|
31
31
|
|
|
32
|
+
const stillOfflineAfterResumeCount =
|
|
33
|
+
connectionInfo?.stillOfflineAfterResumeCount ?? 0;
|
|
34
|
+
|
|
35
|
+
const prevStillOfflineAfterResumeCount = usePrevious(
|
|
36
|
+
stillOfflineAfterResumeCount
|
|
37
|
+
);
|
|
38
|
+
|
|
32
39
|
const emitShowToast = useSubscriberFor(SHOW_TOAST_EVENT);
|
|
33
40
|
|
|
34
41
|
const { message, extraMessage, style } = useOfflineHandlerProps(online);
|
|
35
42
|
|
|
36
43
|
const showOnlineToast = useCallback(() => {
|
|
37
|
-
logger.
|
|
44
|
+
logger.info({
|
|
45
|
+
message: "OfflineHandler: device is back online, emit toast",
|
|
46
|
+
data: { online, prevOnline },
|
|
47
|
+
});
|
|
38
48
|
|
|
39
49
|
emitShowToast({
|
|
40
50
|
id: OFFLINE_STATUS_TOAST_ID,
|
|
@@ -43,10 +53,13 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
43
53
|
style,
|
|
44
54
|
timeout: timers.goingOnline,
|
|
45
55
|
});
|
|
46
|
-
}, [emitShowToast, message, extraMessage, style]);
|
|
56
|
+
}, [emitShowToast, message, extraMessage, style, online, prevOnline]);
|
|
47
57
|
|
|
48
58
|
const showOfflineToast = useCallback(() => {
|
|
49
|
-
logger.
|
|
59
|
+
logger.info({
|
|
60
|
+
message: "OfflineHandler: device is offline, emit toast",
|
|
61
|
+
data: { online, prevOnline, stillOfflineAfterResumeCount },
|
|
62
|
+
});
|
|
50
63
|
|
|
51
64
|
emitShowToast({
|
|
52
65
|
id: OFFLINE_STATUS_TOAST_ID,
|
|
@@ -55,7 +68,15 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
55
68
|
style,
|
|
56
69
|
timeout: timers.goingOffline,
|
|
57
70
|
});
|
|
58
|
-
}, [
|
|
71
|
+
}, [
|
|
72
|
+
emitShowToast,
|
|
73
|
+
message,
|
|
74
|
+
extraMessage,
|
|
75
|
+
style,
|
|
76
|
+
online,
|
|
77
|
+
prevOnline,
|
|
78
|
+
stillOfflineAfterResumeCount,
|
|
79
|
+
]);
|
|
59
80
|
|
|
60
81
|
useEffect(() => {
|
|
61
82
|
// On mount there is no previous state yet: only surface the offline toast
|
|
@@ -79,5 +100,22 @@ export const OfflineHandler = ({ children }: Props) => {
|
|
|
79
100
|
}
|
|
80
101
|
}, [online, prevOnline, showOfflineToast, showOnlineToast]);
|
|
81
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
// NetworkStatusProvider bumps this counter when the app resumed while offline
|
|
105
|
+
// and is still offline after the verification delay: remind the user.
|
|
106
|
+
if (
|
|
107
|
+
prevStillOfflineAfterResumeCount !== undefined &&
|
|
108
|
+
stillOfflineAfterResumeCount > prevStillOfflineAfterResumeCount &&
|
|
109
|
+
!online
|
|
110
|
+
) {
|
|
111
|
+
showOfflineToast();
|
|
112
|
+
}
|
|
113
|
+
}, [
|
|
114
|
+
stillOfflineAfterResumeCount,
|
|
115
|
+
prevStillOfflineAfterResumeCount,
|
|
116
|
+
online,
|
|
117
|
+
showOfflineToast,
|
|
118
|
+
]);
|
|
119
|
+
|
|
82
120
|
return children;
|
|
83
121
|
};
|
|
@@ -190,12 +190,10 @@ const renderApplePlayer = ({
|
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
// Title/Subtitle are not resolved here: `ProgramInfo` reads them from the
|
|
194
|
+
// player manager's content channel via `usePlayerContent`.
|
|
195
195
|
return (
|
|
196
196
|
<ProgramInfo
|
|
197
|
-
title={title}
|
|
198
|
-
subtitle={summary}
|
|
199
197
|
plugin_configuration={pluginConfiguration}
|
|
200
198
|
videoStyle={videoStyle}
|
|
201
199
|
/>
|
|
@@ -406,10 +404,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
406
404
|
const { eventType } = event;
|
|
407
405
|
|
|
408
406
|
if (!isLanguageOverlayVisible && eventType === "menu") {
|
|
407
|
+
// First Back dismisses Play Next, the next one closes the player
|
|
408
|
+
if (playNextOverlayState) {
|
|
409
|
+
playNextOverlayState.handleUserCancelPlayNext();
|
|
410
|
+
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
|
|
409
414
|
close();
|
|
410
415
|
}
|
|
411
416
|
},
|
|
412
|
-
[close]
|
|
417
|
+
[close, playNextOverlayState]
|
|
413
418
|
);
|
|
414
419
|
|
|
415
420
|
// Effects
|
|
@@ -7,12 +7,11 @@ import * as React from "react";
|
|
|
7
7
|
import { Text, TextStyle, View, ViewStyle } from "react-native";
|
|
8
8
|
import { QBImage as Image } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
9
9
|
|
|
10
|
+
import { usePlayerContent } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayerContent";
|
|
10
11
|
import * as programStyles from "./styles";
|
|
11
12
|
|
|
12
13
|
type Props = {
|
|
13
14
|
logo?: string;
|
|
14
|
-
title: string;
|
|
15
|
-
subtitle: string;
|
|
16
15
|
isAudioContent: boolean;
|
|
17
16
|
styles: {};
|
|
18
17
|
plugin_configuration: {
|
|
@@ -28,13 +27,13 @@ const defaultColor = "#EFEFEF";
|
|
|
28
27
|
|
|
29
28
|
function ProgramInfoComponent({
|
|
30
29
|
logo,
|
|
31
|
-
title = "",
|
|
32
|
-
subtitle = "",
|
|
33
30
|
isAudioContent,
|
|
34
31
|
styles,
|
|
35
32
|
plugin_configuration = {},
|
|
36
33
|
videoStyle = {},
|
|
37
34
|
}: Props) {
|
|
35
|
+
const { title = "", summary: subtitle = "" } = usePlayerContent();
|
|
36
|
+
|
|
38
37
|
const platformKey = styleKeys.style_namespace;
|
|
39
38
|
|
|
40
39
|
const colorTitle =
|
|
@@ -17,17 +17,37 @@ jest.mock(
|
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
20
|
+
// Defaults to `false` for the hardware-back-handling tests below, which
|
|
21
|
+
// key off `isTV`. The ProgramInfo/content-context describe block below
|
|
22
|
+
// overrides this per test (`isTV()` is also what PlayerContainer's
|
|
23
|
+
// `playerContentValue` uses to pick TV vs mobile data keys, decoupled
|
|
24
|
+
// from `isTvOSPlatform` below).
|
|
20
25
|
isTV: jest.fn(() => false),
|
|
21
26
|
isAndroidTVPlatform: jest.fn(() => false),
|
|
22
|
-
isTvOSPlatform
|
|
27
|
+
// `isTvOSPlatform` backs a module-level constant in PlayerContainer.tsx that
|
|
28
|
+
// is read once at import time, so it must already be `true` here in order
|
|
29
|
+
// to exercise `renderApplePlayer`'s tvOS-only ProgramInfo branch in this
|
|
30
|
+
// test file. It does not affect the hardware-back-handling tests below,
|
|
31
|
+
// which key off `isTV` instead.
|
|
32
|
+
isTvOSPlatform: jest.fn(() => true),
|
|
23
33
|
isApplePlatform: jest.fn(() => true),
|
|
24
34
|
platformSelect: jest.fn(({ native }) => native),
|
|
25
35
|
}));
|
|
26
36
|
|
|
27
|
-
jest.mock("@applicaster/zapp-react-native-utils/playerUtils", () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
jest.mock("@applicaster/zapp-react-native-utils/playerUtils", () => {
|
|
38
|
+
// Keep the real data-key resolver (createConfigValueGetter,
|
|
39
|
+
// resolvePlayerContentText, VIDEO_PLAYER_CONTENT_DATA_KEYS) so the tvOS
|
|
40
|
+
// ProgramInfo data-key tests exercise actual resolution logic, not a stub.
|
|
41
|
+
const actual = jest.requireActual(
|
|
42
|
+
"@applicaster/zapp-react-native-utils/playerUtils"
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
...actual,
|
|
47
|
+
isAudioItem: jest.fn(() => false),
|
|
48
|
+
isInlineTV: jest.fn(() => false),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
31
51
|
|
|
32
52
|
jest.mock(
|
|
33
53
|
"@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent",
|
|
@@ -76,6 +96,11 @@ jest.mock("@applicaster/zapp-react-native-bridge/QuickBrick", () => ({
|
|
|
76
96
|
sendQuickBrickEvent: jest.fn(),
|
|
77
97
|
}));
|
|
78
98
|
|
|
99
|
+
// Stubbed so PlayerContainer can render without ProgramInfo's own
|
|
100
|
+
// redux/style plumbing. It no longer needs to capture Title/Subtitle: those
|
|
101
|
+
// come from the player manager's content channel, and the key-set selection
|
|
102
|
+
// they depend on is covered directly in
|
|
103
|
+
// `playerManager/__tests__/playerContent.test.ts`.
|
|
79
104
|
jest.mock("../ProgramInfo", () => ({
|
|
80
105
|
ProgramInfo: () => null,
|
|
81
106
|
}));
|
|
@@ -143,14 +168,33 @@ jest.mock(
|
|
|
143
168
|
jest.mock("../PlayerContainerContext", () => {
|
|
144
169
|
const ReactActual = require("react");
|
|
145
170
|
|
|
171
|
+
const PlayerContainerContext = ReactActual.createContext({
|
|
172
|
+
isLanguageOverlayVisible: false,
|
|
173
|
+
bottomFocusableId: "bottom",
|
|
174
|
+
showComponentsContainer: false,
|
|
175
|
+
refs: null,
|
|
176
|
+
});
|
|
177
|
+
|
|
146
178
|
return {
|
|
147
|
-
PlayerContainerContext
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})
|
|
153
|
-
PlayerContainerContextProvider: ({ children }) =>
|
|
179
|
+
PlayerContainerContext,
|
|
180
|
+
// Mirrors just enough of the real provider for these tests: renders an
|
|
181
|
+
// actual `PlayerContainerContext.Provider` so the real
|
|
182
|
+
// `PlayerContainerContext.Consumer` inside PlayerContainer.tsx sees the
|
|
183
|
+
// container fields a real provider would give it, instead of a bare
|
|
184
|
+
// `({ children }) => children` passthrough.
|
|
185
|
+
PlayerContainerContextProvider: ({ children }: any) =>
|
|
186
|
+
ReactActual.createElement(
|
|
187
|
+
PlayerContainerContext.Provider,
|
|
188
|
+
{
|
|
189
|
+
value: {
|
|
190
|
+
isLanguageOverlayVisible: false,
|
|
191
|
+
bottomFocusableId: "bottom",
|
|
192
|
+
showComponentsContainer: false,
|
|
193
|
+
refs: null,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
children
|
|
197
|
+
),
|
|
154
198
|
};
|
|
155
199
|
});
|
|
156
200
|
|
|
@@ -201,7 +245,14 @@ const { __player: mockPlayer } = jest.requireMock(
|
|
|
201
245
|
"@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer"
|
|
202
246
|
);
|
|
203
247
|
|
|
204
|
-
const
|
|
248
|
+
const { isTV: mockIsTV } = jest.requireMock(
|
|
249
|
+
"@applicaster/zapp-react-native-utils/reactUtils"
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
// Renders children so that `renderApplePlayer`'s returned <ProgramInfo>
|
|
253
|
+
// element (passed as this component's `children` prop) actually mounts —
|
|
254
|
+
// otherwise React never invokes the ProgramInfo function component at all.
|
|
255
|
+
const Player = React.forwardRef((props: any, _ref) => props.children ?? null);
|
|
205
256
|
|
|
206
257
|
const item = {
|
|
207
258
|
id: "entry-1",
|
|
@@ -235,6 +286,7 @@ const pressHardwareBack = () => {
|
|
|
235
286
|
describe("PlayerContainer hardware back handling", () => {
|
|
236
287
|
beforeEach(() => {
|
|
237
288
|
jest.clearAllMocks();
|
|
289
|
+
mockIsTV.mockReturnValue(false);
|
|
238
290
|
mockBackHandlerRef.current = null;
|
|
239
291
|
mockPlayer.getPluginConfiguration.mockReturnValue({});
|
|
240
292
|
mockPlayer.isPaused.mockReturnValue(false);
|
|
@@ -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";
|
|
@@ -8,7 +8,6 @@ import { RiverError } from "../RiverError";
|
|
|
8
8
|
import { useScreenConfiguration } from "../useScreenConfiguration";
|
|
9
9
|
import { RefreshControl } from "../RefreshControl";
|
|
10
10
|
import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
11
|
-
import { actionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
|
|
12
11
|
import {
|
|
13
12
|
useMarkPipesDataStale,
|
|
14
13
|
useProfilerLogging,
|
|
@@ -41,6 +40,12 @@ type Props = {
|
|
|
41
40
|
riverId?: string;
|
|
42
41
|
getStaticComponentFeed: any;
|
|
43
42
|
stickyHeaderIndices?: number[];
|
|
43
|
+
safeArea?:
|
|
44
|
+
| {
|
|
45
|
+
edges: Record<Edge, EdgeMode>;
|
|
46
|
+
mode: "padding" | "margin" | undefined;
|
|
47
|
+
}
|
|
48
|
+
| undefined;
|
|
44
49
|
};
|
|
45
50
|
|
|
46
51
|
const styles = StyleSheet.create({
|
|
@@ -53,7 +58,7 @@ const getNearestValue = (value, optionA, optionB) =>
|
|
|
53
58
|
Math.abs(value - optionA) < Math.abs(value - optionB) ? optionA : optionB;
|
|
54
59
|
|
|
55
60
|
const scrollIndicatorInsets = { right: 1 };
|
|
56
|
-
const keyExtractor =
|
|
61
|
+
const keyExtractor = (item) => item.id.toString();
|
|
57
62
|
|
|
58
63
|
function ComponentsMapComponent(props: Props) {
|
|
59
64
|
const {
|
|
@@ -65,6 +70,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
65
70
|
riverId,
|
|
66
71
|
getStaticComponentFeed,
|
|
67
72
|
stickyHeaderIndices,
|
|
73
|
+
safeArea,
|
|
68
74
|
} = props;
|
|
69
75
|
|
|
70
76
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
@@ -78,7 +84,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
78
84
|
|
|
79
85
|
const riverComponents = React.useMemo(() => {
|
|
80
86
|
if (feed?.entry?.length < components.length) {
|
|
81
|
-
return
|
|
87
|
+
return components.slice(0, feed?.entry?.length);
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
return components;
|
|
@@ -93,29 +99,7 @@ function ComponentsMapComponent(props: Props) {
|
|
|
93
99
|
const { loadingState, onLoadFinished, onLoadFailed, shouldShowLoadingError } =
|
|
94
100
|
useLoadingState(riverComponents.length, onLoadDone);
|
|
95
101
|
|
|
96
|
-
const theme = useTheme();
|
|
97
|
-
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
console.log("debug_2", "CM - mount");
|
|
100
|
-
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
console.log("debug_2", "CM - handleAction");
|
|
103
|
-
|
|
104
|
-
actionExecutor.handleAction({
|
|
105
|
-
type: "showToast",
|
|
106
|
-
options: {
|
|
107
|
-
message: "Playlist created 2",
|
|
108
|
-
style: {
|
|
109
|
-
backgroundColor: "red",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}, 2000);
|
|
114
|
-
|
|
115
|
-
return () => {
|
|
116
|
-
console.log("debug_2", "CM - unmount");
|
|
117
|
-
};
|
|
118
|
-
}, []);
|
|
102
|
+
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
119
103
|
|
|
120
104
|
const renderRiverItem = React.useCallback(
|
|
121
105
|
({ item, index }) => {
|
|
@@ -144,21 +128,13 @@ function ComponentsMapComponent(props: Props) {
|
|
|
144
128
|
|
|
145
129
|
const screenStyle = React.useMemo(
|
|
146
130
|
() => ({
|
|
147
|
-
paddingTop: ifEmptyUseFallback(
|
|
148
|
-
screenConfig.paddingTop,
|
|
149
|
-
R.prop("screen_padding_top")(theme)
|
|
150
|
-
),
|
|
151
|
-
paddingBottom: ifEmptyUseFallback(
|
|
152
|
-
screenConfig.paddingBottom,
|
|
153
|
-
R.prop("screen_padding_bottom")(theme)
|
|
154
|
-
),
|
|
155
131
|
paddingLeft: ifEmptyUseFallback(
|
|
156
132
|
screenConfig.paddingLeft,
|
|
157
|
-
|
|
133
|
+
theme.screen_padding_left
|
|
158
134
|
),
|
|
159
135
|
paddingRight: ifEmptyUseFallback(
|
|
160
136
|
screenConfig.paddingRight,
|
|
161
|
-
|
|
137
|
+
theme.screen_padding_right
|
|
162
138
|
),
|
|
163
139
|
}),
|
|
164
140
|
[riverId]
|
|
@@ -289,51 +265,79 @@ function ComponentsMapComponent(props: Props) {
|
|
|
289
265
|
numberOfComponents={riverComponents.length}
|
|
290
266
|
>
|
|
291
267
|
<ViewportTracker>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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),
|
|
327
330
|
this FlatList doesn't scroll so onEndReached can fire repeatedly;
|
|
328
331
|
skip it here and let the parent ScrollView emit scroll-end instead. */
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
332
|
+
isScreenWrappedInContainer
|
|
333
|
+
? undefined
|
|
334
|
+
: () => {
|
|
335
|
+
if (!hasUserScrolledRef.current) return;
|
|
336
|
+
emitScrollEndReached();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/>
|
|
340
|
+
</>
|
|
337
341
|
</ViewportTracker>
|
|
338
342
|
</ScreenLoadingMeasurements>
|
|
339
343
|
</ComponentsMapRefContext.Provider>
|
|
@@ -343,6 +347,5 @@ function ComponentsMapComponent(props: Props) {
|
|
|
343
347
|
}
|
|
344
348
|
|
|
345
349
|
export const ComponentsMap = React.memo(
|
|
346
|
-
withComponentsMapProvider(ComponentsMapComponent)
|
|
347
|
-
R.equals
|
|
350
|
+
withComponentsMapProvider(ComponentsMapComponent)
|
|
348
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
|
}
|