@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6944415045 → 13.0.0-alpha.7122212380
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.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +1 -1
- package/Components/Cell/Cell.tsx +7 -4
- package/Components/Cell/TvOSCellComponent.tsx +22 -20
- package/Components/Cell/index.js +1 -3
- package/Components/Focusable/FocusableTvOS.tsx +1 -5
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/FocusableList/index.tsx +9 -25
- package/Components/FocusableScrollView/index.tsx +12 -39
- package/Components/Layout/TV/NavBarContainer.tsx +7 -8
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -11
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/dataAdapter.ts +10 -3
- package/Components/MasterCell/utils/index.ts +21 -7
- package/Components/River/TV/index.tsx +1 -6
- package/Components/River/__tests__/componentsMap.test.js +14 -1
- package/Components/Tabs/Tab.tsx +6 -6
- package/Components/TextInputTv/index.tsx +2 -2
- package/Components/Transitioner/AnimationManager.js +8 -8
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +18 -16
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +7 -6
- package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerWrapper.tsx +16 -35
- package/Components/VideoModal/VideoModal.tsx +14 -23
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +1 -1
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +7 -3
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +5 -1
- package/Contexts/ScreenContext/index.tsx +3 -2
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +31 -1
- package/package.json +5 -5
- package/Contexts/ComponentsMapOffsetContext/index.tsx +0 -46
|
@@ -35,7 +35,6 @@ function retrieveData(entry, func, args) {
|
|
|
35
35
|
* @param {?[Object]} element.elements Optional array of nested elements to render within the current node
|
|
36
36
|
* @returns {Object} inflated configuration, ready to be rendered by the master cell's element mapper
|
|
37
37
|
*/
|
|
38
|
-
|
|
39
38
|
export function configInflater(
|
|
40
39
|
entry: any,
|
|
41
40
|
{
|
|
@@ -65,7 +64,7 @@ export function configInflater(
|
|
|
65
64
|
|
|
66
65
|
if (Array.isArray(elements)) {
|
|
67
66
|
adjustedElements = elements.map((element) =>
|
|
68
|
-
configInflater(entry, element
|
|
67
|
+
configInflater(entry, element)
|
|
69
68
|
);
|
|
70
69
|
}
|
|
71
70
|
|
|
@@ -77,6 +76,14 @@ export function configInflater(
|
|
|
77
76
|
};
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Memoized version of configInflater to cache results based on entry and masterCellConfig
|
|
81
|
+
*/
|
|
82
|
+
const memoizedConfigInflater = R.memoizeWith(
|
|
83
|
+
(entry, config) => `${entry.id}-${JSON.stringify(config)}`,
|
|
84
|
+
configInflater
|
|
85
|
+
);
|
|
86
|
+
|
|
80
87
|
/**
|
|
81
88
|
* Return the proper view tree according to entry's content type and UI state.
|
|
82
89
|
* Falls back to "default" content type or state.
|
|
@@ -97,7 +104,7 @@ function resolveElementsNode(entry, state, elements) {
|
|
|
97
104
|
export function defaultDataAdapter(elements) {
|
|
98
105
|
return function elementsBuilder({ entry, state = "default" }) {
|
|
99
106
|
return resolveElementsNode(entry, state, elements).map((element) =>
|
|
100
|
-
|
|
107
|
+
memoizedConfigInflater(entry, element)
|
|
101
108
|
);
|
|
102
109
|
};
|
|
103
110
|
}
|
|
@@ -78,13 +78,17 @@ export function resolveColor(entry, style) {
|
|
|
78
78
|
return style;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
const
|
|
81
|
+
// Iterate through style object keys and resolve any color properties
|
|
82
|
+
// non-color properties are passed through unchanged
|
|
83
|
+
const resolvedStyle = Object.keys(style).reduce((acc, key) => {
|
|
84
|
+
if (key.includes("color") || key.includes("Color")) {
|
|
85
|
+
return { ...acc, ...resolveColorForProp(entry, acc, key) };
|
|
86
|
+
}
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
return { ...style, ...resolveColorForProp(entry, acc, value) };
|
|
88
|
+
return acc;
|
|
87
89
|
}, style);
|
|
90
|
+
|
|
91
|
+
return resolvedStyle;
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
export function isVideoPreviewEnabled({
|
|
@@ -103,7 +107,7 @@ export const useFilterChildren = <
|
|
|
103
107
|
item: any;
|
|
104
108
|
pluginIdentifier: string;
|
|
105
109
|
};
|
|
106
|
-
}
|
|
110
|
+
},
|
|
107
111
|
>(
|
|
108
112
|
children: T[]
|
|
109
113
|
): T[] => {
|
|
@@ -339,13 +343,23 @@ export const useCellState = ({
|
|
|
339
343
|
return getCellState({ focused, selected: _isSelected });
|
|
340
344
|
};
|
|
341
345
|
|
|
346
|
+
const cache = new Map<string, any>();
|
|
347
|
+
|
|
342
348
|
export const hasFocusableInsideBuilder = (elementsBuilder) => (item) => {
|
|
343
349
|
const elements = elementsBuilder({ entry: item });
|
|
344
350
|
|
|
345
|
-
|
|
351
|
+
if (cache.has(item.id)) {
|
|
352
|
+
return cache.get(item.id);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const result = R.anyPass([
|
|
346
356
|
hasElementsSpecificViewType("ButtonContainerView"),
|
|
347
357
|
hasElementsSpecificViewType("FocusableView"),
|
|
348
358
|
])(elements);
|
|
359
|
+
|
|
360
|
+
cache.set(item.id, result);
|
|
361
|
+
|
|
362
|
+
return result;
|
|
349
363
|
};
|
|
350
364
|
|
|
351
365
|
export function getEntryState(state, selected) {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { compose } from "ramda";
|
|
2
1
|
import { River as RiverComponent } from "./River";
|
|
3
2
|
import { withTvEventHandler } from "./withTVEventHandler";
|
|
4
|
-
import { withComponentsMapOffsetContext } from "../../../Contexts/ComponentsMapOffsetContext";
|
|
5
3
|
|
|
6
|
-
export const River =
|
|
7
|
-
withTvEventHandler,
|
|
8
|
-
withComponentsMapOffsetContext
|
|
9
|
-
)(RiverComponent);
|
|
4
|
+
export const River = withTvEventHandler(RiverComponent);
|
|
@@ -81,6 +81,13 @@ const mockScreenData = {
|
|
|
81
81
|
id: "A1234",
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
jest.mock("@applicaster/zapp-react-native-redux/AppStore", () => ({
|
|
85
|
+
appStore: {
|
|
86
|
+
get: jest.fn((prop) => mockStore[prop]),
|
|
87
|
+
getState: jest.fn(),
|
|
88
|
+
},
|
|
89
|
+
}));
|
|
90
|
+
|
|
84
91
|
jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
|
|
85
92
|
useIsRTL: jest.fn(() => mock_rtl_flag),
|
|
86
93
|
}));
|
|
@@ -153,7 +160,13 @@ const plugins = [];
|
|
|
153
160
|
const navigation = {};
|
|
154
161
|
|
|
155
162
|
const props = { components, cellStyles, riverComponents, navigation };
|
|
156
|
-
|
|
163
|
+
|
|
164
|
+
const store = mockStore({
|
|
165
|
+
components,
|
|
166
|
+
cellStyles,
|
|
167
|
+
plugins,
|
|
168
|
+
getState: jest.fn(),
|
|
169
|
+
});
|
|
157
170
|
|
|
158
171
|
jest.useFakeTimers();
|
|
159
172
|
|
package/Components/Tabs/Tab.tsx
CHANGED
|
@@ -69,8 +69,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
69
69
|
? tab_cell_background_color_selected_active
|
|
70
70
|
: tab_cell_background_color_selected_default
|
|
71
71
|
: focused
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
? tab_cell_background_color_active
|
|
73
|
+
: tab_cell_background_color_default,
|
|
74
74
|
justifyContent: "center",
|
|
75
75
|
alignItems: "center",
|
|
76
76
|
position: "relative",
|
|
@@ -85,8 +85,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
85
85
|
? tab_cell_border_color_active_focused
|
|
86
86
|
: tab_cell_border_color_active
|
|
87
87
|
: focused
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
? tab_cell_border_color_default_focused
|
|
89
|
+
: tab_cell_border_color_default,
|
|
90
90
|
},
|
|
91
91
|
label: {
|
|
92
92
|
fontFamily: text_label_font_family,
|
|
@@ -98,8 +98,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
98
98
|
? text_label_selected_active_font_color
|
|
99
99
|
: text_label_selected_default_font_color
|
|
100
100
|
: focused
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
? text_label_active_font_color
|
|
102
|
+
: text_label_default_font_color,
|
|
103
103
|
},
|
|
104
104
|
underline: {
|
|
105
105
|
position: "absolute",
|
|
@@ -3,19 +3,19 @@ import { Animated } from "react-native";
|
|
|
3
3
|
import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
|
|
4
4
|
|
|
5
5
|
type TransitionConfig = {
|
|
6
|
-
duration: number
|
|
7
|
-
easing: any
|
|
6
|
+
duration: number;
|
|
7
|
+
easing: any;
|
|
8
8
|
from: {
|
|
9
|
-
style: any
|
|
10
|
-
}
|
|
9
|
+
style: any;
|
|
10
|
+
};
|
|
11
11
|
to: {
|
|
12
|
-
style: any
|
|
13
|
-
}
|
|
12
|
+
style: any;
|
|
13
|
+
};
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
type Props = {
|
|
17
|
-
transitionConfig: TransitionConfig
|
|
18
|
-
contentStyle: { [string]: any }
|
|
17
|
+
transitionConfig: TransitionConfig;
|
|
18
|
+
contentStyle: { [string]: any };
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -8,6 +8,8 @@ import { loggerLiveImageManager } from "./loggerHelper";
|
|
|
8
8
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
9
9
|
import { Component } from "react";
|
|
10
10
|
|
|
11
|
+
const TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION = 500; // ms
|
|
12
|
+
|
|
11
13
|
const { log_debug, log_info, log_error } = loggerLiveImageManager;
|
|
12
14
|
|
|
13
15
|
export type LiveImageManagerEvent =
|
|
@@ -62,6 +64,9 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
62
64
|
protected currentlyPlaying: LiveImage | null = null;
|
|
63
65
|
protected primaryPlayer: Player | null = null;
|
|
64
66
|
|
|
67
|
+
private checkPlayerPositionTimeout: ReturnType<typeof setTimeout> | null =
|
|
68
|
+
null;
|
|
69
|
+
|
|
65
70
|
protected listeners: Record<
|
|
66
71
|
string,
|
|
67
72
|
Record<LiveImageManagerEvent, (event?: Record<string, any>) => void>
|
|
@@ -118,6 +123,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
118
123
|
});
|
|
119
124
|
};
|
|
120
125
|
|
|
126
|
+
private cancelCheckPlayerPositionTimeout = () => {
|
|
127
|
+
clearTimeout(this.checkPlayerPositionTimeout);
|
|
128
|
+
this.checkPlayerPositionTimeout = null;
|
|
129
|
+
};
|
|
130
|
+
|
|
121
131
|
public onViewportEnter = (item: LiveImage) => {
|
|
122
132
|
log_debug(
|
|
123
133
|
`onViewportEnter: live-image ${playerInfo(
|
|
@@ -125,7 +135,21 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
125
135
|
)}, primary ${playerInfo(this.primaryPlayer)}`
|
|
126
136
|
);
|
|
127
137
|
|
|
128
|
-
|
|
138
|
+
if (!isTV()) {
|
|
139
|
+
// mobile only
|
|
140
|
+
// we have to delay running checkPlayerPosition, because sometimes on fast scrolling we get wrong order onEnter, then onLeave.
|
|
141
|
+
// which could cause select wrong item to play
|
|
142
|
+
|
|
143
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
144
|
+
|
|
145
|
+
this.checkPlayerPositionTimeout = setTimeout(() => {
|
|
146
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
147
|
+
|
|
148
|
+
this.checkPlayerPosition(item);
|
|
149
|
+
}, TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION);
|
|
150
|
+
} else {
|
|
151
|
+
this.checkPlayerPosition(item);
|
|
152
|
+
}
|
|
129
153
|
};
|
|
130
154
|
|
|
131
155
|
public onViewportLeave = (item: LiveImage) => {
|
|
@@ -246,6 +270,8 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
246
270
|
};
|
|
247
271
|
|
|
248
272
|
public checkPlayerPosition = (item: LiveImage) => {
|
|
273
|
+
this.cancelCheckPlayerPositionTimeout();
|
|
274
|
+
|
|
249
275
|
log_debug(
|
|
250
276
|
`checkPlayerPosition: live-image playerId: ${playerInfo(
|
|
251
277
|
item.player
|
|
@@ -244,25 +244,27 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
244
244
|
}, [item.id]);
|
|
245
245
|
|
|
246
246
|
React.useEffect(() => {
|
|
247
|
-
if (playerManager) {
|
|
248
|
-
|
|
247
|
+
if (isMeasurement(item) || !playerManager) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
249
250
|
|
|
250
|
-
|
|
251
|
-
log_error(
|
|
252
|
-
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
253
|
-
);
|
|
254
|
-
} else {
|
|
255
|
-
playerManager.registerPlayer({
|
|
256
|
-
id: playerId,
|
|
257
|
-
playerController: controller,
|
|
258
|
-
});
|
|
251
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
|
|
259
252
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
253
|
+
if (isPlayerRegistered) {
|
|
254
|
+
log_error(
|
|
255
|
+
`PlayerLiveImageComponent: player ${playerId} already registered`
|
|
256
|
+
);
|
|
257
|
+
} else {
|
|
258
|
+
playerManager.registerPlayer({
|
|
259
|
+
id: playerId,
|
|
260
|
+
playerController: controller,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
return () => {
|
|
264
|
+
playerManager.unregisterPlayer(playerId);
|
|
265
|
+
};
|
|
264
266
|
}
|
|
265
|
-
}, [liveImageItem, playerId, controller]);
|
|
267
|
+
}, [liveImageItem, playerId, controller, item.id]);
|
|
266
268
|
|
|
267
269
|
const onPositionUpdated = React.useCallback(
|
|
268
270
|
(data) => {
|
|
@@ -4,6 +4,7 @@ import { render } from "@testing-library/react-native";
|
|
|
4
4
|
import * as PlayerFactory from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerFactory";
|
|
5
5
|
import { ThemeContext } from "@applicaster/zapp-react-native-utils/theme";
|
|
6
6
|
import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
7
|
+
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
7
8
|
|
|
8
9
|
import { PlayerLiveImage } from "../PlayerLiveImageComponent";
|
|
9
10
|
import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
@@ -32,7 +33,7 @@ const mockStore = configureStore();
|
|
|
32
33
|
|
|
33
34
|
const store = mockStore({ appData: {} });
|
|
34
35
|
|
|
35
|
-
const Wrapper = ({ children }: { children: React.
|
|
36
|
+
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
36
37
|
/* @ts-ignore */
|
|
37
38
|
<Provider store={store}>
|
|
38
39
|
<ThemeContext.Provider
|
|
@@ -118,4 +119,53 @@ describe("PlayerLiveImageComponent", () => {
|
|
|
118
119
|
|
|
119
120
|
// TODO: implement this test
|
|
120
121
|
});
|
|
122
|
+
|
|
123
|
+
it("should register the player for normal item", () => {
|
|
124
|
+
render(
|
|
125
|
+
<Wrapper>
|
|
126
|
+
<PlayerLiveImage {...defaultProps} />
|
|
127
|
+
</Wrapper>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
131
|
+
defaultProps.playerId
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
expect(isPlayerRegistered).toBe(true);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("should unregister the player for normal item", () => {
|
|
138
|
+
const component = render(
|
|
139
|
+
<Wrapper>
|
|
140
|
+
<PlayerLiveImage {...defaultProps} />
|
|
141
|
+
</Wrapper>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
component.unmount();
|
|
145
|
+
|
|
146
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(
|
|
147
|
+
defaultProps.playerId
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(isPlayerRegistered).toBe(false);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("should not register the player for 'pre-measurement' item", () => {
|
|
154
|
+
const props = {
|
|
155
|
+
...defaultProps,
|
|
156
|
+
item: {
|
|
157
|
+
...defaultProps.item,
|
|
158
|
+
id: "pre-measurement-1",
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
render(
|
|
163
|
+
<Wrapper>
|
|
164
|
+
<PlayerLiveImage {...props} />
|
|
165
|
+
</Wrapper>
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const isPlayerRegistered = playerManager.isPlayerRegistered(props.playerId);
|
|
169
|
+
expect(isPlayerRegistered).toBe(false);
|
|
170
|
+
});
|
|
121
171
|
});
|
|
@@ -100,10 +100,11 @@ export const AnimationView = ({
|
|
|
100
100
|
const moveUpValue = additionalData.saveArea
|
|
101
101
|
? -insets.top + (isAudioItem ? 0 : progressBarHeight)
|
|
102
102
|
: isTablet
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
? isTabletLandscape &&
|
|
104
|
+
(!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
105
|
+
? -tabletLandscapePlayerTopPosition + progressBarHeight
|
|
106
|
+
: -130
|
|
107
|
+
: -50 + progressBarHeight;
|
|
107
108
|
|
|
108
109
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
109
110
|
? isRTL
|
|
@@ -434,8 +435,8 @@ export const AnimationComponent = (props: Props) => {
|
|
|
434
435
|
const Component = useAnimation
|
|
435
436
|
? AnimationView
|
|
436
437
|
: style
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
? View
|
|
439
|
+
: React.Fragment;
|
|
439
440
|
|
|
440
441
|
if (
|
|
441
442
|
additionalData.extraAnimation &&
|
|
@@ -108,8 +108,8 @@ export const calculateAnimationValue = (animationType, dragPosition, data) => {
|
|
|
108
108
|
: { forWidth: 3, forHeight: 3 }
|
|
109
109
|
: { forWidth: 2, forHeight: 2 }
|
|
110
110
|
: isTabletLandscape
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
? { forWidth: 8, forHeight: 6.5 }
|
|
112
|
+
: { forWidth: 3.5, forHeight: 2 };
|
|
113
113
|
|
|
114
114
|
const minWidth =
|
|
115
115
|
isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
|
+
|
|
6
|
+
import { Spinner } from "../Spinner";
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
...StyleSheet.absoluteFillObject,
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const OpaqueLayer = () => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View
|
|
21
|
+
style={[
|
|
22
|
+
styles.container,
|
|
23
|
+
{
|
|
24
|
+
// we assume that it's non-transparent and we could show spinner always until it will be covered by player
|
|
25
|
+
// this spinner hides all content under modal
|
|
26
|
+
backgroundColor: theme?.app_background_color,
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
>
|
|
30
|
+
<Spinner />
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -10,7 +10,8 @@ import { Edge, SafeAreaView } from "react-native-safe-area-context";
|
|
|
10
10
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
11
11
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { PlayerDetails } from "./PlayerDetails";
|
|
13
|
-
import {
|
|
13
|
+
import { playerDimensionsHack } from "./utils";
|
|
14
|
+
import { useDelayedPlayerDetails } from "./hooks";
|
|
14
15
|
|
|
15
16
|
import {
|
|
16
17
|
AnimatedScrollModal,
|
|
@@ -121,34 +122,6 @@ const getTabletWidth = (
|
|
|
121
122
|
return Number(width) - sidebarWidth;
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
const showDetails = (
|
|
125
|
-
isMobile: boolean,
|
|
126
|
-
docked: boolean,
|
|
127
|
-
isInlineModal,
|
|
128
|
-
pip
|
|
129
|
-
): boolean => {
|
|
130
|
-
if (pip) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (!isInlineModal) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// for mobile we always show details. Mounting of it very heavy operation.
|
|
139
|
-
if (isMobile) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
|
|
144
|
-
// FIXME - find out the reason of dissapearing of content
|
|
145
|
-
if (docked) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return true;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
125
|
const PlayerWrapperComponent = (props: Props) => {
|
|
153
126
|
const {
|
|
154
127
|
entry,
|
|
@@ -167,7 +140,15 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
167
140
|
|
|
168
141
|
const isInlineModal = inline && isModal;
|
|
169
142
|
|
|
170
|
-
//
|
|
143
|
+
// Mounting the PlayerDetails component is a resource-intensive process.
|
|
144
|
+
// Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
|
|
145
|
+
// The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
|
|
146
|
+
// This helps to avoid blocking the rotation and any animations related to the rotation.
|
|
147
|
+
const isShowPlayerDetails = useDelayedPlayerDetails({
|
|
148
|
+
isInline: isInlineModal,
|
|
149
|
+
isDocked: docked,
|
|
150
|
+
isPip: pip,
|
|
151
|
+
});
|
|
171
152
|
|
|
172
153
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
173
154
|
|
|
@@ -203,8 +184,8 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
203
184
|
const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
|
|
204
185
|
|
|
205
186
|
const childrenStyles = React.useMemo(
|
|
206
|
-
() => ({ ...playerDimensions, ...
|
|
207
|
-
[containerDimensions,
|
|
187
|
+
() => ({ ...playerDimensions, ...playerDimensionsHack }),
|
|
188
|
+
[containerDimensions, playerDimensionsHack]
|
|
208
189
|
);
|
|
209
190
|
|
|
210
191
|
return (
|
|
@@ -213,7 +194,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
213
194
|
style={[
|
|
214
195
|
safeAreaStyles(configuration, isTablet),
|
|
215
196
|
style,
|
|
216
|
-
|
|
197
|
+
playerDimensionsHack,
|
|
217
198
|
]}
|
|
218
199
|
>
|
|
219
200
|
<AnimationComponent
|
|
@@ -227,7 +208,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
227
208
|
defaultStyles.playerContainer,
|
|
228
209
|
containerDimensions,
|
|
229
210
|
containerStyle,
|
|
230
|
-
|
|
211
|
+
playerDimensionsHack,
|
|
231
212
|
]}
|
|
232
213
|
>
|
|
233
214
|
<AnimationComponent
|
|
@@ -246,7 +227,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
246
227
|
</View>
|
|
247
228
|
|
|
248
229
|
<AnimatedScrollModal>
|
|
249
|
-
{
|
|
230
|
+
{isShowPlayerDetails && (
|
|
250
231
|
<AnimationComponent
|
|
251
232
|
animationType={ComponentAnimationType.componentFade}
|
|
252
233
|
style={defaultStyles.flex}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import { StyleSheet,
|
|
2
|
+
import { equals } from "ramda";
|
|
3
|
+
import { StyleSheet, StatusBar } from "react-native";
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
@@ -17,17 +17,20 @@ import {
|
|
|
17
17
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
|
|
18
18
|
|
|
19
19
|
import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
import {
|
|
21
|
+
useModalSize,
|
|
22
|
+
useBackgroundColor,
|
|
23
|
+
useInitialPlayerState,
|
|
24
|
+
} from "./hooks";
|
|
25
|
+
|
|
23
26
|
import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
|
|
24
|
-
import { Spinner } from "../Spinner";
|
|
25
27
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
26
28
|
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
|
|
27
29
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
28
30
|
import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
29
31
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
30
32
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
33
|
+
import { OpaqueLayer } from "./OpaqueLayer";
|
|
31
34
|
|
|
32
35
|
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
33
36
|
|
|
@@ -39,17 +42,6 @@ const styles = StyleSheet.create({
|
|
|
39
42
|
bottom: 0,
|
|
40
43
|
position: "absolute",
|
|
41
44
|
},
|
|
42
|
-
// eslint-disable-next-line react-native/no-color-literals
|
|
43
|
-
loaderContainer: {
|
|
44
|
-
top: 0,
|
|
45
|
-
left: 0,
|
|
46
|
-
right: 0,
|
|
47
|
-
bottom: 0,
|
|
48
|
-
position: "absolute",
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
justifyContent: "center",
|
|
51
|
-
backgroundColor: "rgba(64,64,64,.5)",
|
|
52
|
-
},
|
|
53
45
|
});
|
|
54
46
|
|
|
55
47
|
const VideoModalComponent = () => {
|
|
@@ -100,7 +92,7 @@ const VideoModalComponent = () => {
|
|
|
100
92
|
|
|
101
93
|
const onHooksSuccess = ({ payload }) => {
|
|
102
94
|
// set new modified entry
|
|
103
|
-
if (!
|
|
95
|
+
if (!equals(payload, item)) {
|
|
104
96
|
onVideoModalHookSuccessAnalyticsEvent();
|
|
105
97
|
setVideoModalItem(payload);
|
|
106
98
|
}
|
|
@@ -136,7 +128,10 @@ const VideoModalComponent = () => {
|
|
|
136
128
|
|
|
137
129
|
<PathnameContext.Provider value={pathname}>
|
|
138
130
|
<ScreenContextProvider pathname={pathname}>
|
|
139
|
-
{
|
|
131
|
+
{/* Hide content underneath when we switch to next video in fullscreen mode */}
|
|
132
|
+
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
133
|
+
|
|
134
|
+
{itemIdHooksFinished === item?.id && (
|
|
140
135
|
<AnimatedPlayerModalWrapper
|
|
141
136
|
style={[
|
|
142
137
|
styles.container,
|
|
@@ -153,10 +148,6 @@ const VideoModalComponent = () => {
|
|
|
153
148
|
mode={mode}
|
|
154
149
|
/>
|
|
155
150
|
</AnimatedPlayerModalWrapper>
|
|
156
|
-
) : (
|
|
157
|
-
<View style={styles.loaderContainer}>
|
|
158
|
-
<Spinner />
|
|
159
|
-
</View>
|
|
160
151
|
)}
|
|
161
152
|
</ScreenContextProvider>
|
|
162
153
|
</PathnameContext.Provider>
|
|
@@ -62,7 +62,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
|
62
62
|
})),
|
|
63
63
|
}));
|
|
64
64
|
|
|
65
|
-
jest.mock("../utils", () => ({
|
|
65
|
+
jest.mock("../utils", () => ({ playerDimensionsHack: {} }));
|
|
66
66
|
|
|
67
67
|
const { PlayerWrapper } = require("../PlayerWrapper");
|
|
68
68
|
|