@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7855034103 → 12.0.0-alpha.8024419438
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/BaseFocusable/index.tsx +1 -1
- package/Components/Cell/Cell.tsx +5 -5
- package/Components/Cell/CellWithFocusable.tsx +17 -5
- package/Components/FocusableGroup/index.tsx +1 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +19 -75
- package/Components/Layout/TV/index.tsx +0 -2
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +6 -2
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +4 -1
- package/Components/MasterCell/utils/index.ts +17 -30
- package/Components/Navigator/StackNavigator.tsx +48 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -1
- package/Components/River/TV/River.tsx +0 -23
- package/Components/Screen/TV/hooks/index.ts +3 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
- package/Components/Screen/TV/index.web.tsx +179 -0
- package/Components/Screen/__tests__/Screen.test.tsx +3 -0
- package/Components/Screen/index.tsx +29 -1
- package/Components/ScreenResolver/index.tsx +3 -1
- package/Components/Transitioner/Transitioner.tsx +15 -29
- package/Components/VideoLive/LiveImageManager.ts +15 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +48 -38
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +40 -33
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +94 -71
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +5 -5
- package/Components/VideoModal/PlayerWrapper.tsx +8 -8
- package/Components/VideoModal/VideoModal.tsx +4 -4
- package/Components/VideoModal/utils.ts +5 -2
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
- package/package.json +5 -5
- package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
- package/Contexts/ScreenDataContext/index.ts +0 -3
|
@@ -50,50 +50,57 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
50
50
|
{ useNativeDriver: true }
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
const onHandlerStateChange = (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
const onHandlerStateChange = React.useCallback(
|
|
54
|
+
({ nativeEvent }) => {
|
|
55
|
+
if (nativeEvent.oldState === State.ACTIVE) {
|
|
56
|
+
// eslint-disable-next-line prefer-const
|
|
57
|
+
const { velocityY, translationY } = nativeEvent;
|
|
58
|
+
const preparedTranslationY = Math.abs(translationY);
|
|
59
|
+
const dragToss = 0.05;
|
|
60
|
+
|
|
61
|
+
if (videoModalState.mode === "MAXIMIZED") {
|
|
62
|
+
if (translationY > 0) {
|
|
63
|
+
const endOffsetY =
|
|
64
|
+
lastSnap + preparedTranslationY + dragToss * velocityY + 200;
|
|
65
|
+
|
|
66
|
+
let destSnapPoint = modalSnapPoints[0];
|
|
67
|
+
|
|
68
|
+
for (const snapPoint of modalSnapPoints) {
|
|
69
|
+
const distFromSnap = Math.abs(snapPoint - endOffsetY);
|
|
70
|
+
|
|
71
|
+
if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
|
|
72
|
+
destSnapPoint = snapPoint;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
const distFromSnap = Math.abs(snapPoint - endOffsetY);
|
|
76
|
+
setLastSnap(destSnapPoint);
|
|
69
77
|
|
|
70
|
-
if (
|
|
71
|
-
|
|
78
|
+
if (destSnapPoint === modalSnapPoints[0]) {
|
|
79
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
80
|
+
} else {
|
|
81
|
+
lastScrollY.setValue(0);
|
|
82
|
+
lastScrollYValue.current = 0;
|
|
83
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
72
84
|
}
|
|
73
85
|
}
|
|
86
|
+
} else if (videoModalState.mode === "MINIMIZED") {
|
|
87
|
+
if (translationY < 0) {
|
|
88
|
+
// from mini to full
|
|
89
|
+
setLastSnap(modalSnapPoints[0]);
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
translateYOffset.setValue(
|
|
92
|
+
modalSnapPoints[1] - preparedTranslationY
|
|
93
|
+
);
|
|
76
94
|
|
|
77
|
-
if (destSnapPoint === modalSnapPoints[0]) {
|
|
78
95
|
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
79
96
|
} else {
|
|
80
|
-
|
|
81
|
-
lastScrollYValue.current = 0;
|
|
82
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
97
|
+
resetPlayerAnimationState();
|
|
83
98
|
}
|
|
84
99
|
}
|
|
85
|
-
} else if (videoModalState.mode === "MINIMIZED") {
|
|
86
|
-
if (translationY < 0) {
|
|
87
|
-
// from mini to full
|
|
88
|
-
setLastSnap(modalSnapPoints[0]);
|
|
89
|
-
translateYOffset.setValue(modalSnapPoints[1] - preparedTranslationY);
|
|
90
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
91
|
-
} else {
|
|
92
|
-
resetPlayerAnimationState();
|
|
93
|
-
}
|
|
94
100
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
101
|
+
},
|
|
102
|
+
[lastSnap, modalSnapPoints, videoModalState.mode]
|
|
103
|
+
);
|
|
97
104
|
|
|
98
105
|
React.useEffect(() => {
|
|
99
106
|
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { Animated, View, StyleSheet } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
useSafeAreaInsets,
|
|
6
|
-
useSafeAreaFrame,
|
|
7
|
-
} from "react-native-safe-area-context";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
5
|
|
|
9
6
|
import {
|
|
10
7
|
useModalAnimationContext,
|
|
@@ -18,6 +15,7 @@ import {
|
|
|
18
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
19
16
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
20
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
|
+
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
21
19
|
|
|
22
20
|
import {
|
|
23
21
|
gestureListenerHelper,
|
|
@@ -59,18 +57,19 @@ export const AnimationView = ({
|
|
|
59
57
|
} = useModalAnimationContext();
|
|
60
58
|
|
|
61
59
|
const isRTL = useIsRTL();
|
|
60
|
+
const isAppActive = useAppState(true);
|
|
62
61
|
|
|
63
62
|
const {
|
|
64
63
|
height: screenHeight,
|
|
64
|
+
width: screenWidth,
|
|
65
65
|
deviceInfo: { isTablet, isTabletLandscape },
|
|
66
|
-
} = useDimensions("
|
|
66
|
+
} = useDimensions("window", { deviceInfo: true });
|
|
67
67
|
|
|
68
68
|
const startAnimationDistance = Math.round((screenHeight * 60) / 100);
|
|
69
69
|
const { videoModalState } = useNavigation();
|
|
70
70
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
71
71
|
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
72
72
|
const insets = useSafeAreaInsets();
|
|
73
|
-
const { width: screenWidth } = useSafeAreaFrame();
|
|
74
73
|
const animationComponentRef = useRef(null);
|
|
75
74
|
|
|
76
75
|
// retrieving top position of the player for tablet landscape mode
|
|
@@ -88,13 +87,6 @@ export const AnimationView = ({
|
|
|
88
87
|
getAnimationDefaultValue(animationType, bottomTabBarHeight)
|
|
89
88
|
);
|
|
90
89
|
|
|
91
|
-
const animationValueType: string =
|
|
92
|
-
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
93
|
-
|
|
94
|
-
const animatedValue = useRef(
|
|
95
|
-
new Animated[animationValueType](defaultValue)
|
|
96
|
-
).current;
|
|
97
|
-
|
|
98
90
|
const isAudioItem = React.useMemo(
|
|
99
91
|
() =>
|
|
100
92
|
videoModalState.item?.content?.type?.includes?.("audio") ||
|
|
@@ -118,63 +110,8 @@ export const AnimationView = ({
|
|
|
118
110
|
: -additionalData.moveValue
|
|
119
111
|
: 0;
|
|
120
112
|
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
isAudioItem,
|
|
124
|
-
bottomTabBarHeight,
|
|
125
|
-
minimisedHeight,
|
|
126
|
-
minimisedWidth,
|
|
127
|
-
defaultValue,
|
|
128
|
-
moveUpValue,
|
|
129
|
-
moveComponentHorizontalValue,
|
|
130
|
-
isTablet,
|
|
131
|
-
isTabletLandscape,
|
|
132
|
-
isRTL,
|
|
133
|
-
fromMiniPlayer: videoModalState.mode === "MINIMIZED",
|
|
134
|
-
inlineAudioPlayer,
|
|
135
|
-
}),
|
|
136
|
-
[
|
|
137
|
-
bottomTabBarHeight,
|
|
138
|
-
minimisedHeight,
|
|
139
|
-
minimisedWidth,
|
|
140
|
-
defaultValue,
|
|
141
|
-
moveUpValue,
|
|
142
|
-
moveComponentHorizontalValue,
|
|
143
|
-
videoModalState.mode,
|
|
144
|
-
]
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
React.useEffect(() => {
|
|
148
|
-
if (additionalData.resetAnimationValue) {
|
|
149
|
-
animatedValue.setValue(0);
|
|
150
|
-
}
|
|
151
|
-
}, [additionalData.resetAnimationValue]);
|
|
152
|
-
|
|
153
|
-
React.useEffect(() => {
|
|
154
|
-
if (animationType === ComponentAnimationType.player) {
|
|
155
|
-
let width, height;
|
|
156
|
-
|
|
157
|
-
if (additionalData.aspectRatio) {
|
|
158
|
-
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
159
|
-
|
|
160
|
-
height =
|
|
161
|
-
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
162
|
-
additionalData.aspectRatio;
|
|
163
|
-
} else {
|
|
164
|
-
width =
|
|
165
|
-
typeof additionalData.width === "number" && additionalData.width;
|
|
166
|
-
|
|
167
|
-
height =
|
|
168
|
-
typeof additionalData.height === "number" && additionalData.height;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (defaultValue.x === 0 && width && height) {
|
|
172
|
-
const value = { x: width, y: height };
|
|
173
|
-
setDefaultValue(value);
|
|
174
|
-
animatedValue.setValue(value);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}, [additionalData, screenWidth]);
|
|
113
|
+
const animationValueType: string =
|
|
114
|
+
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
178
115
|
|
|
179
116
|
const getAnimationValue = React.useCallback(
|
|
180
117
|
(animationType, state) => {
|
|
@@ -292,6 +229,90 @@ export const AnimationView = ({
|
|
|
292
229
|
]
|
|
293
230
|
);
|
|
294
231
|
|
|
232
|
+
const getInitialValue = React.useCallback(() => {
|
|
233
|
+
const mode =
|
|
234
|
+
videoModalState.mode === "PIP"
|
|
235
|
+
? videoModalState.previousMode
|
|
236
|
+
: videoModalState.mode;
|
|
237
|
+
|
|
238
|
+
switch (mode) {
|
|
239
|
+
case "MINIMIZED":
|
|
240
|
+
return getAnimationValue(
|
|
241
|
+
animationType,
|
|
242
|
+
PlayerAnimationStateEnum.minimize
|
|
243
|
+
).toValue;
|
|
244
|
+
|
|
245
|
+
case "MAXIMIZED":
|
|
246
|
+
default:
|
|
247
|
+
return getAnimationValue(
|
|
248
|
+
animationType,
|
|
249
|
+
PlayerAnimationStateEnum.maximaze
|
|
250
|
+
).toValue;
|
|
251
|
+
}
|
|
252
|
+
}, [defaultValue, videoModalState]);
|
|
253
|
+
|
|
254
|
+
const animatedValue = useRef(
|
|
255
|
+
new Animated[animationValueType](getInitialValue())
|
|
256
|
+
).current;
|
|
257
|
+
|
|
258
|
+
const calculationData = React.useMemo(
|
|
259
|
+
() => ({
|
|
260
|
+
isAudioItem,
|
|
261
|
+
bottomTabBarHeight,
|
|
262
|
+
minimisedHeight,
|
|
263
|
+
minimisedWidth,
|
|
264
|
+
defaultValue,
|
|
265
|
+
moveUpValue,
|
|
266
|
+
moveComponentHorizontalValue,
|
|
267
|
+
isTablet,
|
|
268
|
+
isTabletLandscape,
|
|
269
|
+
isRTL,
|
|
270
|
+
fromMiniPlayer: videoModalState.mode === "MINIMIZED",
|
|
271
|
+
inlineAudioPlayer,
|
|
272
|
+
}),
|
|
273
|
+
[
|
|
274
|
+
bottomTabBarHeight,
|
|
275
|
+
minimisedHeight,
|
|
276
|
+
minimisedWidth,
|
|
277
|
+
defaultValue,
|
|
278
|
+
moveUpValue,
|
|
279
|
+
moveComponentHorizontalValue,
|
|
280
|
+
videoModalState.mode,
|
|
281
|
+
]
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
React.useEffect(() => {
|
|
285
|
+
if (additionalData.resetAnimationValue) {
|
|
286
|
+
animatedValue.setValue(defaultValue);
|
|
287
|
+
}
|
|
288
|
+
}, [additionalData.resetAnimationValue, defaultValue]);
|
|
289
|
+
|
|
290
|
+
React.useEffect(() => {
|
|
291
|
+
if (animationType === ComponentAnimationType.player) {
|
|
292
|
+
let width, height;
|
|
293
|
+
|
|
294
|
+
if (additionalData.aspectRatio) {
|
|
295
|
+
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
296
|
+
|
|
297
|
+
height =
|
|
298
|
+
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
299
|
+
additionalData.aspectRatio;
|
|
300
|
+
} else {
|
|
301
|
+
width =
|
|
302
|
+
typeof additionalData.width === "number" && additionalData.width;
|
|
303
|
+
|
|
304
|
+
height =
|
|
305
|
+
typeof additionalData.height === "number" && additionalData.height;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (defaultValue.x === 0 && width && height) {
|
|
309
|
+
const value = { x: width, y: height };
|
|
310
|
+
setDefaultValue(value);
|
|
311
|
+
animatedValue.setValue(value);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}, [additionalData, screenWidth]);
|
|
315
|
+
|
|
295
316
|
React.useEffect(() => {
|
|
296
317
|
if (
|
|
297
318
|
playerAnimationState === PlayerAnimationStateEnum.minimize &&
|
|
@@ -374,7 +395,8 @@ export const AnimationView = ({
|
|
|
374
395
|
...preparedStyles,
|
|
375
396
|
additionalData.saveArea ? styles.flex : null,
|
|
376
397
|
(videoModalState.mode === "MAXIMIZED" ||
|
|
377
|
-
videoModalState.mode === "MINIMIZED"
|
|
398
|
+
videoModalState.mode === "MINIMIZED" ||
|
|
399
|
+
(videoModalState.mode === "PIP" && isAppActive)) &&
|
|
378
400
|
getAnimationStyle(animationType, animatedValue),
|
|
379
401
|
]}
|
|
380
402
|
>
|
|
@@ -412,6 +434,7 @@ export const AnimationComponent = (props: Props) => {
|
|
|
412
434
|
delete additionalData.extraAnimation[animationType];
|
|
413
435
|
|
|
414
436
|
return (
|
|
437
|
+
// @ts-ignore
|
|
415
438
|
<Component {...(isReactFragment ? null : props)}>
|
|
416
439
|
<AnimationComponent
|
|
417
440
|
{...animationProps}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "react-native-
|
|
8
|
-
import { useGetBottomTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
|
+
useGetBottomTabBarHeight,
|
|
7
|
+
useDimensions,
|
|
8
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
9
9
|
|
|
10
10
|
import { useConfiguration } from "../utils";
|
|
11
11
|
|
|
@@ -93,7 +93,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
93
93
|
const translateYOffset = React.useRef(new Animated.Value(0)).current;
|
|
94
94
|
const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
|
|
95
95
|
|
|
96
|
-
const { height } =
|
|
96
|
+
const { height } = useDimensions("window", { fullDimensions: true });
|
|
97
97
|
const { bottom: bottomSafeArea } = useSafeAreaInsets();
|
|
98
98
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
99
99
|
|
|
@@ -184,8 +184,8 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
184
184
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
|
|
185
185
|
|
|
186
186
|
return (
|
|
187
|
-
<
|
|
188
|
-
<
|
|
187
|
+
<PathnameContext.Provider value={pathname}>
|
|
188
|
+
<ScreenContextProvider pathname={pathname}>
|
|
189
189
|
<WrapperView
|
|
190
190
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
191
191
|
style={[
|
|
@@ -199,8 +199,8 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
199
199
|
additionalData={{ saveArea: true }}
|
|
200
200
|
style={directionStyles(isTabletLandscape)}
|
|
201
201
|
>
|
|
202
|
-
<
|
|
203
|
-
<
|
|
202
|
+
<PathnameContext.Provider value={pathname}>
|
|
203
|
+
<ScreenContextProvider pathname={pathname}>
|
|
204
204
|
<View
|
|
205
205
|
testID={`${entry?.id}-player-container`}
|
|
206
206
|
style={[
|
|
@@ -241,11 +241,11 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
241
241
|
<View style={defaultStyles.playerDetails} />
|
|
242
242
|
)}
|
|
243
243
|
</AnimatedScrollModal>
|
|
244
|
-
</
|
|
245
|
-
</
|
|
244
|
+
</ScreenContextProvider>
|
|
245
|
+
</PathnameContext.Provider>
|
|
246
246
|
</AnimationComponent>
|
|
247
247
|
</WrapperView>
|
|
248
|
-
</
|
|
249
|
-
</
|
|
248
|
+
</ScreenContextProvider>
|
|
249
|
+
</PathnameContext.Provider>
|
|
250
250
|
);
|
|
251
251
|
};
|
|
@@ -129,8 +129,8 @@ const VideoModalComponent = () => {
|
|
|
129
129
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
|
|
130
130
|
|
|
131
131
|
return (
|
|
132
|
-
<
|
|
133
|
-
<
|
|
132
|
+
<PathnameContext.Provider value={pathname}>
|
|
133
|
+
<ScreenContextProvider pathname={pathname}>
|
|
134
134
|
{itemIdHooksFinished === item?.id ? (
|
|
135
135
|
<AnimatedPlayerModalWrapper
|
|
136
136
|
style={[
|
|
@@ -153,8 +153,8 @@ const VideoModalComponent = () => {
|
|
|
153
153
|
<Spinner />
|
|
154
154
|
</View>
|
|
155
155
|
)}
|
|
156
|
-
</
|
|
157
|
-
</
|
|
156
|
+
</ScreenContextProvider>
|
|
157
|
+
</PathnameContext.Provider>
|
|
158
158
|
);
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -33,8 +33,11 @@ export const useConfiguration = () => {
|
|
|
33
33
|
...pluginConfiguration,
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const {
|
|
37
|
-
|
|
36
|
+
const {
|
|
37
|
+
minimised_height = 0,
|
|
38
|
+
minimised_height_tablet = 0,
|
|
39
|
+
modal_background_color,
|
|
40
|
+
} = config;
|
|
38
41
|
|
|
39
42
|
const minimisedHeight = useIsTablet()
|
|
40
43
|
? minimised_height_tablet
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
3
|
+
|
|
4
|
+
export const ScreenDataContext = React.createContext<any>(null);
|
|
5
|
+
|
|
6
|
+
// Use this only to provide initial screenData context, before the Transitioner and Screen is rendered.
|
|
7
|
+
export const withScreenDataContextProvider = (Component: any) => {
|
|
8
|
+
return function ScreenDataContextProvider(props: any) {
|
|
9
|
+
const { activeRiver } = useNavigation();
|
|
10
|
+
|
|
11
|
+
// use only initial activeRiver as this context should only be used for "Home", initial route
|
|
12
|
+
const screenData = React.useMemo(() => ({ screen: activeRiver }), []);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ScreenDataContext.Provider value={screenData}>
|
|
16
|
+
<Component {...props} />
|
|
17
|
+
</ScreenDataContext.Provider>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.8024419438",
|
|
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",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.8024419438",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.8024419438",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.8024419438",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.8024419438",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
4
|
-
import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
5
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
|
-
import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
7
|
-
import { Spinner } from "@applicaster/zapp-react-native-ui-components/Components/Spinner";
|
|
8
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
9
|
-
|
|
10
|
-
import { useScreenConfiguration } from "../../River/useScreenConfiguration";
|
|
11
|
-
|
|
12
|
-
const styles = StyleSheet.create({
|
|
13
|
-
container: {
|
|
14
|
-
position: "absolute",
|
|
15
|
-
top: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
right: 0,
|
|
18
|
-
bottom: 0,
|
|
19
|
-
|
|
20
|
-
alignItems: "center",
|
|
21
|
-
justifyContent: "center",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const TransitionOverlay = () => {
|
|
26
|
-
const screen = useCurrentScreenData();
|
|
27
|
-
|
|
28
|
-
const { backgroundColor: screenBackgroundColor } = useScreenConfiguration(
|
|
29
|
-
screen?.id
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const theme = useTheme();
|
|
33
|
-
|
|
34
|
-
const themeBackgroundColor = React.useMemo(
|
|
35
|
-
() => theme.app_background_color,
|
|
36
|
-
[theme.app_background_color]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const backgroundColor = ifEmptyUseFallback(
|
|
40
|
-
screenBackgroundColor,
|
|
41
|
-
themeBackgroundColor
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const {
|
|
45
|
-
appState: { isTransitioning },
|
|
46
|
-
} = usePickFromState(["appState"]);
|
|
47
|
-
|
|
48
|
-
if (!isWeb() || !isTransitioning) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<View
|
|
54
|
-
style={[
|
|
55
|
-
styles.container,
|
|
56
|
-
{
|
|
57
|
-
backgroundColor,
|
|
58
|
-
},
|
|
59
|
-
]}
|
|
60
|
-
>
|
|
61
|
-
<Spinner size={"large"} />
|
|
62
|
-
</View>
|
|
63
|
-
);
|
|
64
|
-
};
|