@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4155487673 → 12.0.0-alpha.4173603919
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/Cell/Cell.tsx +8 -1
- package/Components/Focusable/__tests__/index.android.test.tsx +72 -0
- package/Components/Focusable/index.android.tsx +15 -9
- package/Components/FocusableList/FocusableChild.ts +2 -2
- package/Components/FocusableList/index.tsx +11 -12
- package/Components/FocusableScrollView/index.tsx +1 -1
- package/Components/FreezeWithCallback/Freeze.tsx +31 -0
- package/Components/FreezeWithCallback/LICENSE +21 -0
- package/Components/FreezeWithCallback/Suspender.tsx +17 -0
- package/Components/FreezeWithCallback/__tests__/index.test.tsx +170 -0
- package/Components/FreezeWithCallback/index.tsx +3 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +12 -0
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -5
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +16 -2
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +14 -8
- package/Components/Screen/TV/hooks/index.ts +0 -2
- package/Components/Screen/TV/index.web.tsx +32 -19
- package/Components/Screen/__tests__/Screen.test.tsx +0 -49
- package/Components/Screen/index.tsx +1 -19
- package/Components/Screen/navigationHandler.ts +1 -3
- package/Components/Screen/orientationHandler.ts +18 -7
- package/Components/Screen/utils.ts +16 -0
- package/Components/Transitioner/Scene.tsx +9 -2
- package/Components/Transitioner/Transitioner.tsx +23 -10
- package/Components/Transitioner/__tests__/Scene.test.js +7 -0
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +19 -2
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +28 -3
- package/Components/VideoModal/PlayerDetails.tsx +16 -2
- package/Components/VideoModal/PlayerWrapper.tsx +40 -10
- package/Components/VideoModal/VideoModal.tsx +33 -27
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +7 -0
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -0
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +56 -10
- package/Components/ZappFrameworkComponents/BarView/BarView.tsx +7 -3
- package/Components/ZappFrameworkComponents/BarView/Buttons/BackButton.tsx +7 -2
- package/Components/ZappFrameworkComponents/BarView/Buttons/CloseButton.tsx +7 -2
- package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +87 -0
- package/Components/ZappFrameworkComponents/Buttons/ActionButton.tsx +9 -4
- package/Contexts/CachedDimensionsContext/index.ts +13 -9
- package/Contexts/ConfirmDialogState/index.ts +1 -1
- package/Contexts/ScreenContext/index.tsx +6 -1
- package/const.ts +6 -0
- package/index.js +3 -0
- package/package.json +5 -5
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +0 -22
|
@@ -362,13 +362,15 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
362
362
|
const toggleFullscreen = (event) => {
|
|
363
363
|
const { fullscreen = false } = event || {};
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
365
|
+
setTimeout(() => {
|
|
366
|
+
if (fullscreen) {
|
|
367
|
+
navigator.fullscreenVideoModal();
|
|
368
|
+
playerEvent("onFullscreenPlayerWillPresent");
|
|
369
|
+
} else {
|
|
370
|
+
navigator.maximiseVideoModal();
|
|
371
|
+
playerEvent("onFullscreenPlayerWillDismiss");
|
|
372
|
+
}
|
|
373
|
+
});
|
|
372
374
|
};
|
|
373
375
|
|
|
374
376
|
const onCellTap = (entry) => {
|
|
@@ -463,6 +465,10 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
463
465
|
|
|
464
466
|
if (mode === VideoModalMode.FULLSCREEN) {
|
|
465
467
|
toggleFullscreen({ fullscreen: false });
|
|
468
|
+
|
|
469
|
+
if (!isModal) {
|
|
470
|
+
playerManager.closeNativePlayer();
|
|
471
|
+
}
|
|
466
472
|
}
|
|
467
473
|
|
|
468
474
|
return !!(
|
|
@@ -519,7 +525,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
519
525
|
}
|
|
520
526
|
|
|
521
527
|
return () => {
|
|
522
|
-
playerEvent("player_did_close");
|
|
528
|
+
playerEvent("player_did_close", { item });
|
|
523
529
|
|
|
524
530
|
if (!isModal) {
|
|
525
531
|
showNavBar(true);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { last } from "ramda";
|
|
3
|
-
import {
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
findMenuPlugin,
|
|
6
6
|
getNavigationProps,
|
|
7
7
|
getPathAttributes,
|
|
8
8
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useIsScreenActive,
|
|
11
|
+
useNavigation,
|
|
12
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
10
13
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
11
14
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
12
15
|
import {
|
|
@@ -17,8 +20,10 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
|
|
|
17
20
|
|
|
18
21
|
import { NavBarContainer } from "../../Layout/TV/NavBarContainer";
|
|
19
22
|
import { ScreenResolver } from "../../ScreenResolver";
|
|
20
|
-
import { useInitialFocus
|
|
23
|
+
import { useInitialFocus } from "./hooks";
|
|
21
24
|
import { isPlayerPlugin } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
25
|
+
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
26
|
+
import { FreezeWithCallback } from "../../FreezeWithCallback";
|
|
22
27
|
|
|
23
28
|
const styles = StyleSheet.create({
|
|
24
29
|
container: {
|
|
@@ -103,7 +108,6 @@ export const Screen = ({ route, Components }: Props) => {
|
|
|
103
108
|
const backgroundColor = useScreenBackgroundColor(screenId);
|
|
104
109
|
|
|
105
110
|
useInitialFocus();
|
|
106
|
-
useRestoreFocus();
|
|
107
111
|
|
|
108
112
|
const activeRiver = getActiveRiver({
|
|
109
113
|
screenId,
|
|
@@ -145,21 +149,30 @@ export const Screen = ({ route, Components }: Props) => {
|
|
|
145
149
|
? routeState?.state?.entry
|
|
146
150
|
: routeState?.state?.screen;
|
|
147
151
|
|
|
152
|
+
const isScreenActive = useIsScreenActive();
|
|
153
|
+
|
|
148
154
|
return (
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
<FreezeWithCallback
|
|
156
|
+
freeze={!isScreenActive}
|
|
157
|
+
onRelease={() => {
|
|
158
|
+
focusManager.setInitialFocus();
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<View style={[styles.container, { backgroundColor }]}>
|
|
162
|
+
<NavBarContainer isVisible={isNavBarVisible} onReady={noop}>
|
|
163
|
+
<NavBar
|
|
164
|
+
isVisible={isNavBarVisible}
|
|
165
|
+
menuPlugin={menuPlugin}
|
|
166
|
+
navigationProps={navigationProps}
|
|
167
|
+
/>
|
|
168
|
+
</NavBarContainer>
|
|
169
|
+
<ScreenResolver
|
|
170
|
+
screenType={screenType}
|
|
171
|
+
screenId={screenId}
|
|
172
|
+
screenData={screenData}
|
|
173
|
+
groupId={route}
|
|
155
174
|
/>
|
|
156
|
-
</
|
|
157
|
-
|
|
158
|
-
screenType={screenType}
|
|
159
|
-
screenId={screenId}
|
|
160
|
-
screenData={screenData}
|
|
161
|
-
groupId={route}
|
|
162
|
-
/>
|
|
163
|
-
</View>
|
|
175
|
+
</View>
|
|
176
|
+
</FreezeWithCallback>
|
|
164
177
|
);
|
|
165
178
|
};
|
|
@@ -99,14 +99,6 @@ jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
|
99
99
|
}),
|
|
100
100
|
}));
|
|
101
101
|
|
|
102
|
-
const {
|
|
103
|
-
ORIENTATIONS,
|
|
104
|
-
} = require("@applicaster/zapp-react-native-utils/appUtils/orientationHelper");
|
|
105
|
-
|
|
106
|
-
const {
|
|
107
|
-
useCurrentScreenData,
|
|
108
|
-
} = require("@applicaster/zapp-react-native-utils/reactHooks/screen");
|
|
109
|
-
|
|
110
102
|
const {
|
|
111
103
|
allowedOrientationsForScreen,
|
|
112
104
|
getOrientation,
|
|
@@ -158,45 +150,4 @@ describe("<Screen Component />", () => {
|
|
|
158
150
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
159
151
|
});
|
|
160
152
|
});
|
|
161
|
-
|
|
162
|
-
it("invokes the orientation hook when the route changes", () => {
|
|
163
|
-
act(() => {
|
|
164
|
-
wrapper = create(<Screen {...screenProps} />);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
useCurrentScreenData.mockReturnValue({
|
|
169
|
-
id: "player-testId",
|
|
170
|
-
general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
171
|
-
plugin_type: "player",
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
act(() => {
|
|
175
|
-
wrapper.update(
|
|
176
|
-
<Screen
|
|
177
|
-
{...screenProps}
|
|
178
|
-
pathname="/playable"
|
|
179
|
-
screenData={{
|
|
180
|
-
id: "player-testId",
|
|
181
|
-
general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
182
|
-
plugin_type: "player",
|
|
183
|
-
}}
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
useCurrentScreenData.mockReturnValue({
|
|
189
|
-
id: "player-testId",
|
|
190
|
-
general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
act(() => {
|
|
194
|
-
wrapper.update(<Screen {...screenProps} />);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
expect(allowedOrientationsForScreen).toHaveBeenNthCalledWith(
|
|
198
|
-
1,
|
|
199
|
-
ORIENTATIONS.landscapeSensor
|
|
200
|
-
);
|
|
201
|
-
});
|
|
202
153
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import * as R from "ramda";
|
|
4
3
|
import { View } from "react-native";
|
|
5
4
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
5
|
import {
|
|
@@ -27,7 +26,7 @@ import { getNavigationPluginModule } from "@applicaster/zapp-react-native-app/Ap
|
|
|
27
26
|
|
|
28
27
|
import { RouteManager } from "../RouteManager";
|
|
29
28
|
import { useScreenConfiguration } from "../River/useScreenConfiguration";
|
|
30
|
-
import {
|
|
29
|
+
import { isValidColor } from "./utils";
|
|
31
30
|
|
|
32
31
|
const screenStyles = {
|
|
33
32
|
flex: 1,
|
|
@@ -37,21 +36,6 @@ const screenStyles = {
|
|
|
37
36
|
// paddingRight: insets.right, // Should be applied directly by UI plugin
|
|
38
37
|
};
|
|
39
38
|
|
|
40
|
-
function colorIsNotTransparent(color) {
|
|
41
|
-
const layers = R.compose(
|
|
42
|
-
R.map(R.trim),
|
|
43
|
-
R.split(","),
|
|
44
|
-
R.replace(")", ""),
|
|
45
|
-
R.replace("rgba(", "")
|
|
46
|
-
)(color);
|
|
47
|
-
|
|
48
|
-
return Number(layers?.[3]) > 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function isValidColor(string) {
|
|
52
|
-
return string && string !== "transparent" && colorIsNotTransparent(string);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
39
|
type Props = {
|
|
56
40
|
pathname: unknown;
|
|
57
41
|
screenData: unknown;
|
|
@@ -127,8 +111,6 @@ export function Screen(_props: Props) {
|
|
|
127
111
|
const targetScreenData =
|
|
128
112
|
currentScreenData || (screenData as any)?.targetScreen || screenData;
|
|
129
113
|
|
|
130
|
-
useScreenOrientationHandler({ screenData: targetScreenData });
|
|
131
|
-
|
|
132
114
|
const orientation = useGetScreenOrientation(targetScreenData);
|
|
133
115
|
|
|
134
116
|
// We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
|
|
@@ -26,9 +26,7 @@ export function isMenuVisible(route, screenData) {
|
|
|
26
26
|
if (screenData?.hookPlugin) {
|
|
27
27
|
const hookPlugin = screenData?.hookPlugin?.module;
|
|
28
28
|
|
|
29
|
-
return
|
|
30
|
-
hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true || false
|
|
31
|
-
);
|
|
29
|
+
return hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
if (
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React, { useLayoutEffect } from "react";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
allowedOrientationsForScreen,
|
|
4
5
|
ORIENTATIONS,
|
|
5
6
|
getOrientation,
|
|
6
7
|
useGetScreenOrientation,
|
|
7
8
|
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
8
|
-
|
|
9
|
+
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
9
10
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
11
|
import { findPluginByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
11
12
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
|
+
|
|
12
14
|
import { ZappHookModalContext } from "../../Contexts";
|
|
13
15
|
import { HookModalContextT } from "../../Contexts/ZappHookModalContext";
|
|
14
16
|
|
|
@@ -79,14 +81,23 @@ export function useNewOrientationForScreenData({
|
|
|
79
81
|
screenOrientation;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
screenData
|
|
84
|
-
|
|
84
|
+
type Props = {
|
|
85
|
+
screenData: {
|
|
86
|
+
screen: {};
|
|
87
|
+
};
|
|
88
|
+
isActive: boolean;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export function useScreenOrientationHandler({ screenData, isActive }: Props) {
|
|
85
92
|
const { isHooksExecutionInProgress } = React.useContext<HookModalContextT>(
|
|
86
93
|
ZappHookModalContext.ReactContext
|
|
87
94
|
);
|
|
88
95
|
|
|
89
|
-
const
|
|
96
|
+
const prevIsActive = usePrevious(isActive);
|
|
97
|
+
|
|
98
|
+
const newOrientation = useNewOrientationForScreenData({
|
|
99
|
+
screenData: screenData.screen,
|
|
100
|
+
});
|
|
90
101
|
|
|
91
102
|
useLayoutEffect(() => {
|
|
92
103
|
// Null means screen does not have orientation preference, so we can skip rotate
|
|
@@ -100,12 +111,12 @@ export function useScreenOrientationHandler({
|
|
|
100
111
|
return;
|
|
101
112
|
}
|
|
102
113
|
|
|
103
|
-
if (newOrientation !== current) {
|
|
114
|
+
if (!prevIsActive && isActive && newOrientation !== current) {
|
|
104
115
|
current = newOrientation;
|
|
105
116
|
|
|
106
117
|
setOrientation(newOrientation);
|
|
107
118
|
}
|
|
108
|
-
}, [newOrientation, isHooksExecutionInProgress]);
|
|
119
|
+
}, [newOrientation, isHooksExecutionInProgress, prevIsActive, isActive]);
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
export function useOrientationHandler({ screenData }: OrientationHookArgs) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { map, split, replace, compose, trim } from "ramda";
|
|
2
|
+
|
|
3
|
+
function colorIsNotTransparent(color) {
|
|
4
|
+
const layers = compose(
|
|
5
|
+
map(trim),
|
|
6
|
+
split(","),
|
|
7
|
+
replace(")", ""),
|
|
8
|
+
replace("rgba(", "")
|
|
9
|
+
)(color);
|
|
10
|
+
|
|
11
|
+
return Number(layers?.[3]) > 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function isValidColor(string) {
|
|
15
|
+
return string && string !== "transparent" && colorIsNotTransparent(string);
|
|
16
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Animated, ViewProps, ViewStyle } from "react-native";
|
|
3
3
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
4
|
+
|
|
5
|
+
import { useScreenOrientationHandler } from "@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler";
|
|
6
|
+
|
|
4
7
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
5
8
|
import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
|
|
6
9
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
@@ -42,6 +45,11 @@ export function Scene({
|
|
|
42
45
|
}: Props) {
|
|
43
46
|
const [initialScreenData, setInitialScreenData] = React.useState(screenData);
|
|
44
47
|
|
|
48
|
+
useScreenOrientationHandler({
|
|
49
|
+
screenData,
|
|
50
|
+
isActive,
|
|
51
|
+
});
|
|
52
|
+
|
|
45
53
|
React.useLayoutEffect(() => {
|
|
46
54
|
if (isActive) {
|
|
47
55
|
setInitialScreenData(screenData);
|
|
@@ -49,13 +57,12 @@ export function Scene({
|
|
|
49
57
|
}, [screenData, isActive]);
|
|
50
58
|
|
|
51
59
|
const frame = useSafeAreaFrame();
|
|
52
|
-
|
|
53
60
|
const isAnimating = animating && overlayStyle;
|
|
54
61
|
|
|
55
62
|
const dimensions = isAnimating
|
|
56
63
|
? {
|
|
57
|
-
height: "100%",
|
|
58
64
|
width: "100%",
|
|
65
|
+
height: "100%",
|
|
59
66
|
}
|
|
60
67
|
: frame;
|
|
61
68
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import
|
|
3
|
+
import { update, compose, tail, append, take, identity, isNil } from "ramda";
|
|
4
4
|
|
|
5
5
|
import { AnimationManager } from "./AnimationManager";
|
|
6
6
|
import { Scene } from "./Scene";
|
|
@@ -46,10 +46,14 @@ function prepareScene(children) {
|
|
|
46
46
|
*/
|
|
47
47
|
function scenesForBackTransition(props: SceneProps, { scenes }) {
|
|
48
48
|
return scenes.length > 1
|
|
49
|
-
?
|
|
49
|
+
? identity(scenes)
|
|
50
50
|
: [prepareScene(props.children), scenes[0]];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
const isModalClosed = (navigator) => {
|
|
54
|
+
return !!isNil(navigator?.modalData);
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
type Props = {
|
|
54
58
|
transitionConfig: any;
|
|
55
59
|
children: React.ReactNode;
|
|
@@ -110,7 +114,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
110
114
|
pushTransitionStart() {
|
|
111
115
|
this.setState(
|
|
112
116
|
{
|
|
113
|
-
scenes:
|
|
117
|
+
scenes: append(prepareScene(this.props.children), this.state.scenes),
|
|
114
118
|
...this.animationManager.stateForAction(this.state, NAV_ACTION_PUSH),
|
|
115
119
|
},
|
|
116
120
|
() => {
|
|
@@ -177,10 +181,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
177
181
|
to: { index: 0 },
|
|
178
182
|
};
|
|
179
183
|
} else if (isLastSceneHook || scenes.length === 1) {
|
|
180
|
-
newState = { scenes:
|
|
184
|
+
newState = { scenes: update(scenes.length - 1, newScene, scenes) };
|
|
181
185
|
} else {
|
|
182
186
|
newState = {
|
|
183
|
-
scenes:
|
|
187
|
+
scenes: compose(tail, append(newScene))(scenes),
|
|
184
188
|
};
|
|
185
189
|
}
|
|
186
190
|
|
|
@@ -225,7 +229,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
225
229
|
this.shouldSkipAnimationForRoute(previousRoute) ||
|
|
226
230
|
this.shouldSkipAnimationForRoute(currentRoute)
|
|
227
231
|
) {
|
|
228
|
-
|
|
232
|
+
// we are going back, in this case we need to have only one scene using resetState
|
|
233
|
+
const resetState = isGoingBack ? true : undefined;
|
|
234
|
+
|
|
235
|
+
return this.transitionWithoutAnimation(resetState);
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
switch (this.props.navigator.previousAction) {
|
|
@@ -268,7 +275,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
268
275
|
backTransitionEnd(stepsBack) {
|
|
269
276
|
this.setState({
|
|
270
277
|
animating: false,
|
|
271
|
-
scenes:
|
|
278
|
+
scenes: take(this.state.scenes.length - stepsBack, this.state.scenes),
|
|
272
279
|
});
|
|
273
280
|
}
|
|
274
281
|
|
|
@@ -284,7 +291,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
284
291
|
<View style={styles.container}>
|
|
285
292
|
{scenes[to.index] && (
|
|
286
293
|
<Scene
|
|
287
|
-
{...{ style: to
|
|
294
|
+
{...{ style: to?.style || {} }}
|
|
288
295
|
pathname={pathname}
|
|
289
296
|
isActive={pathname === this.props.navigator.currentRoute}
|
|
290
297
|
contentStyle={contentStyle}
|
|
@@ -310,7 +317,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
310
317
|
<Scene
|
|
311
318
|
key={scenes[from.index].key}
|
|
312
319
|
pathname={scenes[from.index].key}
|
|
313
|
-
isActive={
|
|
320
|
+
isActive={
|
|
321
|
+
scenes[from.index].key === this.props.navigator.currentRoute &&
|
|
322
|
+
isModalClosed(this.props.navigator)
|
|
323
|
+
}
|
|
314
324
|
style={from.style}
|
|
315
325
|
pointerEvents="none"
|
|
316
326
|
overlayStyle={from.overlayStyle}
|
|
@@ -326,7 +336,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
326
336
|
const toScene = scenes[to.index] && (
|
|
327
337
|
<Scene
|
|
328
338
|
pathname={scenes[to.index].key}
|
|
329
|
-
isActive={
|
|
339
|
+
isActive={
|
|
340
|
+
scenes[to.index].key === this.props.navigator.currentRoute &&
|
|
341
|
+
isModalClosed(this.props.navigator)
|
|
342
|
+
}
|
|
330
343
|
key={scenes[to.index].key}
|
|
331
344
|
style={to.style}
|
|
332
345
|
overlayStyle={to.overlayStyle}
|
|
@@ -16,6 +16,13 @@ jest.mock("react-native-safe-area-context", () => ({
|
|
|
16
16
|
})),
|
|
17
17
|
}));
|
|
18
18
|
|
|
19
|
+
jest.mock(
|
|
20
|
+
"@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler",
|
|
21
|
+
() => ({
|
|
22
|
+
useScreenOrientationHandler: jest.fn(),
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
19
26
|
const { Scene } = require("../Scene");
|
|
20
27
|
|
|
21
28
|
const wrapper = shallow(
|
|
@@ -200,14 +200,31 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
200
200
|
videoModalState.mode === "MINIMIZED" &&
|
|
201
201
|
videoModalState.previousMode === "MAXIMIZED"
|
|
202
202
|
) {
|
|
203
|
-
|
|
203
|
+
// set animation to the minimize values if moving from the player to another screen
|
|
204
|
+
if (playerAnimationState === null) {
|
|
205
|
+
setScrollModalAnimatedValue(
|
|
206
|
+
translateYOffset,
|
|
207
|
+
modalSnapPoints[1],
|
|
208
|
+
setLastSnap
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
resetScrollAnimatedValues(
|
|
212
|
+
lastScrollY,
|
|
213
|
+
lastScrollYValue,
|
|
214
|
+
dragScrollY,
|
|
215
|
+
dragVideoPlayerY
|
|
216
|
+
);
|
|
217
|
+
} else {
|
|
218
|
+
resetPlayerAnimationState();
|
|
219
|
+
}
|
|
204
220
|
}
|
|
205
221
|
|
|
206
222
|
if (
|
|
207
223
|
(videoModalState.mode === "MAXIMIZED" &&
|
|
208
224
|
videoModalState.previousMode === "MINIMIZED" &&
|
|
209
225
|
previousItemId === videoModalState.item?.id) ||
|
|
210
|
-
previousItemId !== videoModalState.item?.id
|
|
226
|
+
(previousItemId !== videoModalState.item?.id &&
|
|
227
|
+
videoModalState.mode !== "FULLSCREEN")
|
|
211
228
|
) {
|
|
212
229
|
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
213
230
|
setTimeout(() => resetPlayerAnimationState());
|
|
@@ -60,7 +60,10 @@ export const AnimationView = ({
|
|
|
60
60
|
const {
|
|
61
61
|
width: screenWidth,
|
|
62
62
|
deviceInfo: { isTablet, isTabletLandscape },
|
|
63
|
-
} = useDimensions("window", {
|
|
63
|
+
} = useDimensions("window", {
|
|
64
|
+
deviceInfo: true,
|
|
65
|
+
updateForInactiveScreens: true,
|
|
66
|
+
});
|
|
64
67
|
|
|
65
68
|
const { videoModalState } = useNavigation();
|
|
66
69
|
const insets = useSafeAreaInsets();
|
|
@@ -301,13 +304,35 @@ export const AnimationView = ({
|
|
|
301
304
|
typeof additionalData.height === "number" && additionalData.height;
|
|
302
305
|
}
|
|
303
306
|
|
|
304
|
-
if (
|
|
307
|
+
if (
|
|
308
|
+
videoModalState.mode === "MAXIMIZED" &&
|
|
309
|
+
defaultValue.x !== screenWidth &&
|
|
310
|
+
width &&
|
|
311
|
+
height
|
|
312
|
+
) {
|
|
305
313
|
const value = { x: width, y: height };
|
|
306
314
|
setDefaultValue(value);
|
|
307
315
|
animatedValue.setValue(value);
|
|
308
316
|
}
|
|
309
317
|
}
|
|
310
|
-
}, [
|
|
318
|
+
}, [screenWidth]);
|
|
319
|
+
|
|
320
|
+
React.useEffect(() => {
|
|
321
|
+
if (
|
|
322
|
+
videoModalState.mode === "MINIMIZED" &&
|
|
323
|
+
videoModalState.previousMode === "MAXIMIZED"
|
|
324
|
+
) {
|
|
325
|
+
// set animation to the minimize values if moving from the player to another screen
|
|
326
|
+
if (playerAnimationState === null) {
|
|
327
|
+
const value = getAnimationValue(
|
|
328
|
+
animationType,
|
|
329
|
+
PlayerAnimationStateEnum.minimize
|
|
330
|
+
).toValue;
|
|
331
|
+
|
|
332
|
+
animatedValue.setValue(value);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}, [videoModalState]);
|
|
311
336
|
|
|
312
337
|
React.useEffect(() => {
|
|
313
338
|
if (
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
Animated,
|
|
6
|
+
Easing,
|
|
7
|
+
Dimensions,
|
|
8
|
+
} from "react-native";
|
|
3
9
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
4
10
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
5
11
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
12
|
|
|
13
|
+
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
14
|
+
|
|
7
15
|
type Configuration = {
|
|
8
16
|
[key: string]: any;
|
|
9
17
|
modal_background_color?: string;
|
|
@@ -15,6 +23,7 @@ type Props = {
|
|
|
15
23
|
configuration: Configuration;
|
|
16
24
|
isTabletLandscape: boolean;
|
|
17
25
|
isAudioPlayer?: boolean;
|
|
26
|
+
isTablet: boolean;
|
|
18
27
|
};
|
|
19
28
|
|
|
20
29
|
const containerStyle = ({
|
|
@@ -31,6 +40,7 @@ export const PlayerDetails = ({
|
|
|
31
40
|
configuration,
|
|
32
41
|
isTabletLandscape,
|
|
33
42
|
isAudioPlayer,
|
|
43
|
+
isTablet,
|
|
34
44
|
}: Props) => {
|
|
35
45
|
const screenData = useTargetScreenData(entry);
|
|
36
46
|
const insets = useSafeAreaInsets();
|
|
@@ -77,7 +87,11 @@ export const PlayerDetails = ({
|
|
|
77
87
|
transform: [{ translateY }],
|
|
78
88
|
opacity,
|
|
79
89
|
},
|
|
80
|
-
|
|
90
|
+
{
|
|
91
|
+
// workaround for avoid wrong text-height after going back to portrait rotation
|
|
92
|
+
// we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
|
|
93
|
+
width: isTablet ? undefined : SCREEN_WIDTH,
|
|
94
|
+
},
|
|
81
95
|
]}
|
|
82
96
|
>
|
|
83
97
|
{screenData && (
|