@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1724095599 → 13.0.0-alpha.1731130113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/AudioPlayer/AudioPlayer.tsx +5 -9
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +8 -9
- package/Components/AudioPlayer/helpers.tsx +1 -2
- package/Components/Cell/Cell.tsx +3 -13
- package/Components/Cell/CellWithFocusable.tsx +21 -15
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/index.ts +2 -1
- package/Components/ErrorScreen/index.tsx +8 -0
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
- package/Components/Layout/TV/LayoutBackground.tsx +28 -0
- package/Components/Layout/TV/NavBarContainer.tsx +2 -1
- package/Components/Layout/TV/ScreenContainer.tsx +8 -2
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +1 -0
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +1 -0
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
- package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
- package/Components/Layout/TV/index.tsx +6 -20
- package/Components/Layout/TV/index.web.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +8 -134
- package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
- package/Components/ModalComponent/Button/Item.tsx +6 -5
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +45 -62
- package/Components/ModalComponent/Header/index.tsx +9 -8
- package/Components/ModalComponent/utils.ts +55 -7
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +55 -46
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +14 -3
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
- package/Components/River/RiverItem.tsx +8 -3
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +7 -1
- package/Components/RouteManager/TestId.tsx +1 -5
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +0 -1
- package/Components/RouteManager/__tests__/testId.test.js +0 -4
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/__tests__/Screen.test.tsx +22 -14
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/Screen/hooks.ts +3 -6
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +4 -0
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +35 -19
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +38 -14
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +11 -3
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
- package/Components/VideoModal/ModalAnimation/const.ts +5 -0
- package/Components/VideoModal/ModalAnimation/index.ts +2 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +30 -0
- package/Components/VideoModal/PlayerDetails.tsx +13 -5
- package/Components/VideoModal/PlayerWrapper.tsx +35 -22
- package/Components/VideoModal/VideoModal.tsx +19 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/utils.ts +3 -4
- package/Components/ZappUIComponent/index.tsx +4 -4
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +3 -10
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/RiverResolver/index.tsx +5 -7
- package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
- package/package.json +5 -9
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
|
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
|
|
|
74
74
|
return longEdge / shortEdge;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const safeAreaStyles = (
|
|
78
|
-
configuration: Configuration,
|
|
79
|
-
isTablet: boolean
|
|
80
|
-
): ViewStyle => {
|
|
81
|
-
const tablet_landscape_player_container_background_color =
|
|
82
|
-
configuration?.tablet_landscape_player_container_background_color;
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
backgroundColor: isTablet
|
|
86
|
-
? tablet_landscape_player_container_background_color
|
|
87
|
-
: "transparent",
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
77
|
const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
92
78
|
if (isTablet) {
|
|
93
79
|
return ["top"];
|
|
@@ -100,6 +86,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
|
100
86
|
return ["top"];
|
|
101
87
|
};
|
|
102
88
|
|
|
89
|
+
const isPercentage = (value: string | number): boolean => {
|
|
90
|
+
if (typeof value === "string") {
|
|
91
|
+
return value.includes("%");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const getPercentageOf = (percent: string, value: number) => {
|
|
98
|
+
const percentageValue = parseFloat(percent.replace("%", ""));
|
|
99
|
+
|
|
100
|
+
if (isNaN(percentageValue)) {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (value * percentageValue) / 100;
|
|
105
|
+
};
|
|
106
|
+
|
|
103
107
|
const getTabletWidth = (
|
|
104
108
|
configuration: Configuration,
|
|
105
109
|
dimensions: DimensionsT
|
|
@@ -108,18 +112,23 @@ const getTabletWidth = (
|
|
|
108
112
|
configuration?.tablet_landscape_sidebar_width;
|
|
109
113
|
|
|
110
114
|
const { width } = dimensions;
|
|
115
|
+
let widthValue = Number(width);
|
|
116
|
+
|
|
117
|
+
if (isPercentage(width)) {
|
|
118
|
+
widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
|
|
119
|
+
}
|
|
111
120
|
|
|
112
121
|
const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
|
|
113
122
|
|
|
114
123
|
if (tablet_landscape_sidebar_width?.includes("%")) {
|
|
115
|
-
return
|
|
124
|
+
return widthValue * (1 - sidebarWidth / 100);
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
if (Number.isNaN(sidebarWidth)) {
|
|
119
|
-
return
|
|
128
|
+
return widthValue * 0.65;
|
|
120
129
|
}
|
|
121
130
|
|
|
122
|
-
return
|
|
131
|
+
return widthValue - sidebarWidth;
|
|
123
132
|
};
|
|
124
133
|
|
|
125
134
|
const PlayerWrapperComponent = (props: Props) => {
|
|
@@ -133,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
133
142
|
children,
|
|
134
143
|
isTabletPortrait,
|
|
135
144
|
configuration,
|
|
145
|
+
fullscreen,
|
|
136
146
|
pip,
|
|
137
147
|
} = props;
|
|
138
148
|
|
|
@@ -188,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
188
198
|
[containerDimensions, playerDimensionsHack]
|
|
189
199
|
);
|
|
190
200
|
|
|
201
|
+
const wrapperViewStyle: ViewStyle = {
|
|
202
|
+
backgroundColor:
|
|
203
|
+
isTablet && !fullscreen
|
|
204
|
+
? configuration?.tablet_landscape_player_container_background_color
|
|
205
|
+
: "transparent",
|
|
206
|
+
};
|
|
207
|
+
|
|
191
208
|
return (
|
|
192
209
|
<WrapperView
|
|
193
210
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
194
|
-
style={[
|
|
195
|
-
safeAreaStyles(configuration, isTablet),
|
|
196
|
-
style,
|
|
197
|
-
playerDimensionsHack,
|
|
198
|
-
]}
|
|
211
|
+
style={[wrapperViewStyle, style, playerDimensionsHack]}
|
|
199
212
|
>
|
|
200
213
|
<AnimationComponent
|
|
201
214
|
animationType={ComponentAnimationType.moveUpComponent}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { equals } from "ramda";
|
|
3
|
-
import { StyleSheet, StatusBar } from "react-native";
|
|
3
|
+
import { StyleSheet, StatusBar, View } from "react-native";
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
|
|
|
30
30
|
import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
31
31
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
32
32
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
33
|
+
import { Spinner } from "../Spinner";
|
|
33
34
|
import { OpaqueLayer } from "./OpaqueLayer";
|
|
34
35
|
|
|
35
36
|
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
36
37
|
|
|
38
|
+
const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
|
|
39
|
+
|
|
37
40
|
const styles = StyleSheet.create({
|
|
38
41
|
container: {
|
|
39
42
|
top: 0,
|
|
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
|
|
|
42
45
|
bottom: 0,
|
|
43
46
|
position: "absolute",
|
|
44
47
|
},
|
|
48
|
+
loaderContainer: {
|
|
49
|
+
top: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: 0,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
backgroundColor: LOADER_BACKGROUND_COLOR,
|
|
57
|
+
},
|
|
45
58
|
});
|
|
46
59
|
|
|
47
60
|
const VideoModalComponent = () => {
|
|
@@ -131,7 +144,7 @@ const VideoModalComponent = () => {
|
|
|
131
144
|
{/* Hide content underneath when we switch to next video in fullscreen mode */}
|
|
132
145
|
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
133
146
|
|
|
134
|
-
{itemIdHooksFinished === item?.id
|
|
147
|
+
{itemIdHooksFinished === item?.id ? (
|
|
135
148
|
<AnimatedPlayerModalWrapper
|
|
136
149
|
style={[
|
|
137
150
|
styles.container,
|
|
@@ -143,11 +156,13 @@ const VideoModalComponent = () => {
|
|
|
143
156
|
<HandlePlayable
|
|
144
157
|
item={item}
|
|
145
158
|
isModal={mode !== "PIP"}
|
|
146
|
-
modalHeight={modalSize.height}
|
|
147
|
-
modalWidth={modalSize.width}
|
|
148
159
|
mode={mode}
|
|
149
160
|
/>
|
|
150
161
|
</AnimatedPlayerModalWrapper>
|
|
162
|
+
) : (
|
|
163
|
+
<View style={styles.loaderContainer}>
|
|
164
|
+
<Spinner />
|
|
165
|
+
</View>
|
|
151
166
|
)}
|
|
152
167
|
</ScreenContextProvider>
|
|
153
168
|
</PathnameContext.Provider>
|
|
@@ -1,43 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`PlayerDetails renders properly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
collapsable={false}
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"backgroundColor": "transparent",
|
|
9
|
-
"flex": 1,
|
|
10
|
-
"marginTop": -8,
|
|
11
|
-
"paddingTop": -8,
|
|
12
|
-
"width": 750,
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
>
|
|
16
|
-
<View
|
|
17
|
-
feed="test-source"
|
|
18
|
-
riverComponents={[]}
|
|
19
|
-
riverId="test-id"
|
|
20
|
-
/>
|
|
21
|
-
</View>
|
|
22
|
-
`;
|
|
3
|
+
exports[`PlayerDetails renders properly 1`] = `null`;
|
|
23
4
|
|
|
24
|
-
exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
|
|
25
|
-
<View
|
|
26
|
-
collapsable={false}
|
|
27
|
-
style={
|
|
28
|
-
{
|
|
29
|
-
"backgroundColor": "transparent",
|
|
30
|
-
"flex": 1,
|
|
31
|
-
"marginTop": -20,
|
|
32
|
-
"paddingTop": 40,
|
|
33
|
-
"width": 750,
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<View
|
|
38
|
-
feed="test-source"
|
|
39
|
-
riverComponents={[]}
|
|
40
|
-
riverId="test-id"
|
|
41
|
-
/>
|
|
42
|
-
</View>
|
|
43
|
-
`;
|
|
5
|
+
exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { mergeRight } from "ramda";
|
|
3
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
@@ -25,10 +24,10 @@ export const useConfiguration = () => {
|
|
|
25
24
|
|
|
26
25
|
const playerPluginConfig = playerManager.getPluginConfiguration();
|
|
27
26
|
|
|
28
|
-
const config =
|
|
27
|
+
const config = mergeRight(playerPluginConfig, {
|
|
28
|
+
...pluginConfiguration,
|
|
29
29
|
...targetScreenConfiguration?.general,
|
|
30
30
|
...targetScreenConfiguration?.styles,
|
|
31
|
-
...pluginConfiguration,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
const {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { Placeholder } from "./Placeholder";
|
|
10
10
|
import { useInitialLoading } from "./hooks";
|
|
11
|
-
import { useIsFocusable } from "@applicaster/zapp-react-native-utils/focusManager";
|
|
12
11
|
|
|
13
12
|
type ReactComponent = React.ComponentType<any>;
|
|
14
13
|
|
|
@@ -138,12 +137,13 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
|
|
|
138
137
|
);
|
|
139
138
|
|
|
140
139
|
const componentProps = React.useMemo(
|
|
141
|
-
() => ({
|
|
140
|
+
() => ({
|
|
141
|
+
...props,
|
|
142
|
+
parent,
|
|
143
|
+
}),
|
|
142
144
|
[props, parent]
|
|
143
145
|
);
|
|
144
146
|
|
|
145
|
-
useIsFocusable(componentProps);
|
|
146
|
-
|
|
147
147
|
React.useEffect(() => {
|
|
148
148
|
if (!skipOnLoadFinished && !isLoading) {
|
|
149
149
|
onLoadFinished();
|
|
@@ -7,17 +7,11 @@ export const withFocusableContext = (Component) => {
|
|
|
7
7
|
{ groupId, ...props }: Record<string, any>,
|
|
8
8
|
ref
|
|
9
9
|
) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line react/display-name
|
|
14
|
-
const propsGroupId = groupId || null;
|
|
15
|
-
const providedGroupId = propsGroupId || groupIdContext;
|
|
10
|
+
const groupIdContext = React.useContext(FocusableGroupContext);
|
|
11
|
+
const propsGroupId = groupId || null;
|
|
12
|
+
const providedGroupId = propsGroupId || groupIdContext;
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
}}
|
|
19
|
-
</FocusableGroupContext.Consumer>
|
|
20
|
-
);
|
|
14
|
+
return <Component {...props} groupId={providedGroupId} ref={ref} />;
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
return React.forwardRef(WithFocusableContext);
|
|
@@ -13,7 +13,7 @@ type ProviderProps = {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const initialHeaderOffsetContext = () => ({
|
|
16
|
+
const initialHeaderOffsetContext: HeaderOffsetContextType = () => ({
|
|
17
17
|
headerOffset: 0,
|
|
18
18
|
headersAbove: null,
|
|
19
19
|
});
|
|
@@ -24,11 +24,9 @@ export const HeaderOffsetContext = React.createContext<HeaderOffsetContextType>(
|
|
|
24
24
|
|
|
25
25
|
export function withConsumer(Component) {
|
|
26
26
|
return function WithConsumer(props) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</HeaderOffsetContext.Consumer>
|
|
31
|
-
);
|
|
27
|
+
const getHeaderOffset = React.useContext(HeaderOffsetContext);
|
|
28
|
+
|
|
29
|
+
return <Component getHeaderOffset={getHeaderOffset} {...props} />;
|
|
32
30
|
};
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -176,15 +176,8 @@ export function ScreenContextProvider({
|
|
|
176
176
|
|
|
177
177
|
export function withScreenContext(Component: React.ComponentType<any>) {
|
|
178
178
|
return function WithScreenContextWrapper(props) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
(value) => (
|
|
183
|
-
<Component {...props} screenContext={value} />
|
|
184
|
-
),
|
|
185
|
-
[Component, props]
|
|
186
|
-
)}
|
|
187
|
-
</ScreenContext.Consumer>
|
|
188
|
-
);
|
|
179
|
+
const screenContext = React.useContext(ScreenContext);
|
|
180
|
+
|
|
181
|
+
return <Component {...props} screenContext={screenContext} />;
|
|
189
182
|
};
|
|
190
183
|
}
|
|
@@ -8,10 +8,11 @@ type LayoutContext = {
|
|
|
8
8
|
componentAnchorPointY: number | null;
|
|
9
9
|
componentAvailableWidth: number | null;
|
|
10
10
|
setScreenLayout?: (properties: {}) => void;
|
|
11
|
+
resetScreenLayout?: () => void;
|
|
11
12
|
extraAnchorPointYOffset: number;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const initialScreenLayoutContext: LayoutContext = {
|
|
15
16
|
screenMarginTop: null,
|
|
16
17
|
screenMarginBottom: null,
|
|
17
18
|
screenHeight: null,
|
|
@@ -21,8 +22,9 @@ const screenLayoutContext: LayoutContext = {
|
|
|
21
22
|
extraAnchorPointYOffset: 0,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
export const ScreenLayoutContext =
|
|
25
|
-
|
|
25
|
+
export const ScreenLayoutContext = React.createContext<LayoutContext>(
|
|
26
|
+
initialScreenLayoutContext
|
|
27
|
+
);
|
|
26
28
|
|
|
27
29
|
export function ScreenLayoutContextConsumer(Component) {
|
|
28
30
|
return function WithConsumer(props) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
4
3
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
4
|
import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
|
|
5
|
+
import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
6
|
|
|
7
7
|
type Props = ZappUIComponentProps & {
|
|
8
8
|
rivers: ZappRivers;
|
|
@@ -12,27 +12,25 @@ type Props = ZappUIComponentProps & {
|
|
|
12
12
|
|
|
13
13
|
export function withRiver(Component: ZappComponent): ZappComponent {
|
|
14
14
|
const RiverWithData = ({ screenId, ...otherProps }: Props) => {
|
|
15
|
-
const
|
|
15
|
+
const river = useRivers()?.[screenId];
|
|
16
16
|
const pathname = usePathname();
|
|
17
|
-
const river = rivers[screenId];
|
|
18
17
|
|
|
19
18
|
if (!river) {
|
|
20
19
|
return null;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
if (!otherProps.screenData) {
|
|
24
|
-
otherProps.screenData = river;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
return (
|
|
28
23
|
<Component
|
|
29
24
|
screenId={screenId}
|
|
30
25
|
river={river}
|
|
31
26
|
key={isTV() ? pathname : undefined}
|
|
32
27
|
{...otherProps}
|
|
28
|
+
screenData={otherProps.screenData || river}
|
|
33
29
|
/>
|
|
34
30
|
);
|
|
35
31
|
};
|
|
36
32
|
|
|
33
|
+
RiverWithData.displayName = `RiverWithData(${Component.displayName || Component.name})`;
|
|
34
|
+
|
|
37
35
|
return RiverWithData;
|
|
38
36
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
/// <reference types="@applicaster/zapp-react-native-ui-components" />
|
|
3
3
|
import React, { useEffect, useMemo } from "react";
|
|
4
|
-
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
5
4
|
|
|
6
5
|
import * as R from "ramda";
|
|
7
6
|
import { Platform } from "react-native";
|
|
8
7
|
import Url from "url";
|
|
9
|
-
import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
|
|
10
8
|
import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
|
|
11
9
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
12
10
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
@@ -21,12 +19,7 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
|
|
|
21
19
|
import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
22
20
|
|
|
23
21
|
import { isVerticalListOrGrid } from "./utils";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
findEndpointForURL,
|
|
27
|
-
HTTP_METHODS,
|
|
28
|
-
} from "@applicaster/zapp-pipes-v2-client";
|
|
29
|
-
import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
|
|
22
|
+
import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
|
|
30
23
|
|
|
31
24
|
type Props = {
|
|
32
25
|
component: ZappUIComponent;
|
|
@@ -237,7 +230,8 @@ export function zappPipesDataConnector(
|
|
|
237
230
|
const entryContext =
|
|
238
231
|
(shouldUseNestedContext && screenContextData?.nested?.entry
|
|
239
232
|
? screenContextData?.nested?.entry
|
|
240
|
-
: screenContextData?.entry) ||
|
|
233
|
+
: (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
|
|
234
|
+
{};
|
|
241
235
|
|
|
242
236
|
const screenContext =
|
|
243
237
|
(shouldUseNestedContext && screenContextData?.nested?.screen
|
|
@@ -300,27 +294,7 @@ export function zappPipesDataConnector(
|
|
|
300
294
|
return addListener(reloadData);
|
|
301
295
|
}
|
|
302
296
|
} else {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const endpointURL = findEndpointForURL(
|
|
306
|
-
dataSourceUrl,
|
|
307
|
-
pipesEndpoints,
|
|
308
|
-
HTTP_METHODS.GET
|
|
309
|
-
);
|
|
310
|
-
|
|
311
|
-
const endpoint = pipesEndpoints?.[endpointURL];
|
|
312
|
-
|
|
313
|
-
if (endpoint?.tags?.includes(ENDPOINT_TAGS.observe_storage)) {
|
|
314
|
-
const subscriptions: (() => void)[] = endpoint.context_obj.map(
|
|
315
|
-
(data: Record<string, any>) => {
|
|
316
|
-
const { namespace, key } = getNamespaceAndKey(data.key);
|
|
317
|
-
|
|
318
|
-
return localStorage.addListener({ key, namespace }, reloadData);
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
return () => subscriptions.forEach((listener) => listener());
|
|
323
|
-
}
|
|
297
|
+
return subscribeForUrlContextKeyChanges(dataSourceUrl, {}, reloadData);
|
|
324
298
|
}
|
|
325
299
|
}, [dataSourceUrl, reloadData]);
|
|
326
300
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.1731130113",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "jest -w=2",
|
|
9
8
|
"build": "echo skipping hybrid typescript build for now"
|
|
10
9
|
},
|
|
11
10
|
"publishConfig": {
|
|
@@ -29,15 +28,13 @@
|
|
|
29
28
|
},
|
|
30
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@types/react": "17.0.2",
|
|
33
|
-
"@types/react-native": "0.69.6",
|
|
34
31
|
"redux-mock-store": "^1.5.3"
|
|
35
32
|
},
|
|
36
33
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.1731130113",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1731130113",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.1731130113",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.1731130113",
|
|
41
38
|
"promise": "^8.3.0",
|
|
42
39
|
"react-router-native": "^5.1.2",
|
|
43
40
|
"url": "^0.11.0",
|
|
@@ -46,7 +43,6 @@
|
|
|
46
43
|
"peerDependencies": {
|
|
47
44
|
"@applicaster/zapp-pipes-v2-client": "*",
|
|
48
45
|
"@react-native-community/netinfo": "*",
|
|
49
|
-
"@types/node": "*",
|
|
50
46
|
"immer": "*",
|
|
51
47
|
"react": "*",
|
|
52
48
|
"react-native": "*",
|
package/tsconfig.json
CHANGED
package/.babelrc
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getColor,
|
|
3
|
-
ACTIVE_COLOR,
|
|
4
|
-
BACKGROUND_COLOR,
|
|
5
|
-
MAIN_TEXT_COLOR,
|
|
6
|
-
FOCUSED_TEXT_COLOR,
|
|
7
|
-
} from "../colors";
|
|
8
|
-
|
|
9
|
-
const Image = "Image";
|
|
10
|
-
const View = "View";
|
|
11
|
-
const Text = "Text";
|
|
12
|
-
|
|
13
|
-
const containerStyles = (styles) => ({
|
|
14
|
-
flex: 1,
|
|
15
|
-
flexDirection: "column",
|
|
16
|
-
width: 384,
|
|
17
|
-
height: 436,
|
|
18
|
-
borderRadius: 4,
|
|
19
|
-
backgroundColor: getColor(BACKGROUND_COLOR, styles),
|
|
20
|
-
marginRight: 48,
|
|
21
|
-
marginBottom: 48,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const focusedContainerStyles = (styles) => ({
|
|
25
|
-
...containerStyles(styles),
|
|
26
|
-
backgroundColor: getColor(ACTIVE_COLOR, styles),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const imageStyle = {
|
|
30
|
-
width: 384,
|
|
31
|
-
height: 216,
|
|
32
|
-
borderTopRightRadius: 4,
|
|
33
|
-
borderTopLeftRadius: 4,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const titleContainerStyles = {
|
|
37
|
-
width: 336,
|
|
38
|
-
height: 60,
|
|
39
|
-
marginHorizontal: 24,
|
|
40
|
-
marginTop: 24,
|
|
41
|
-
overflow: "hidden",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const titleStyles = (styles) => ({
|
|
45
|
-
fontSize: 26,
|
|
46
|
-
color: getColor(MAIN_TEXT_COLOR, styles),
|
|
47
|
-
fontWeight: "bold",
|
|
48
|
-
fontStyle: "normal",
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const focusedTitleStyles = (styles) => ({
|
|
52
|
-
...titleStyles(styles),
|
|
53
|
-
color: getColor(FOCUSED_TEXT_COLOR, styles),
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const subtitleContainerStyles = {
|
|
57
|
-
width: 336,
|
|
58
|
-
height: 88,
|
|
59
|
-
marginHorizontal: 24,
|
|
60
|
-
marginTop: 24,
|
|
61
|
-
overflow: "hidden",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const subtitleStyles = (styles) => ({
|
|
65
|
-
fontSize: 24,
|
|
66
|
-
fontWeight: "normal",
|
|
67
|
-
opacity: 0.8,
|
|
68
|
-
color: getColor(MAIN_TEXT_COLOR, styles),
|
|
69
|
-
fontStyle: "normal",
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const focusedSubtitleStyles = (styles) => ({
|
|
73
|
-
...subtitleStyles(styles),
|
|
74
|
-
color: getColor(FOCUSED_TEXT_COLOR, styles),
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const viewTree = (state, styles) => [
|
|
78
|
-
{
|
|
79
|
-
type: View,
|
|
80
|
-
style:
|
|
81
|
-
state === "focused"
|
|
82
|
-
? focusedContainerStyles(styles)
|
|
83
|
-
: containerStyles(styles),
|
|
84
|
-
elements: [
|
|
85
|
-
{
|
|
86
|
-
type: Image,
|
|
87
|
-
style: imageStyle,
|
|
88
|
-
data: [
|
|
89
|
-
{
|
|
90
|
-
func: "image_src_from_media_item",
|
|
91
|
-
args: ["thumbnail-small"],
|
|
92
|
-
propName: "uri",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: View,
|
|
98
|
-
style: titleContainerStyles,
|
|
99
|
-
elements: [
|
|
100
|
-
{
|
|
101
|
-
type: Text,
|
|
102
|
-
style:
|
|
103
|
-
state === "focused"
|
|
104
|
-
? focusedTitleStyles(styles)
|
|
105
|
-
: titleStyles(styles),
|
|
106
|
-
data: [
|
|
107
|
-
{
|
|
108
|
-
func: "path",
|
|
109
|
-
args: ["title"],
|
|
110
|
-
propName: "label",
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
additionalProps: {
|
|
114
|
-
numberOfLines: 2,
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
type: View,
|
|
121
|
-
style: subtitleContainerStyles,
|
|
122
|
-
elements: [
|
|
123
|
-
{
|
|
124
|
-
type: Text,
|
|
125
|
-
style:
|
|
126
|
-
state === "focused"
|
|
127
|
-
? focusedSubtitleStyles(styles)
|
|
128
|
-
: subtitleStyles(styles),
|
|
129
|
-
data: [
|
|
130
|
-
{
|
|
131
|
-
func: "path",
|
|
132
|
-
args: ["summary"],
|
|
133
|
-
propName: "label",
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
additionalProps: {
|
|
137
|
-
numberOfLines: 3,
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
];
|
|
145
|
-
|
|
146
|
-
export const fallbackCellStyle = (styles) => ({
|
|
147
|
-
content_types: {
|
|
148
|
-
default: {
|
|
149
|
-
states: {
|
|
150
|
-
default: viewTree("default", styles),
|
|
151
|
-
focused: viewTree("focused", styles),
|
|
152
|
-
selected: viewTree("selected", styles),
|
|
153
|
-
focused_selected: viewTree("focused_selected", styles),
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
});
|