@applicaster/zapp-react-native-ui-components 13.0.0-alpha.8865907528 → 13.0.0-alpha.9053464934
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/AnimatedInOut/index.tsx +3 -5
- package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/Cell/Cell.tsx +3 -13
- package/Components/Cell/CellWithFocusable.tsx +18 -14
- package/Components/Cell/CellWrapper.ts +5 -0
- package/Components/Cell/styles.ts +17 -0
- package/Components/ErrorScreen/index.tsx +8 -0
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
- package/Components/FocusableGroup/index.tsx +0 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/elementMapper.tsx +2 -1
- package/Components/MasterCell/utils/behaviorProvider.ts +4 -1
- package/Components/MasterCell/utils/index.ts +6 -6
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +9 -5
- package/Components/PlayerImageBackground/index.tsx +4 -24
- package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/hooks.ts +3 -6
- package/Components/VideoLive/animationUtils.ts +3 -3
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +33 -19
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +17 -4
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
- package/Components/VideoModal/VideoModal.tsx +2 -2
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/Decorators/RiverResolver/index.tsx +5 -7
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -1
- package/package.json +5 -6
- 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
|
@@ -28,10 +28,10 @@ type Return = {
|
|
|
28
28
|
// TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
|
|
29
29
|
const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
|
|
30
30
|
|
|
31
|
-
const createLoadingStateObservable = () =>
|
|
31
|
+
const createLoadingStateObservable = (count: number) =>
|
|
32
32
|
new BehaviorSubject<LoadingState>({
|
|
33
33
|
index: -1,
|
|
34
|
-
done:
|
|
34
|
+
done: count === 0,
|
|
35
35
|
waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
|
|
36
36
|
});
|
|
37
37
|
|
|
@@ -43,7 +43,7 @@ export const useLoadingState = (
|
|
|
43
43
|
const [loadingError, setLoadingError] = React.useState(null);
|
|
44
44
|
|
|
45
45
|
const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
|
|
46
|
-
createLoadingStateObservable
|
|
46
|
+
() => createLoadingStateObservable(count)
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const arePreviousComponentsLoaded = React.useCallback((index) => {
|
|
@@ -92,6 +92,10 @@ const getNavigations = ({
|
|
|
92
92
|
return fallbackNavigations;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
const onRelease = () => {
|
|
96
|
+
focusManager.setInitialFocus();
|
|
97
|
+
};
|
|
98
|
+
|
|
95
99
|
export const Screen = ({ route, Components }: Props) => {
|
|
96
100
|
if (isNilOrEmpty(route)) {
|
|
97
101
|
throw Error("Required props: route is missing");
|
|
@@ -152,12 +156,7 @@ export const Screen = ({ route, Components }: Props) => {
|
|
|
152
156
|
const isScreenActive = useIsScreenActive();
|
|
153
157
|
|
|
154
158
|
return (
|
|
155
|
-
<FreezeWithCallback
|
|
156
|
-
freeze={!isScreenActive}
|
|
157
|
-
onRelease={() => {
|
|
158
|
-
focusManager.setInitialFocus();
|
|
159
|
-
}}
|
|
160
|
-
>
|
|
159
|
+
<FreezeWithCallback freeze={!isScreenActive} onRelease={onRelease}>
|
|
161
160
|
<View style={[styles.container, { backgroundColor }]}>
|
|
162
161
|
<NavBarContainer isVisible={isNavBarVisible} onReady={noop}>
|
|
163
162
|
<NavBar
|
|
@@ -7,15 +7,12 @@ import {
|
|
|
7
7
|
useCurrentScreenData,
|
|
8
8
|
useDimensions,
|
|
9
9
|
useRoute,
|
|
10
|
+
useIsTablet,
|
|
10
11
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
11
12
|
import { useMemo, useEffect, useState } from "react";
|
|
12
13
|
|
|
13
14
|
export const useWaitForValidOrientation = () => {
|
|
14
|
-
const {
|
|
15
|
-
width: screenWidth,
|
|
16
|
-
height,
|
|
17
|
-
deviceInfo,
|
|
18
|
-
} = useDimensions("screen", {
|
|
15
|
+
const { width: screenWidth, height } = useDimensions("screen", {
|
|
19
16
|
fullDimensions: true,
|
|
20
17
|
updateForInactiveScreens: false,
|
|
21
18
|
});
|
|
@@ -26,7 +23,7 @@ export const useWaitForValidOrientation = () => {
|
|
|
26
23
|
|
|
27
24
|
const [readyState, setReadyState] = useState(false);
|
|
28
25
|
|
|
29
|
-
const isTablet =
|
|
26
|
+
const isTablet = useIsTablet();
|
|
30
27
|
|
|
31
28
|
const { appData } = usePickFromState(["appData"]);
|
|
32
29
|
const isTabletPortrait = appData?.isTabletPortrait;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Animated, Easing, EasingFunction, StyleProp } from "react-native";
|
|
2
2
|
|
|
3
3
|
type AnimatedInterpolatedStyle =
|
|
4
|
-
| Animated.AnimatedInterpolation
|
|
5
|
-
| [{ [Key: string]: Animated.AnimatedInterpolation
|
|
4
|
+
| Animated.AnimatedInterpolation
|
|
5
|
+
| [{ [Key: string]: Animated.AnimatedInterpolation }];
|
|
6
6
|
|
|
7
7
|
type AnimationConfig = {
|
|
8
8
|
duration: number;
|
|
@@ -31,7 +31,7 @@ const interpolate = (
|
|
|
31
31
|
animatedValue: Animated.Value,
|
|
32
32
|
from: number = 0,
|
|
33
33
|
to: number = 1
|
|
34
|
-
): Animated.AnimatedInterpolation
|
|
34
|
+
): Animated.AnimatedInterpolation =>
|
|
35
35
|
animatedValue.interpolate({
|
|
36
36
|
inputRange: [0, 1],
|
|
37
37
|
outputRange: [from, to],
|
|
@@ -46,7 +46,7 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
|
|
|
46
46
|
|
|
47
47
|
React.useEffect(() => {
|
|
48
48
|
(playerAnimationState === PlayerAnimationStateEnum.minimize ||
|
|
49
|
-
playerAnimationState === PlayerAnimationStateEnum.
|
|
49
|
+
playerAnimationState === PlayerAnimationStateEnum.maximize) &&
|
|
50
50
|
setStartComponentsAnimation(true);
|
|
51
51
|
}, [playerAnimationState]);
|
|
52
52
|
|
|
@@ -70,14 +70,19 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
70
70
|
const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
|
|
71
71
|
useNavigation();
|
|
72
72
|
|
|
73
|
-
const {
|
|
73
|
+
const {
|
|
74
|
+
mode: videoModalMode,
|
|
75
|
+
previousMode: previousVideoModalMode,
|
|
76
|
+
item: videoModalItem,
|
|
77
|
+
} = videoModalState;
|
|
78
|
+
|
|
74
79
|
const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
|
|
75
80
|
const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
|
|
76
81
|
const previousItemId = usePrevious(videoModalItem?.id);
|
|
77
82
|
|
|
78
83
|
const isNotMinimizeMaximazeAnimation =
|
|
79
84
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
80
|
-
playerAnimationState !== PlayerAnimationStateEnum.
|
|
85
|
+
playerAnimationState !== PlayerAnimationStateEnum.maximize;
|
|
81
86
|
|
|
82
87
|
const isEnablePanGesture =
|
|
83
88
|
enableGesture &&
|
|
@@ -121,7 +126,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
121
126
|
const preparedTranslationY =
|
|
122
127
|
Math.abs(translationY) - lastScrollYValue.current;
|
|
123
128
|
|
|
124
|
-
if (
|
|
129
|
+
if (isMaximizedModal) {
|
|
125
130
|
const endOffsetY =
|
|
126
131
|
lastSnap + preparedTranslationY + dragToss * velocityY + 150;
|
|
127
132
|
|
|
@@ -137,14 +142,14 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
137
142
|
|
|
138
143
|
setLastSnap(destSnapPoint);
|
|
139
144
|
|
|
140
|
-
if (destSnapPoint === modalSnapPoints[0]) {
|
|
145
|
+
if (destSnapPoint === modalSnapPoints[0] && isMinimizedModal) {
|
|
141
146
|
translateYOffset.extractOffset();
|
|
142
147
|
translateYOffset.setValue(preparedTranslationY);
|
|
143
148
|
translateYOffset.flattenOffset();
|
|
144
149
|
dragScrollY.setValue(0);
|
|
145
150
|
|
|
146
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
147
|
-
} else {
|
|
151
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
152
|
+
} else if (destSnapPoint !== modalSnapPoints[0] && isMaximizedModal) {
|
|
148
153
|
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
149
154
|
}
|
|
150
155
|
} else {
|
|
@@ -158,7 +163,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
158
163
|
|
|
159
164
|
dragScrollY.setValue(0);
|
|
160
165
|
|
|
161
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
166
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
162
167
|
} else {
|
|
163
168
|
resetPlayerAnimationState();
|
|
164
169
|
}
|
|
@@ -168,7 +173,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
168
173
|
resetPlayerAnimationState();
|
|
169
174
|
}
|
|
170
175
|
},
|
|
171
|
-
[
|
|
176
|
+
[
|
|
177
|
+
lastSnap,
|
|
178
|
+
modalSnapPoints,
|
|
179
|
+
playerAnimationState,
|
|
180
|
+
isMinimizedModal,
|
|
181
|
+
isMaximizedModal,
|
|
182
|
+
]
|
|
172
183
|
);
|
|
173
184
|
|
|
174
185
|
const onScroll = React.useCallback(({ nativeEvent }) => {
|
|
@@ -219,17 +230,18 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
219
230
|
}, []);
|
|
220
231
|
|
|
221
232
|
React.useEffect(() => {
|
|
222
|
-
const { mode, previousMode, item } = videoModalState;
|
|
223
|
-
|
|
224
233
|
if (
|
|
225
|
-
|
|
234
|
+
videoModalMode === "MAXIMIZED" &&
|
|
226
235
|
!enableGesture &&
|
|
227
236
|
scrollPosition.current === 0
|
|
228
237
|
) {
|
|
229
238
|
setIEnableGesture(true);
|
|
230
239
|
}
|
|
231
240
|
|
|
232
|
-
if (
|
|
241
|
+
if (
|
|
242
|
+
videoModalMode === "MINIMIZED" &&
|
|
243
|
+
previousVideoModalMode === "MAXIMIZED"
|
|
244
|
+
) {
|
|
233
245
|
// set animation to the minimize values if moving from the player to another screen
|
|
234
246
|
if (playerAnimationState === null) {
|
|
235
247
|
setScrollModalAnimatedValue(
|
|
@@ -247,14 +259,16 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
247
259
|
}
|
|
248
260
|
} else if (
|
|
249
261
|
playerAnimationState === null &&
|
|
250
|
-
((previousItemId ===
|
|
251
|
-
|
|
252
|
-
(
|
|
253
|
-
|
|
262
|
+
((previousItemId === videoModalItem?.id &&
|
|
263
|
+
videoModalMode === "MAXIMIZED" &&
|
|
264
|
+
(previousVideoModalMode === "MINIMIZED" ||
|
|
265
|
+
previousVideoModalMode === "MAXIMIZED")) ||
|
|
266
|
+
(previousItemId !== videoModalItem?.id &&
|
|
267
|
+
videoModalMode !== "FULLSCREEN"))
|
|
254
268
|
) {
|
|
255
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
269
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
256
270
|
}
|
|
257
|
-
}, [
|
|
271
|
+
}, [videoModalMode, previousVideoModalMode, videoModalItem]);
|
|
258
272
|
|
|
259
273
|
React.useEffect(() => {
|
|
260
274
|
if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
|
|
@@ -296,7 +310,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
296
310
|
|
|
297
311
|
resetPlayerAnimationState();
|
|
298
312
|
});
|
|
299
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
313
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
300
314
|
Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
|
|
301
315
|
maximiseVideoModal();
|
|
302
316
|
setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
|
|
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
50
50
|
|
|
51
51
|
const isNotMinimizeMaximazeAnimation =
|
|
52
52
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
53
|
-
playerAnimationState !== PlayerAnimationStateEnum.
|
|
53
|
+
playerAnimationState !== PlayerAnimationStateEnum.maximize;
|
|
54
54
|
|
|
55
55
|
const isEnablePanGesture =
|
|
56
56
|
!isLanguageOverlayVisible &&
|
|
@@ -89,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
89
89
|
setLastSnap(destSnapPoint);
|
|
90
90
|
|
|
91
91
|
if (destSnapPoint === modalSnapPoints[0]) {
|
|
92
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
92
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
93
93
|
} else {
|
|
94
94
|
lastScrollY.setValue(0);
|
|
95
95
|
lastScrollYValue.current = 0;
|
|
@@ -105,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
105
105
|
modalSnapPoints[1] - preparedTranslationY
|
|
106
106
|
);
|
|
107
107
|
|
|
108
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
108
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
109
109
|
} else {
|
|
110
110
|
resetPlayerAnimationState();
|
|
111
111
|
}
|
|
@@ -228,6 +228,8 @@ export const AnimationView = ({
|
|
|
228
228
|
isAudioItem,
|
|
229
229
|
moveUpValue,
|
|
230
230
|
moveComponentHorizontalValue,
|
|
231
|
+
isRTL,
|
|
232
|
+
inlineAudioPlayer,
|
|
231
233
|
]
|
|
232
234
|
);
|
|
233
235
|
|
|
@@ -246,7 +248,7 @@ export const AnimationView = ({
|
|
|
246
248
|
default:
|
|
247
249
|
return getAnimationValue(
|
|
248
250
|
animationType,
|
|
249
|
-
PlayerAnimationStateEnum.
|
|
251
|
+
PlayerAnimationStateEnum.maximize
|
|
250
252
|
).toValue;
|
|
251
253
|
}
|
|
252
254
|
}, [defaultValue, videoModalState]);
|
|
@@ -278,6 +280,11 @@ export const AnimationView = ({
|
|
|
278
280
|
moveUpValue,
|
|
279
281
|
moveComponentHorizontalValue,
|
|
280
282
|
videoModalMode,
|
|
283
|
+
isAudioItem,
|
|
284
|
+
isTablet,
|
|
285
|
+
isTabletLandscape,
|
|
286
|
+
isRTL,
|
|
287
|
+
inlineAudioPlayer,
|
|
281
288
|
]
|
|
282
289
|
);
|
|
283
290
|
|
|
@@ -306,7 +313,7 @@ export const AnimationView = ({
|
|
|
306
313
|
}
|
|
307
314
|
|
|
308
315
|
if (
|
|
309
|
-
videoModalMode === "MAXIMIZED" &&
|
|
316
|
+
(videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
|
|
310
317
|
defaultValue.x !== screenWidth &&
|
|
311
318
|
width &&
|
|
312
319
|
height
|
|
@@ -332,7 +339,13 @@ export const AnimationView = ({
|
|
|
332
339
|
animatedValue.setValue(value);
|
|
333
340
|
}
|
|
334
341
|
}
|
|
335
|
-
}, [
|
|
342
|
+
}, [
|
|
343
|
+
animatedValue,
|
|
344
|
+
animationType,
|
|
345
|
+
getAnimationValue,
|
|
346
|
+
playerAnimationState,
|
|
347
|
+
videoModalState,
|
|
348
|
+
]);
|
|
336
349
|
|
|
337
350
|
React.useEffect(() => {
|
|
338
351
|
if (
|
|
@@ -344,7 +357,7 @@ export const AnimationView = ({
|
|
|
344
357
|
animatedValue,
|
|
345
358
|
getAnimationValue(animationType, playerAnimationState)
|
|
346
359
|
).start();
|
|
347
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
360
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
348
361
|
animatedValue.setValue(defaultValue);
|
|
349
362
|
}
|
|
350
363
|
}, [playerAnimationState, startComponentsAnimation, defaultValue]);
|
|
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
|
|
|
14
14
|
|
|
15
15
|
export enum PlayerAnimationStateEnum {
|
|
16
16
|
minimize = "minimize",
|
|
17
|
-
|
|
17
|
+
maximize = "maximize",
|
|
18
18
|
drag_player = "drag_player",
|
|
19
19
|
drag_scroll = "drag_scroll",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
22
|
+
export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
23
23
|
|
|
24
24
|
export type ModalAnimationContextT = {
|
|
25
25
|
isActiveGesture: boolean;
|
|
@@ -137,14 +137,14 @@ const VideoModalComponent = () => {
|
|
|
137
137
|
styles.container,
|
|
138
138
|
{
|
|
139
139
|
backgroundColor,
|
|
140
|
+
width: modalSize.width,
|
|
141
|
+
height: modalSize.height,
|
|
140
142
|
},
|
|
141
143
|
]}
|
|
142
144
|
>
|
|
143
145
|
<HandlePlayable
|
|
144
146
|
item={item}
|
|
145
147
|
isModal={mode !== "PIP"}
|
|
146
|
-
modalHeight={modalSize.height}
|
|
147
|
-
modalWidth={modalSize.width}
|
|
148
148
|
mode={mode}
|
|
149
149
|
/>
|
|
150
150
|
</AnimatedPlayerModalWrapper>
|
|
@@ -21,13 +21,13 @@ const prepareConfiguration = (
|
|
|
21
21
|
keys: [string]
|
|
22
22
|
) => R.compose(R.evolve(keysMap), R.pickAll(keys))(configuration);
|
|
23
23
|
|
|
24
|
-
const configurationKeys = R.keys(keysMap);
|
|
25
|
-
|
|
26
24
|
export function withConfigurationProvider(Component: React.ComponentType<any>) {
|
|
27
25
|
return function WithConfigurationProvider(props: Props) {
|
|
28
26
|
const styles = props?.screenData?.styles;
|
|
29
27
|
const general = props?.screenData?.general;
|
|
30
28
|
|
|
29
|
+
const configurationKeys = React.useMemo(() => R.keys(keysMap), []);
|
|
30
|
+
|
|
31
31
|
const configuration = React.useMemo(
|
|
32
32
|
() => prepareConfiguration({ ...general, ...styles }, configurationKeys),
|
|
33
33
|
[]
|
|
@@ -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
|
}
|
|
@@ -230,7 +230,8 @@ export function zappPipesDataConnector(
|
|
|
230
230
|
const entryContext =
|
|
231
231
|
(shouldUseNestedContext && screenContextData?.nested?.entry
|
|
232
232
|
? screenContextData?.nested?.entry
|
|
233
|
-
: screenContextData?.entry) ||
|
|
233
|
+
: (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
|
|
234
|
+
{};
|
|
234
235
|
|
|
235
236
|
const screenContext =
|
|
236
237
|
(shouldUseNestedContext && screenContextData?.nested?.screen
|
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.9053464934",
|
|
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": {
|
|
@@ -32,10 +31,10 @@
|
|
|
32
31
|
"redux-mock-store": "^1.5.3"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.9053464934",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9053464934",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.9053464934",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.9053464934",
|
|
39
38
|
"promise": "^8.3.0",
|
|
40
39
|
"react-router-native": "^5.1.2",
|
|
41
40
|
"url": "^0.11.0",
|
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
|
-
});
|