@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5771418585 → 13.0.0-alpha.5790181722
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/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.tsx +1 -2
- package/Components/Cell/Cell.tsx +4 -13
- package/Components/Cell/CellWithFocusable.tsx +22 -15
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/TvOSCellComponent.tsx +20 -22
- package/Components/Cell/index.js +3 -1
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/ErrorScreen/index.tsx +8 -0
- package/Components/Focusable/FocusableTvOS.tsx +5 -1
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/FocusableList/index.tsx +26 -9
- package/Components/FocusableScrollView/index.tsx +43 -13
- package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
- package/Components/Layout/TV/NavBarContainer.tsx +19 -23
- package/Components/Layout/TV/ScreenContainer.tsx +8 -1
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +8 -134
- package/Components/ModalComponent/BottomSheetModalContent.tsx +45 -19
- package/Components/ModalComponent/Button/Item.tsx +6 -5
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +29 -42
- package/Components/ModalComponent/utils.ts +55 -7
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +32 -6
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/hooks.ts +3 -6
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +4 -0
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +36 -20
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +38 -13
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
- package/Components/VideoModal/ModalAnimation/const.ts +5 -0
- package/Components/VideoModal/ModalAnimation/index.ts +2 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +36 -0
- package/Components/VideoModal/PlayerDetails.tsx +8 -5
- package/Components/VideoModal/PlayerWrapper.tsx +26 -3
- package/Components/VideoModal/VideoModal.tsx +19 -4
- package/Components/VideoModal/utils.ts +3 -4
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +4 -17
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +3 -10
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
- package/package.json +7 -11
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
|
@@ -1,161 +1,180 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
4
|
+
|
|
5
5
|
const pluginConfiguration = { foo: "bar" };
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const MockModuleView = (testID) => {
|
|
8
|
+
// eslint-disable-next-line react/display-name
|
|
9
|
+
return function (props) {
|
|
10
|
+
return <View testID={testID} {...props} />;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const ScreenType1 = MockModuleView("screen_type_1");
|
|
15
|
+
const ScreenType2 = MockModuleView("screen_type_2");
|
|
16
|
+
const PlayerController = MockModuleView("player_controller");
|
|
10
17
|
|
|
11
18
|
const mockScreenType3 = {
|
|
12
|
-
module:
|
|
19
|
+
module: MockModuleView("screen_type_3"),
|
|
13
20
|
name: "ScreenType3",
|
|
14
21
|
type: "screen_type_3",
|
|
15
22
|
configuration: pluginConfiguration,
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
const mockScreenType4 = {
|
|
19
|
-
module:
|
|
26
|
+
module: MockModuleView("screen_type_4"),
|
|
20
27
|
name: "ScreenType4",
|
|
21
28
|
type: "screen_type_4",
|
|
22
29
|
};
|
|
23
30
|
|
|
24
31
|
const mockPlayerPlugin = {
|
|
25
|
-
module:
|
|
32
|
+
module: MockModuleView("player_plugin"),
|
|
26
33
|
name: "playerPlugin",
|
|
27
34
|
type: "player",
|
|
28
35
|
};
|
|
29
36
|
|
|
30
37
|
const mockScreenPlugin = {
|
|
31
|
-
module:
|
|
38
|
+
module: MockModuleView("screen_plugin"),
|
|
32
39
|
type: "general",
|
|
33
40
|
name: "Screen plugin",
|
|
34
41
|
identifier: "screen-plugin",
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
const mockPluginWithConfig = {
|
|
38
|
-
module:
|
|
45
|
+
module: MockModuleView("plugin_with_config"),
|
|
39
46
|
type: "general",
|
|
40
47
|
name: "Plugin with config",
|
|
41
48
|
identifier: "plugin-with-config",
|
|
42
49
|
configuration: pluginConfiguration,
|
|
43
50
|
};
|
|
44
51
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const mockComponents = { ScreenType1, ScreenType2, PlayerController };
|
|
53
|
+
|
|
54
|
+
const mockState = {
|
|
55
|
+
components: mockComponents,
|
|
56
|
+
plugins: [
|
|
57
|
+
mockScreenType3,
|
|
58
|
+
mockScreenType4,
|
|
59
|
+
mockPlayerPlugin,
|
|
60
|
+
mockScreenPlugin,
|
|
61
|
+
mockPluginWithConfig,
|
|
62
|
+
],
|
|
63
|
+
rivers: {
|
|
64
|
+
A1234: {},
|
|
65
|
+
},
|
|
56
66
|
};
|
|
57
67
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
playerPlugin: mockPlayerPlugin,
|
|
65
|
-
ScreenPlugin: mockScreenPlugin,
|
|
66
|
-
PluginWithConfig: mockPluginWithConfig,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
jest.mock("@applicaster/zapp-react-native-utils/analyticsUtils", () => ({
|
|
72
|
-
useAnalytics: jest.fn().mockReturnValue(mockWithAnalytics),
|
|
73
|
-
}));
|
|
68
|
+
jest.mock(
|
|
69
|
+
"@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks",
|
|
70
|
+
() => ({
|
|
71
|
+
useScreenAnalytics: jest.fn(),
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
74
|
|
|
75
|
-
jest.mock(
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
jest.mock(
|
|
76
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
|
|
77
|
+
() => ({
|
|
78
|
+
useNavigation: jest.fn(() => ({
|
|
79
|
+
closeVideoModal: jest.fn(),
|
|
80
|
+
videoModalState: {
|
|
81
|
+
mode: "test",
|
|
82
|
+
},
|
|
83
|
+
})),
|
|
84
|
+
})
|
|
85
|
+
);
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
jest.mock(
|
|
88
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
|
|
89
|
+
() => ({
|
|
90
|
+
useRoute: jest.fn(() => ({ screenId: "1234" })),
|
|
91
|
+
})
|
|
92
|
+
);
|
|
80
93
|
|
|
81
94
|
jest.mock(
|
|
82
|
-
"@applicaster/zapp-react-native-utils/
|
|
95
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
|
|
83
96
|
() => ({
|
|
84
|
-
|
|
97
|
+
useIsScreenActive: () => ({
|
|
98
|
+
isScreenActive: true,
|
|
99
|
+
}),
|
|
85
100
|
})
|
|
86
101
|
);
|
|
87
102
|
|
|
88
|
-
jest.mock("
|
|
89
|
-
|
|
90
|
-
useDispatch: jest.fn(() => () => {}),
|
|
91
|
-
}));
|
|
103
|
+
jest.mock("../../PlayerContainer", () => {
|
|
104
|
+
const { View } = jest.requireActual("react-native");
|
|
92
105
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
106
|
+
return {
|
|
107
|
+
PlayerContainer: (props) => (
|
|
108
|
+
<View {...props}>
|
|
109
|
+
<props.Player />
|
|
110
|
+
</View>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
});
|
|
101
114
|
|
|
102
|
-
const
|
|
115
|
+
const getWrapper = (screenId, screenType, screenData) => {
|
|
116
|
+
const ScreenResolver = require("../").ScreenResolverComponent;
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
shallow(
|
|
118
|
+
return renderWithProviders(
|
|
106
119
|
<ScreenResolver
|
|
107
120
|
{...{
|
|
108
121
|
screenId,
|
|
109
122
|
screenType,
|
|
110
123
|
screenData,
|
|
111
124
|
}}
|
|
112
|
-
|
|
125
|
+
/>,
|
|
126
|
+
mockState
|
|
113
127
|
);
|
|
128
|
+
};
|
|
114
129
|
|
|
115
130
|
describe("<ScreenResolver />", () => {
|
|
116
131
|
it("renders correctly", () => {
|
|
117
132
|
const wrapper = getWrapper("1234", "screen_type_1", {});
|
|
118
133
|
|
|
119
|
-
expect(
|
|
134
|
+
expect(wrapper.getByTestId("screen_type_1")).toBeDefined();
|
|
120
135
|
});
|
|
121
136
|
|
|
122
137
|
it("picks screen from plugins if it exists", () => {
|
|
123
138
|
const wrapper = getWrapper("A1234", "screen_type_3", {});
|
|
124
139
|
|
|
125
|
-
expect(wrapper.
|
|
140
|
+
expect(wrapper.getByTestId("screen_type_3")).toBeDefined();
|
|
126
141
|
});
|
|
127
142
|
|
|
128
143
|
it("picks the screen from its identifier if it exists", () => {
|
|
129
144
|
const wrapper = getWrapper("A1234", "screen-plugin", {});
|
|
130
145
|
|
|
131
|
-
expect(wrapper.
|
|
146
|
+
expect(wrapper.getByTestId("screen_plugin")).toBeDefined();
|
|
132
147
|
});
|
|
133
148
|
|
|
134
149
|
it("picks screen from components if it doesn't exist in plugins", () => {
|
|
135
150
|
const wrapper = getWrapper("A1234", "screen_type_2", {});
|
|
136
151
|
|
|
137
|
-
expect(wrapper.
|
|
152
|
+
expect(wrapper.getByTestId("screen_type_2")).toBeDefined();
|
|
138
153
|
});
|
|
139
154
|
|
|
140
155
|
it("renders the screen and passes screenId & locationState as props", () => {
|
|
141
156
|
const wrapper = getWrapper("A1234", "screen_type_3", "foo");
|
|
142
157
|
|
|
143
|
-
const screenWrapper = wrapper.
|
|
158
|
+
const screenWrapper = wrapper.getByTestId("screen_type_3");
|
|
144
159
|
|
|
145
|
-
expect(screenWrapper.
|
|
146
|
-
|
|
160
|
+
expect(screenWrapper.props).toMatchObject({
|
|
161
|
+
screenId: "A1234",
|
|
162
|
+
screenData: "foo",
|
|
163
|
+
});
|
|
147
164
|
});
|
|
148
165
|
|
|
149
166
|
it("renders null if the screen is not found", () => {
|
|
150
167
|
const wrapper = getWrapper(null, "screen_type_5", {});
|
|
151
168
|
|
|
152
|
-
expect(wrapper.
|
|
169
|
+
expect(wrapper.queryAllByTestId("screen_type_5")).toBeEmpty();
|
|
153
170
|
});
|
|
154
171
|
|
|
155
172
|
it("injects the plugin configuration if it exists", () => {
|
|
156
173
|
const wrapper = getWrapper("A1234", "plugin-with-config", {});
|
|
157
174
|
|
|
158
|
-
|
|
175
|
+
const screenWrapper = wrapper.getByTestId("plugin_with_config");
|
|
176
|
+
|
|
177
|
+
expect(screenWrapper.props).toHaveProperty(
|
|
159
178
|
"configuration",
|
|
160
179
|
expect.objectContaining(pluginConfiguration)
|
|
161
180
|
);
|
|
@@ -164,7 +183,9 @@ describe("<ScreenResolver />", () => {
|
|
|
164
183
|
it("injects the plugin configuration if it exists, even when plugin is resolved by type", () => {
|
|
165
184
|
const wrapper = getWrapper("A1234", "screen_type_3", {});
|
|
166
185
|
|
|
167
|
-
|
|
186
|
+
const screenWrapper = wrapper.getByTestId("screen_type_3");
|
|
187
|
+
|
|
188
|
+
expect(screenWrapper.props).toHaveProperty(
|
|
168
189
|
"configuration",
|
|
169
190
|
expect.objectContaining(pluginConfiguration)
|
|
170
191
|
);
|
|
@@ -172,6 +193,6 @@ describe("<ScreenResolver />", () => {
|
|
|
172
193
|
|
|
173
194
|
it("wraps the player with the playerController component when the screenType is playable", () => {
|
|
174
195
|
const wrapper = getWrapper("A1234", "playable", {});
|
|
175
|
-
expect(
|
|
196
|
+
expect(wrapper.getByTestId("player_plugin")).toBeDefined();
|
|
176
197
|
});
|
|
177
198
|
});
|
|
@@ -12,6 +12,7 @@ type TrackedViewProps = {
|
|
|
12
12
|
onPositionUpdated: (props: { rect?: Record<string, number> }) => void;
|
|
13
13
|
testId?: string | undefined;
|
|
14
14
|
groupId?: string;
|
|
15
|
+
clipThreshold?: number;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export const TrackedView = memo(function TrackedView(props: TrackedViewProps) {
|
|
@@ -2,21 +2,21 @@ import { Animated } from "react-native";
|
|
|
2
2
|
|
|
3
3
|
import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
|
|
4
4
|
|
|
5
|
-
type TransitionConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
5
|
+
// type TransitionConfig = {
|
|
6
|
+
// duration: number;
|
|
7
|
+
// easing: any;
|
|
8
|
+
// from: {
|
|
9
|
+
// style: any;
|
|
10
|
+
// };
|
|
11
|
+
// to: {
|
|
12
|
+
// style: any;
|
|
13
|
+
// };
|
|
14
|
+
// };
|
|
15
15
|
|
|
16
|
-
type Props = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
16
|
+
// type Props = {
|
|
17
|
+
// transitionConfig: TransitionConfig;
|
|
18
|
+
// contentStyle: { [string]: any };
|
|
19
|
+
// };
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Manages animation for the Transitioner,
|
|
@@ -25,7 +25,7 @@ type Props = {
|
|
|
25
25
|
* which must have a proper structure, see types above ^.
|
|
26
26
|
*/
|
|
27
27
|
export class AnimationManager {
|
|
28
|
-
constructor(props
|
|
28
|
+
constructor(props) {
|
|
29
29
|
this.animatedValue = new Animated.Value(0.0);
|
|
30
30
|
|
|
31
31
|
this.config = props.transitionConfig(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { Scene } from "../Scene";
|
|
4
5
|
|
|
5
6
|
const overlayStyle = { opacity: 1 };
|
|
6
7
|
const contentStyle = { paddingBottom: 49 };
|
|
@@ -23,28 +24,38 @@ jest.mock(
|
|
|
23
24
|
})
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
jest.mock("../../../Contexts/PathnameContext", () => ({
|
|
28
|
+
PathnameContext: jest.requireActual("react").createContext({ pathname: "" }),
|
|
29
|
+
}));
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
31
|
+
jest.mock("../../../Contexts/ScreenDataContext", () => ({
|
|
32
|
+
ScreenDataContext: jest.requireActual("react").createContext({}),
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
jest.mock("../../../Contexts/ScreenContext", () => ({
|
|
36
|
+
ScreenContextProvider: jest.requireActual("react-native").View,
|
|
37
|
+
}));
|
|
35
38
|
|
|
36
39
|
describe("<Scene />", () => {
|
|
40
|
+
const wrapper = render(
|
|
41
|
+
<Scene
|
|
42
|
+
style={style}
|
|
43
|
+
overlayStyle={overlayStyle}
|
|
44
|
+
contentStyle={contentStyle}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
|
|
37
48
|
it("renders correctly", () => {
|
|
38
|
-
expect(
|
|
49
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
39
50
|
});
|
|
40
51
|
|
|
41
52
|
// skipped - this isn't a very useful test, and it doesn't work as it used to on the new version of RN
|
|
42
53
|
it.skip("renders children surrounded by AnimatedComponent", () => {
|
|
43
|
-
expect(
|
|
54
|
+
expect(wrapper.toJSON()).toEqual("AnimatedComponent");
|
|
44
55
|
});
|
|
45
56
|
|
|
46
57
|
it("renders the overlay while animating", () => {
|
|
47
|
-
const wrapperWithOverlay =
|
|
58
|
+
const wrapperWithOverlay = render(
|
|
48
59
|
<Scene
|
|
49
60
|
style={style}
|
|
50
61
|
overlayStyle={overlayStyle}
|
|
@@ -53,6 +64,6 @@ describe("<Scene />", () => {
|
|
|
53
64
|
/>
|
|
54
65
|
);
|
|
55
66
|
|
|
56
|
-
expect(
|
|
67
|
+
expect(wrapperWithOverlay.toJSON).toMatchSnapshot();
|
|
57
68
|
});
|
|
58
69
|
});
|
|
@@ -1,79 +1,23 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Scene /> renders correctly 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
overlayStyle={
|
|
11
|
-
{
|
|
12
|
-
"opacity": 1,
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
style={
|
|
16
|
-
{
|
|
17
|
-
"flex": 1,
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
>
|
|
21
|
-
<SceneComponent
|
|
22
|
-
contentStyle={
|
|
23
|
-
{
|
|
24
|
-
"paddingBottom": 49,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
overlayStyle={
|
|
28
|
-
{
|
|
29
|
-
"opacity": 1,
|
|
30
|
-
}
|
|
31
|
-
}
|
|
4
|
+
<View>
|
|
5
|
+
<View
|
|
6
|
+
collapsable={false}
|
|
7
|
+
pointerEvents="auto"
|
|
32
8
|
style={
|
|
33
9
|
{
|
|
34
10
|
"flex": 1,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/>
|
|
38
|
-
</CurrentScreenContextProvider>
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
exports[`<Scene /> renders the overlay while animating 1`] = `
|
|
42
|
-
<CurrentScreenContextProvider
|
|
43
|
-
animating={true}
|
|
44
|
-
contentStyle={
|
|
45
|
-
{
|
|
46
|
-
"paddingBottom": 49,
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
overlayStyle={
|
|
50
|
-
{
|
|
51
|
-
"opacity": 1,
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
style={
|
|
55
|
-
{
|
|
56
|
-
"flex": 1,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
>
|
|
60
|
-
<SceneComponent
|
|
61
|
-
animating={true}
|
|
62
|
-
contentStyle={
|
|
63
|
-
{
|
|
11
|
+
"fontScale": 2,
|
|
12
|
+
"height": 1334,
|
|
64
13
|
"paddingBottom": 49,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
"opacity": 1,
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
style={
|
|
73
|
-
{
|
|
74
|
-
"flex": 1,
|
|
14
|
+
"scale": 2,
|
|
15
|
+
"statusBarHeight": null,
|
|
16
|
+
"width": 750,
|
|
75
17
|
}
|
|
76
18
|
}
|
|
77
19
|
/>
|
|
78
|
-
</
|
|
20
|
+
</View>
|
|
79
21
|
`;
|
|
22
|
+
|
|
23
|
+
exports[`<Scene /> renders the overlay while animating 1`] = `[Function]`;
|
|
@@ -9,7 +9,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<View
|
|
13
13
|
isActive={true}
|
|
14
14
|
screenUniqueId="mocked-uuid"
|
|
15
15
|
style={{}}
|
|
@@ -23,6 +23,6 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
|
23
23
|
children
|
|
24
24
|
</Text>
|
|
25
25
|
</View>
|
|
26
|
-
</
|
|
26
|
+
</View>
|
|
27
27
|
</View>
|
|
28
28
|
`;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text, View } from "react-native";
|
|
3
|
-
import { shallow } from "enzyme";
|
|
4
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
5
3
|
|
|
6
4
|
import { TransitionerComponent } from "../Transitioner";
|
|
5
|
+
import { render } from "@testing-library/react-native";
|
|
6
|
+
|
|
7
|
+
jest.mock("../Scene", () => {
|
|
8
|
+
const View = jest.requireActual("react-native").View;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
Scene(props) {
|
|
12
|
+
return <View {...props} />;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
});
|
|
7
16
|
|
|
8
17
|
const children = (
|
|
9
18
|
<View foo="bar">
|
|
@@ -33,12 +42,12 @@ jest.mock("uuid");
|
|
|
33
42
|
|
|
34
43
|
describe("<TransitionerComponent />", () => {
|
|
35
44
|
it("renders correctly", () => {
|
|
36
|
-
const wrapper =
|
|
45
|
+
const wrapper = render(
|
|
37
46
|
<TransitionerComponent {...transitionerComponentProps}>
|
|
38
47
|
{children}
|
|
39
48
|
</TransitionerComponent>
|
|
40
49
|
);
|
|
41
50
|
|
|
42
|
-
expect(
|
|
51
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
43
52
|
});
|
|
44
53
|
});
|
|
@@ -32,6 +32,9 @@ const { log_error, log_debug } = loggerLiveImageComponent;
|
|
|
32
32
|
const isMeasurement = (item: ZappEntry) =>
|
|
33
33
|
isString(item.id) && item.id.startsWith("pre-measurement-");
|
|
34
34
|
|
|
35
|
+
// Pixels by which the view can slightly extend outside the viewport and still be considered fully visible.
|
|
36
|
+
const CLIP_THRESHOLD = 10;
|
|
37
|
+
|
|
35
38
|
type Props = {
|
|
36
39
|
item: ZappEntry;
|
|
37
40
|
style: Record<string, any>;
|
|
@@ -328,6 +331,7 @@ const PlayerLiveImageComponent = (props: Props) => {
|
|
|
328
331
|
<TrackedView
|
|
329
332
|
testId={`tracked-view-${playerId}-${item.title}`}
|
|
330
333
|
onPositionUpdated={onPositionUpdated}
|
|
334
|
+
clipThreshold={CLIP_THRESHOLD}
|
|
331
335
|
>
|
|
332
336
|
<View ref={trackViewRef}>
|
|
333
337
|
{isVideoMode ? (
|
|
@@ -46,7 +46,7 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
|
|
|
46
46
|
|
|
47
47
|
React.useEffect(() => {
|
|
48
48
|
(playerAnimationState === PlayerAnimationStateEnum.minimize ||
|
|
49
|
-
playerAnimationState === PlayerAnimationStateEnum.
|
|
49
|
+
playerAnimationState === PlayerAnimationStateEnum.maximize) &&
|
|
50
50
|
setStartComponentsAnimation(true);
|
|
51
51
|
}, [playerAnimationState]);
|
|
52
52
|
|