@applicaster/zapp-react-native-ui-components 13.0.0-rc.99 → 14.0.0-alpha.1235043154
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 +5 -3
- package/Components/AudioPlayer/index.tsx +15 -0
- package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
- package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -2
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/tv/Artwork.tsx +40 -0
- package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +37 -79
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +2 -1
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +12 -9
- package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +12 -9
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +9 -4
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -1
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -1
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -6
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +14 -70
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/Focusable/FocusableTvOS.tsx +3 -3
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -2
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -8
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
- package/Components/MasterCell/elementMapper.tsx +1 -2
- package/Components/ModalComponent/BottomSheetModalContent.tsx +32 -46
- package/Components/ModalComponent/Button/index.tsx +25 -29
- package/Components/ModalComponent/Header/index.tsx +9 -8
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +26 -43
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +7 -4
- package/Components/River/RiverItem.tsx +8 -4
- package/Components/River/TV/River.tsx +0 -3
- package/Components/River/TV/withTVEventHandler.tsx +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +3 -1
- package/Components/RouteManager/TestId.tsx +1 -5
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +0 -1
- package/Components/RouteManager/__tests__/testId.test.js +0 -4
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/__tests__/Screen.test.tsx +22 -14
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
- package/Components/VideoLive/animationUtils.ts +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -2
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +3 -9
- package/Components/VideoModal/PlayerWrapper.tsx +9 -19
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +60 -0
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/index.d.ts +0 -1
- package/package.json +5 -7
- package/Components/AudioPlayer/Artwork.tsx +0 -35
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- package/Decorators/Navigator/__tests__/react-router-native-mock.js +0 -11
- package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
|
@@ -6,15 +6,21 @@ exports[`<Scene /> renders correctly 1`] = `
|
|
|
6
6
|
collapsable={false}
|
|
7
7
|
pointerEvents="auto"
|
|
8
8
|
style={
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
[
|
|
10
|
+
{
|
|
11
|
+
"flex": 1,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"paddingBottom": 49,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"fontScale": 2,
|
|
18
|
+
"height": 1334,
|
|
19
|
+
"scale": 2,
|
|
20
|
+
"statusBarHeight": null,
|
|
21
|
+
"width": 750,
|
|
22
|
+
},
|
|
23
|
+
]
|
|
18
24
|
}
|
|
19
25
|
/>
|
|
20
26
|
</View>
|
|
@@ -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<number>
|
|
5
|
+
| [{ [Key: string]: Animated.AnimatedInterpolation<number> }];
|
|
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<number> =>
|
|
35
35
|
animatedValue.interpolate({
|
|
36
36
|
inputRange: [0, 1],
|
|
37
37
|
outputRange: [from, to],
|
|
@@ -94,7 +94,7 @@ export const AnimationView = ({
|
|
|
94
94
|
const isAudioItem = React.useMemo(
|
|
95
95
|
() =>
|
|
96
96
|
videoModalItem?.content?.type?.includes?.("audio") ||
|
|
97
|
-
videoModalItem?.type?.value
|
|
97
|
+
videoModalItem?.type?.value?.includes?.("audio"),
|
|
98
98
|
[videoModalItem]
|
|
99
99
|
);
|
|
100
100
|
|
|
@@ -107,7 +107,6 @@ export const AnimationView = ({
|
|
|
107
107
|
progressBarHeight,
|
|
108
108
|
isTablet,
|
|
109
109
|
isTabletLandscape,
|
|
110
|
-
inlineAudioPlayer,
|
|
111
110
|
tabletLandscapePlayerTopPosition,
|
|
112
111
|
});
|
|
113
112
|
|
|
@@ -309,7 +309,6 @@ export const getMoveUpValue = ({
|
|
|
309
309
|
progressBarHeight,
|
|
310
310
|
isTablet,
|
|
311
311
|
isTabletLandscape,
|
|
312
|
-
inlineAudioPlayer,
|
|
313
312
|
tabletLandscapePlayerTopPosition,
|
|
314
313
|
}) => {
|
|
315
314
|
if (additionalData.saveArea) {
|
|
@@ -322,17 +321,12 @@ export const getMoveUpValue = ({
|
|
|
322
321
|
}
|
|
323
322
|
|
|
324
323
|
if (isTablet) {
|
|
325
|
-
if (
|
|
326
|
-
isTabletLandscape &&
|
|
327
|
-
(!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
328
|
-
) {
|
|
324
|
+
if (isTabletLandscape) {
|
|
329
325
|
return -tabletLandscapePlayerTopPosition + progressBarHeight;
|
|
326
|
+
} else {
|
|
327
|
+
return -130;
|
|
330
328
|
}
|
|
331
|
-
|
|
332
|
-
// for audioPlayer(tablet/isTabletPortrait) in docked mode
|
|
333
|
-
return -130;
|
|
334
329
|
}
|
|
335
330
|
|
|
336
|
-
// for audioPlayer(mobile) in docked mode
|
|
337
331
|
return -50 + progressBarHeight;
|
|
338
332
|
};
|
|
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
|
|
|
74
74
|
return longEdge / shortEdge;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const safeAreaStyles = (
|
|
78
|
-
configuration: Configuration,
|
|
79
|
-
isTablet: boolean
|
|
80
|
-
): ViewStyle => {
|
|
81
|
-
const tablet_landscape_player_container_background_color =
|
|
82
|
-
configuration?.tablet_landscape_player_container_background_color;
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
backgroundColor: isTablet
|
|
86
|
-
? tablet_landscape_player_container_background_color
|
|
87
|
-
: "transparent",
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
77
|
const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
92
78
|
if (isTablet) {
|
|
93
79
|
return ["top"];
|
|
@@ -156,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
156
142
|
children,
|
|
157
143
|
isTabletPortrait,
|
|
158
144
|
configuration,
|
|
145
|
+
fullscreen,
|
|
159
146
|
pip,
|
|
160
147
|
} = props;
|
|
161
148
|
|
|
@@ -211,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
211
198
|
[containerDimensions, playerDimensionsHack]
|
|
212
199
|
);
|
|
213
200
|
|
|
201
|
+
const wrapperViewStyle: ViewStyle = {
|
|
202
|
+
backgroundColor:
|
|
203
|
+
isTablet && !fullscreen
|
|
204
|
+
? configuration?.tablet_landscape_player_container_background_color
|
|
205
|
+
: "transparent",
|
|
206
|
+
};
|
|
207
|
+
|
|
214
208
|
return (
|
|
215
209
|
<WrapperView
|
|
216
210
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
217
|
-
style={[
|
|
218
|
-
safeAreaStyles(configuration, isTablet),
|
|
219
|
-
style,
|
|
220
|
-
playerDimensionsHack,
|
|
221
|
-
]}
|
|
211
|
+
style={[wrapperViewStyle, style, playerDimensionsHack]}
|
|
222
212
|
>
|
|
223
213
|
<AnimationComponent
|
|
224
214
|
animationType={ComponentAnimationType.moveUpComponent}
|
|
@@ -71,6 +71,36 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
71
71
|
}
|
|
72
72
|
testID="test-player-container"
|
|
73
73
|
/>
|
|
74
|
+
<View
|
|
75
|
+
animationType="componentFade"
|
|
76
|
+
style={
|
|
77
|
+
{
|
|
78
|
+
"flex": 1,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
<View
|
|
83
|
+
configuration={
|
|
84
|
+
{
|
|
85
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
86
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
entry={
|
|
90
|
+
{
|
|
91
|
+
"id": "test",
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
isTablet={false}
|
|
95
|
+
isTabletLandscape={false}
|
|
96
|
+
style={
|
|
97
|
+
{
|
|
98
|
+
"flex": 1,
|
|
99
|
+
"paddingTop": 20,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
</View>
|
|
74
104
|
</View>
|
|
75
105
|
</RNCSafeAreaView>
|
|
76
106
|
</RNCSafeAreaProvider>
|
|
@@ -239,6 +269,36 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
239
269
|
}
|
|
240
270
|
/>
|
|
241
271
|
</View>
|
|
272
|
+
<View
|
|
273
|
+
animationType="componentFade"
|
|
274
|
+
style={
|
|
275
|
+
{
|
|
276
|
+
"flex": 1,
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
>
|
|
280
|
+
<View
|
|
281
|
+
configuration={
|
|
282
|
+
{
|
|
283
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
284
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
entry={
|
|
288
|
+
{
|
|
289
|
+
"id": "test",
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
isTablet={true}
|
|
293
|
+
isTabletLandscape={true}
|
|
294
|
+
style={
|
|
295
|
+
{
|
|
296
|
+
"flex": 1,
|
|
297
|
+
"paddingTop": 20,
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/>
|
|
301
|
+
</View>
|
|
242
302
|
</View>
|
|
243
303
|
</RNCSafeAreaView>
|
|
244
304
|
</RNCSafeAreaProvider>
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react-hooks";
|
|
2
2
|
import { useDelayedPlayerDetails } from "../useDelayedPlayerDetails";
|
|
3
|
-
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
4
|
-
import { showDetails } from "../utils";
|
|
5
3
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
4
|
|
|
7
|
-
jest.mock("@applicaster/zapp-react-native-utils/idleUtils", () => ({
|
|
8
|
-
withTimeout$: jest.fn(),
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
jest.mock("../utils", () => ({
|
|
12
|
-
showDetails: jest.fn(),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
5
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
16
|
-
useIsTablet: jest.fn(),
|
|
6
|
+
useIsTablet: jest.fn().mockReturnValue(false),
|
|
17
7
|
}));
|
|
18
8
|
|
|
19
9
|
describe("useDelayedPlayerDetails", () => {
|
|
@@ -21,69 +11,41 @@ describe("useDelayedPlayerDetails", () => {
|
|
|
21
11
|
jest.clearAllMocks();
|
|
22
12
|
});
|
|
23
13
|
|
|
24
|
-
it("should return
|
|
25
|
-
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
26
|
-
subscribe: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }),
|
|
27
|
-
});
|
|
28
|
-
|
|
14
|
+
it("should return true initially", () => {
|
|
29
15
|
const { result } = renderHook(() =>
|
|
30
16
|
useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
|
|
31
17
|
);
|
|
32
18
|
|
|
33
|
-
expect(result.current).toBe(
|
|
19
|
+
expect(result.current).toBe(true);
|
|
34
20
|
});
|
|
35
21
|
|
|
36
|
-
it("should return
|
|
37
|
-
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
38
|
-
subscribe: (callback) => {
|
|
39
|
-
callback.next();
|
|
40
|
-
|
|
41
|
-
return { unsubscribe: jest.fn() };
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
(showDetails as jest.Mock).mockReturnValue(true);
|
|
46
|
-
(useIsTablet as jest.Mock).mockReturnValue(false);
|
|
47
|
-
|
|
22
|
+
it("should return false when isPip is true", () => {
|
|
48
23
|
const { result } = renderHook(() =>
|
|
49
|
-
useDelayedPlayerDetails({ isInline: true, isDocked:
|
|
24
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: true, isPip: true })
|
|
50
25
|
);
|
|
51
26
|
|
|
52
|
-
expect(result.current).toBe(
|
|
27
|
+
expect(result.current).toBe(false);
|
|
53
28
|
});
|
|
54
29
|
|
|
55
|
-
it("should return false
|
|
56
|
-
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
57
|
-
subscribe: (callback) => {
|
|
58
|
-
callback.next();
|
|
59
|
-
|
|
60
|
-
return { unsubscribe: jest.fn() };
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
(showDetails as jest.Mock).mockReturnValue(false);
|
|
65
|
-
(useIsTablet as jest.Mock).mockReturnValue(false);
|
|
66
|
-
|
|
30
|
+
it("should return false when isDocked is true", () => {
|
|
67
31
|
const { result } = renderHook(() =>
|
|
68
|
-
useDelayedPlayerDetails({ isInline: true, isDocked:
|
|
32
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: true, isPip: false })
|
|
69
33
|
);
|
|
70
34
|
|
|
71
35
|
expect(result.current).toBe(false);
|
|
72
36
|
});
|
|
73
37
|
|
|
74
|
-
it("should
|
|
75
|
-
|
|
38
|
+
it("should return true for tablet regardless of other flags", () => {
|
|
39
|
+
(useIsTablet as jest.Mock).mockReturnValue(true);
|
|
76
40
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
41
|
+
const { result } = renderHook(() =>
|
|
42
|
+
useDelayedPlayerDetails({
|
|
43
|
+
isInline: false,
|
|
44
|
+
isDocked: false,
|
|
45
|
+
isPip: false,
|
|
46
|
+
})
|
|
83
47
|
);
|
|
84
48
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
expect(unsubscribeMock).toHaveBeenCalled();
|
|
49
|
+
expect(result.current).toBe(true);
|
|
88
50
|
});
|
|
89
51
|
});
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
3
|
-
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
4
2
|
|
|
5
3
|
import { showDetails } from "./utils";
|
|
6
4
|
|
|
7
|
-
const TIMEOUT = 100; // ms
|
|
8
|
-
|
|
9
5
|
type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
|
|
10
6
|
|
|
7
|
+
const showPlayerDetails = (
|
|
8
|
+
isInline: boolean,
|
|
9
|
+
isDocked: boolean,
|
|
10
|
+
isPip: boolean,
|
|
11
|
+
isTablet: boolean
|
|
12
|
+
) => {
|
|
13
|
+
return showDetails({
|
|
14
|
+
isMobile: !isTablet,
|
|
15
|
+
isInline,
|
|
16
|
+
isDocked,
|
|
17
|
+
isPip,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
11
21
|
/**
|
|
12
22
|
* Custom hook to determine whether to show player details with a delay.
|
|
13
23
|
*
|
|
@@ -22,28 +32,7 @@ export const useDelayedPlayerDetails = ({
|
|
|
22
32
|
isDocked,
|
|
23
33
|
isPip,
|
|
24
34
|
}: Props): boolean => {
|
|
25
|
-
const [shouldShowDetails, setShouldShowDetails] = React.useState(false);
|
|
26
|
-
|
|
27
35
|
const isTablet = useIsTablet();
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
const subscription = withTimeout$(TIMEOUT).subscribe({
|
|
31
|
-
next: () => {
|
|
32
|
-
setShouldShowDetails(() => {
|
|
33
|
-
return showDetails({
|
|
34
|
-
isMobile: !isTablet,
|
|
35
|
-
isInline,
|
|
36
|
-
isDocked,
|
|
37
|
-
isPip,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return () => {
|
|
44
|
-
subscription.unsubscribe();
|
|
45
|
-
};
|
|
46
|
-
}, [isDocked, isTablet, isInline, isPip]);
|
|
47
|
-
|
|
48
|
-
return shouldShowDetails;
|
|
37
|
+
return showPlayerDetails(isInline, isDocked, isPip, isTablet);
|
|
49
38
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import { act,
|
|
5
|
+
import { act, render } from "@testing-library/react-native";
|
|
6
6
|
|
|
7
7
|
import { ViewportAware } from "../";
|
|
8
8
|
import { ViewportTracker } from "../../ViewportTracker";
|
|
@@ -12,21 +12,17 @@ import ReactNative from "react-native";
|
|
|
12
12
|
|
|
13
13
|
jest.useFakeTimers();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
...jest.requireActual("react-native/Libraries/ReactNative/NativeUIManager"),
|
|
18
|
-
measureLayout: (handle, parent, error, success) => {
|
|
19
|
-
success(100, 100, 400, 400);
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
});
|
|
15
|
+
const { ScrollView } = ReactNative;
|
|
23
16
|
|
|
24
|
-
jest.
|
|
25
|
-
...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
|
|
26
|
-
findNodeHandle: () => 1234,
|
|
27
|
-
}));
|
|
17
|
+
jest.spyOn(ReactNative, "findNodeHandle").mockImplementation(() => 1234);
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
ReactNative.UIManager.measureLayout = jest.fn(
|
|
20
|
+
(handle, parent, error, success) => {
|
|
21
|
+
success(100, 100, 400, 400);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
ReactNative.findNodeHandle = () => 1234;
|
|
30
26
|
|
|
31
27
|
const viewportEventsManager = new ViewportEvents(true);
|
|
32
28
|
|
|
@@ -138,7 +134,7 @@ describe("<ViewportAware />", () => {
|
|
|
138
134
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
139
135
|
expect(onViewportEnter).toHaveBeenCalled();
|
|
140
136
|
|
|
141
|
-
const scrollviews = wrapper.
|
|
137
|
+
const scrollviews = wrapper.UNSAFE_getAllByType(ScrollView);
|
|
142
138
|
expect(scrollviews).toBeArray();
|
|
143
139
|
expect(scrollviews).toHaveProperty("length", 2);
|
|
144
140
|
|
|
@@ -179,7 +175,7 @@ describe("<ViewportAware />", () => {
|
|
|
179
175
|
|
|
180
176
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
181
177
|
|
|
182
|
-
const scrollviews = wrapper.
|
|
178
|
+
const scrollviews = wrapper.UNSAFE_getAllByType(ScrollView);
|
|
183
179
|
expect(scrollviews).toBeArray();
|
|
184
180
|
expect(scrollviews).toHaveProperty("length", 2);
|
|
185
181
|
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import TestRenderer, { act } from "react-test-renderer";
|
|
2
|
+
import { act, render } from "@testing-library/react-native";
|
|
4
3
|
import { ViewportEvents } from "../../ViewportEvents";
|
|
4
|
+
import ReactNative from "react-native";
|
|
5
|
+
|
|
6
|
+
const { ScrollView } = ReactNative;
|
|
5
7
|
|
|
6
8
|
const TestComponent = () => <ScrollView />;
|
|
7
9
|
|
|
8
|
-
jest.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
jest.spyOn(ReactNative, "findNodeHandle").mockImplementation(() => 1234);
|
|
11
|
+
|
|
12
|
+
ReactNative.UIManager.measureLayout = jest.fn(
|
|
13
|
+
(handle, parent, error, success) => {
|
|
14
|
+
success(100, 100, 400, 400);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
12
17
|
|
|
13
18
|
const viewportEventsManager = new ViewportEvents(true);
|
|
14
19
|
|
|
@@ -23,32 +28,49 @@ const event = {
|
|
|
23
28
|
};
|
|
24
29
|
|
|
25
30
|
describe("<ViewportTracker />", () => {
|
|
26
|
-
// eslint-disable-next-line react/prop-types
|
|
27
|
-
const ReactWrapper = ({ children }) => (
|
|
28
|
-
<ViewportTracker viewportEventsManager={viewportEventsManager}>
|
|
29
|
-
<ScrollView>{children}</ScrollView>
|
|
30
|
-
</ViewportTracker>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const wrapper = TestRenderer.create(
|
|
34
|
-
<ReactWrapper>
|
|
35
|
-
<TestComponent />
|
|
36
|
-
</ReactWrapper>
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const scrollView = wrapper.root.findByType(ScrollView);
|
|
40
|
-
|
|
41
31
|
beforeEach(() => {
|
|
42
32
|
viewportEventSpy.mockClear();
|
|
43
33
|
});
|
|
44
34
|
|
|
45
35
|
it("renders correctly", () => {
|
|
36
|
+
// eslint-disable-next-line react/prop-types
|
|
37
|
+
const ReactWrapper = ({ children }) => (
|
|
38
|
+
<ViewportTracker viewportEventsManager={viewportEventsManager}>
|
|
39
|
+
<ScrollView>{children}</ScrollView>
|
|
40
|
+
</ViewportTracker>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const wrapper = render(
|
|
44
|
+
<ReactWrapper>
|
|
45
|
+
<TestComponent />
|
|
46
|
+
</ReactWrapper>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const scrollView = wrapper.UNSAFE_getByType(ScrollView);
|
|
50
|
+
|
|
46
51
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
47
52
|
expect(scrollView.props).toMatchSnapshot();
|
|
48
53
|
});
|
|
49
54
|
|
|
50
55
|
it("notifies viewport listeners when layout changes", () => {
|
|
51
|
-
|
|
56
|
+
// eslint-disable-next-line react/prop-types
|
|
57
|
+
const ReactWrapper = ({ children }) => (
|
|
58
|
+
<ViewportTracker viewportEventsManager={viewportEventsManager}>
|
|
59
|
+
<ScrollView>{children}</ScrollView>
|
|
60
|
+
</ViewportTracker>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const wrapper = render(
|
|
64
|
+
<ReactWrapper>
|
|
65
|
+
<TestComponent />
|
|
66
|
+
</ReactWrapper>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const scrollView = wrapper.UNSAFE_getByType(ScrollView);
|
|
70
|
+
|
|
71
|
+
act(() => {
|
|
72
|
+
scrollView.props.onLayout(event);
|
|
73
|
+
});
|
|
52
74
|
|
|
53
75
|
expect(viewportEventSpy).toHaveBeenCalledWith(
|
|
54
76
|
expect.objectContaining({
|
|
@@ -63,12 +85,50 @@ describe("<ViewportTracker />", () => {
|
|
|
63
85
|
});
|
|
64
86
|
|
|
65
87
|
it("notifies viewport listeners when content scrolls", () => {
|
|
66
|
-
|
|
88
|
+
// eslint-disable-next-line react/prop-types
|
|
89
|
+
const ReactWrapper = ({ children }) => (
|
|
90
|
+
<ViewportTracker viewportEventsManager={viewportEventsManager}>
|
|
91
|
+
<ScrollView>{children}</ScrollView>
|
|
92
|
+
</ViewportTracker>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const wrapper = render(
|
|
96
|
+
<ReactWrapper>
|
|
97
|
+
<TestComponent />
|
|
98
|
+
</ReactWrapper>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const scrollView = wrapper.UNSAFE_getByType(ScrollView);
|
|
102
|
+
|
|
103
|
+
act(() => {
|
|
104
|
+
scrollView.props.onLayout(event);
|
|
105
|
+
scrollView.props.onScroll(event);
|
|
106
|
+
});
|
|
107
|
+
|
|
67
108
|
expect(viewportEventSpy).toHaveBeenCalled();
|
|
68
109
|
});
|
|
69
110
|
|
|
70
111
|
it("notifies viewport listeners when content size changes", () => {
|
|
71
|
-
|
|
112
|
+
// eslint-disable-next-line react/prop-types
|
|
113
|
+
const ReactWrapper = ({ children }) => (
|
|
114
|
+
<ViewportTracker viewportEventsManager={viewportEventsManager}>
|
|
115
|
+
<ScrollView>{children}</ScrollView>
|
|
116
|
+
</ViewportTracker>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const wrapper = render(
|
|
120
|
+
<ReactWrapper>
|
|
121
|
+
<TestComponent />
|
|
122
|
+
</ReactWrapper>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const scrollView = wrapper.UNSAFE_getByType(ScrollView);
|
|
126
|
+
|
|
127
|
+
act(() => {
|
|
128
|
+
scrollView.props.onLayout(event);
|
|
129
|
+
scrollView.props.onContentSizeChange(100, 100);
|
|
130
|
+
});
|
|
131
|
+
|
|
72
132
|
expect(viewportEventSpy).toHaveBeenCalled();
|
|
73
133
|
});
|
|
74
134
|
});
|
|
@@ -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
|
+
|
|
24
26
|
export function withConfigurationProvider(Component: React.ComponentType<any>) {
|
|
25
27
|
return function WithConfigurationProvider(props: Props) {
|
|
26
28
|
const styles = props?.screenData?.styles;
|
|
27
29
|
const general = props?.screenData?.general;
|
|
28
30
|
|
|
29
|
-
const configurationKeys = React.useMemo(() => R.keys(keysMap), []);
|
|
30
|
-
|
|
31
31
|
const configuration = React.useMemo(
|
|
32
32
|
() => prepareConfiguration({ ...general, ...styles }, configurationKeys),
|
|
33
33
|
[]
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0-alpha.1235043154",
|
|
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",
|
|
@@ -31,12 +31,11 @@
|
|
|
31
31
|
"redux-mock-store": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "
|
|
34
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.1235043154",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.1235043154",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.1235043154",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.1235043154",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
|
-
"react-router-native": "^5.1.2",
|
|
40
39
|
"url": "^0.11.0",
|
|
41
40
|
"uuid": "^3.3.2"
|
|
42
41
|
},
|
|
@@ -46,7 +45,6 @@
|
|
|
46
45
|
"immer": "*",
|
|
47
46
|
"react": "*",
|
|
48
47
|
"react-native": "*",
|
|
49
|
-
"react-native-safe-area-context": "*",
|
|
50
48
|
"react-native-svg": "*",
|
|
51
49
|
"uglify-js": "*",
|
|
52
50
|
"validate-color": "*",
|