@applicaster/zapp-react-native-ui-components 12.0.0-rc.8 → 12.0.0-rc.80
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/AudioPlayer/AudioPlayer.tsx +9 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.tsx +1 -1
- package/Components/Cell/Cell.tsx +7 -7
- package/Components/Cell/CellWithFocusable.tsx +38 -19
- package/Components/Cell/TvOSCellComponent.tsx +2 -2
- package/Components/ErrorScreen/index.tsx +1 -1
- package/Components/FocusableCell/index.tsx +7 -7
- package/Components/FocusableGroup/index.tsx +1 -0
- package/Components/FocusableList/FocusableChild.ts +24 -14
- package/Components/FocusableList/FocusableItem.tsx +1 -1
- package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
- package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
- package/Components/FocusableList/index.tsx +26 -25
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +4 -1
- package/Components/HookRenderer/index.tsx +1 -6
- package/Components/Image/Image.android.tsx +3 -26
- package/Components/Image/Image.tsx +18 -2
- package/Components/Image/utils/index.ts +39 -0
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +19 -108
- package/Components/Layout/TV/index.tsx +28 -43
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +80 -110
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +4 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/utils/index.ts +33 -35
- package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
- package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
- package/Components/ModalComponent/Button/Item.tsx +82 -0
- package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
- package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
- package/Components/ModalComponent/Button/assets.ts +4 -0
- package/Components/ModalComponent/Button/index.tsx +111 -0
- package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
- package/Components/ModalComponent/Header/Title.tsx +70 -0
- package/Components/ModalComponent/Header/assets.ts +4 -0
- package/Components/ModalComponent/Header/index.tsx +71 -0
- package/Components/ModalComponent/Header/utils.ts +79 -0
- package/Components/ModalComponent/index.tsx +38 -0
- package/Components/ModalComponent/utils.ts +126 -0
- package/Components/Navigator/StackNavigator.tsx +48 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +69 -31
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
- package/Components/PlayerImageBackground/index.tsx +34 -8
- package/Components/River/ComponentsMap/ComponentsMap.tsx +97 -2
- package/Components/River/RefreshControl.tsx +55 -1
- package/Components/River/River.tsx +8 -5
- package/Components/River/TV/River.tsx +2 -25
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/River/__tests__/componentsMap.test.js +7 -0
- package/Components/River/useScreenConfiguration.ts +5 -6
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
- package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
- package/Components/RouteManager/index.tsx +4 -2
- package/Components/Screen/TV/hooks/index.ts +3 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
- package/Components/Screen/TV/index.web.tsx +179 -0
- package/Components/Screen/__tests__/Screen.test.tsx +51 -36
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
- package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
- package/Components/Screen/index.tsx +131 -44
- package/Components/Screen/navigationHandler.ts +0 -82
- package/Components/Screen/orientationHandler.ts +1 -1
- package/Components/ScreenResolver/index.tsx +4 -2
- package/Components/Tabs/TV/styles.ts +1 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/Transitioner/Scene.tsx +24 -19
- package/Components/Transitioner/Transitioner.tsx +21 -28
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +60 -14
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +18 -28
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +352 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +158 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +461 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +154 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
- package/Components/VideoModal/PlayerDetails.tsx +6 -3
- package/Components/VideoModal/PlayerWrapper.tsx +82 -50
- package/Components/VideoModal/VideoModal.tsx +23 -40
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +246 -166
- package/Components/VideoModal/hooks/useModalSize.ts +13 -4
- package/Components/VideoModal/utils.ts +8 -5
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
- package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
- package/Components/Viewport/ViewportTracker/index.tsx +1 -0
- package/Components/Viewport/utils.js +1 -1
- package/Components/ZappUIComponent/index.tsx +22 -12
- package/Components/index.js +2 -0
- package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
- package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
- package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
- package/Contexts/ScreenContext/index.tsx +95 -29
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
- package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
- package/Decorators/RiverResolver/index.tsx +0 -4
- package/Decorators/index.tsx +0 -4
- package/events/index.ts +1 -0
- package/package.json +5 -6
- package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
- package/Components/VideoModal/hooks/usePosition.ts +0 -50
- /package/Contexts/{index.js → index.ts} +0 -0
|
@@ -21,8 +21,17 @@ const useIsTablet = jest.fn();
|
|
|
21
21
|
|
|
22
22
|
jest.mock("react-native");
|
|
23
23
|
|
|
24
|
+
jest.mock("react-native-gesture-handler");
|
|
25
|
+
|
|
24
26
|
jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
|
|
25
27
|
|
|
28
|
+
jest.mock(
|
|
29
|
+
"@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
|
|
30
|
+
() => ({
|
|
31
|
+
useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
26
35
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
|
|
27
36
|
useIsTablet,
|
|
28
37
|
}));
|
|
@@ -38,6 +47,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
|
38
47
|
}));
|
|
39
48
|
|
|
40
49
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
50
|
+
isNavBarVisible: jest.fn(() => true),
|
|
41
51
|
useRoute: jest.fn(() => ({
|
|
42
52
|
pathname: "/river/testId",
|
|
43
53
|
})),
|
|
@@ -45,6 +55,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
|
45
55
|
canGoBack: () => false,
|
|
46
56
|
currentRoute: "/river/testId",
|
|
47
57
|
data: { screen: { id: "testId" } },
|
|
58
|
+
videoModalState: { visible: false },
|
|
48
59
|
})),
|
|
49
60
|
}));
|
|
50
61
|
|
|
@@ -94,7 +105,7 @@ describe("PlayerWrapper", () => {
|
|
|
94
105
|
useIsTablet.mockReturnValue(false);
|
|
95
106
|
|
|
96
107
|
const children = jest.fn(() => {});
|
|
97
|
-
const dimensions = { height:
|
|
108
|
+
const dimensions = { height: undefined, width: props.style.width };
|
|
98
109
|
|
|
99
110
|
const element = renderWithProviders(
|
|
100
111
|
<PlayerWrapper
|
|
@@ -1,249 +1,329 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`PlayerWrapper renders inline 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
Object {
|
|
7
|
-
"bottom": "off",
|
|
8
|
-
"left": "off",
|
|
9
|
-
"right": "off",
|
|
10
|
-
"top": "additive",
|
|
11
|
-
}
|
|
12
|
-
}
|
|
4
|
+
<RNCSafeAreaProvider
|
|
5
|
+
onInsetsChange={[Function]}
|
|
13
6
|
style={
|
|
14
7
|
Array [
|
|
15
8
|
Object {
|
|
16
|
-
"
|
|
17
|
-
},
|
|
18
|
-
Object {
|
|
19
|
-
"backgroundColor": "transparent",
|
|
20
|
-
},
|
|
21
|
-
Object {
|
|
22
|
-
"height": 800,
|
|
23
|
-
"width": 300,
|
|
9
|
+
"flex": 1,
|
|
24
10
|
},
|
|
25
|
-
|
|
11
|
+
undefined,
|
|
26
12
|
]
|
|
27
13
|
}
|
|
28
14
|
>
|
|
29
|
-
<
|
|
15
|
+
<RNCSafeAreaView
|
|
16
|
+
edges={
|
|
17
|
+
Object {
|
|
18
|
+
"bottom": "off",
|
|
19
|
+
"left": "off",
|
|
20
|
+
"right": "off",
|
|
21
|
+
"top": "additive",
|
|
22
|
+
}
|
|
23
|
+
}
|
|
30
24
|
style={
|
|
31
25
|
Array [
|
|
32
26
|
Object {
|
|
33
|
-
"
|
|
34
|
-
"position": "relative",
|
|
35
|
-
"zIndex": 200,
|
|
27
|
+
"backgroundColor": "transparent",
|
|
36
28
|
},
|
|
37
29
|
Object {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"width": "100%",
|
|
30
|
+
"height": 800,
|
|
31
|
+
"width": 300,
|
|
41
32
|
},
|
|
42
33
|
Object {},
|
|
43
|
-
Object {},
|
|
44
34
|
]
|
|
45
35
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"tablet_landscape_sidebar_width": "35%",
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
entry={
|
|
56
|
-
Object {
|
|
57
|
-
"id": "test",
|
|
36
|
+
>
|
|
37
|
+
<View
|
|
38
|
+
additionalData={
|
|
39
|
+
Object {
|
|
40
|
+
"saveArea": true,
|
|
41
|
+
}
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"paddingTop": 20,
|
|
43
|
+
animationType="moveUpComponent"
|
|
44
|
+
style={
|
|
45
|
+
Object {
|
|
46
|
+
"flexDirection": "column",
|
|
47
|
+
}
|
|
65
48
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
>
|
|
50
|
+
<View
|
|
51
|
+
style={
|
|
52
|
+
Array [
|
|
53
|
+
Object {
|
|
54
|
+
"alignSelf": "center",
|
|
55
|
+
"position": "relative",
|
|
56
|
+
"zIndex": 200,
|
|
57
|
+
},
|
|
58
|
+
Object {
|
|
59
|
+
"aspectRatio": 1.7777777777777777,
|
|
60
|
+
"height": undefined,
|
|
61
|
+
"width": "100%",
|
|
62
|
+
},
|
|
63
|
+
Object {},
|
|
64
|
+
Object {},
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
testID="test-player-container"
|
|
68
|
+
/>
|
|
69
|
+
<View
|
|
70
|
+
style={
|
|
71
|
+
Object {
|
|
72
|
+
"flex": 1,
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
</View>
|
|
77
|
+
</RNCSafeAreaView>
|
|
78
|
+
</RNCSafeAreaProvider>
|
|
69
79
|
`;
|
|
70
80
|
|
|
71
81
|
exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
Object {
|
|
75
|
-
"bottom": "additive",
|
|
76
|
-
"left": "off",
|
|
77
|
-
"right": "off",
|
|
78
|
-
"top": "off",
|
|
79
|
-
}
|
|
80
|
-
}
|
|
82
|
+
<RNCSafeAreaProvider
|
|
83
|
+
onInsetsChange={[Function]}
|
|
81
84
|
style={
|
|
82
85
|
Array [
|
|
83
86
|
Object {
|
|
84
|
-
"
|
|
85
|
-
},
|
|
86
|
-
Object {
|
|
87
|
-
"backgroundColor": "transparent",
|
|
88
|
-
},
|
|
89
|
-
Object {
|
|
90
|
-
"height": 50,
|
|
91
|
-
"width": 300,
|
|
87
|
+
"flex": 1,
|
|
92
88
|
},
|
|
93
|
-
|
|
89
|
+
undefined,
|
|
94
90
|
]
|
|
95
91
|
}
|
|
96
92
|
>
|
|
97
|
-
<
|
|
93
|
+
<RNCSafeAreaView
|
|
94
|
+
edges={
|
|
95
|
+
Object {
|
|
96
|
+
"bottom": "off",
|
|
97
|
+
"left": "off",
|
|
98
|
+
"right": "off",
|
|
99
|
+
"top": "additive",
|
|
100
|
+
}
|
|
101
|
+
}
|
|
98
102
|
style={
|
|
99
103
|
Array [
|
|
100
104
|
Object {
|
|
101
|
-
"
|
|
102
|
-
"position": "relative",
|
|
103
|
-
"zIndex": 200,
|
|
105
|
+
"backgroundColor": "transparent",
|
|
104
106
|
},
|
|
105
107
|
Object {
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"width": "100%",
|
|
108
|
+
"height": undefined,
|
|
109
|
+
"width": 300,
|
|
109
110
|
},
|
|
110
111
|
Object {},
|
|
111
|
-
Object {},
|
|
112
112
|
]
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"paddingTop": 20,
|
|
114
|
+
>
|
|
115
|
+
<View
|
|
116
|
+
additionalData={
|
|
117
|
+
Object {
|
|
118
|
+
"saveArea": true,
|
|
119
|
+
}
|
|
121
120
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
animationType="moveUpComponent"
|
|
122
|
+
style={
|
|
123
|
+
Object {
|
|
124
|
+
"flexDirection": "column",
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
<View
|
|
129
|
+
style={
|
|
130
|
+
Array [
|
|
131
|
+
Object {
|
|
132
|
+
"alignSelf": "center",
|
|
133
|
+
"position": "relative",
|
|
134
|
+
"zIndex": 200,
|
|
135
|
+
},
|
|
136
|
+
Object {
|
|
137
|
+
"aspectRatio": undefined,
|
|
138
|
+
"height": undefined,
|
|
139
|
+
"width": "100%",
|
|
140
|
+
},
|
|
141
|
+
Object {},
|
|
142
|
+
Object {},
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
testID="test-player-container"
|
|
146
|
+
/>
|
|
147
|
+
<View
|
|
148
|
+
style={
|
|
149
|
+
Object {
|
|
150
|
+
"flex": 1,
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/>
|
|
154
|
+
</View>
|
|
155
|
+
</RNCSafeAreaView>
|
|
156
|
+
</RNCSafeAreaProvider>
|
|
125
157
|
`;
|
|
126
158
|
|
|
127
159
|
exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
Object {
|
|
131
|
-
"bottom": "off",
|
|
132
|
-
"left": "off",
|
|
133
|
-
"right": "off",
|
|
134
|
-
"top": "additive",
|
|
135
|
-
}
|
|
136
|
-
}
|
|
160
|
+
<RNCSafeAreaProvider
|
|
161
|
+
onInsetsChange={[Function]}
|
|
137
162
|
style={
|
|
138
163
|
Array [
|
|
139
164
|
Object {
|
|
140
|
-
"
|
|
141
|
-
},
|
|
142
|
-
Object {
|
|
143
|
-
"backgroundColor": "red",
|
|
144
|
-
},
|
|
145
|
-
Object {
|
|
146
|
-
"height": 800,
|
|
147
|
-
"width": 300,
|
|
165
|
+
"flex": 1,
|
|
148
166
|
},
|
|
149
|
-
|
|
167
|
+
undefined,
|
|
150
168
|
]
|
|
151
169
|
}
|
|
152
170
|
>
|
|
153
|
-
<
|
|
171
|
+
<RNCSafeAreaView
|
|
172
|
+
edges={
|
|
173
|
+
Object {
|
|
174
|
+
"bottom": "off",
|
|
175
|
+
"left": "off",
|
|
176
|
+
"right": "off",
|
|
177
|
+
"top": "additive",
|
|
178
|
+
}
|
|
179
|
+
}
|
|
154
180
|
style={
|
|
155
181
|
Array [
|
|
156
182
|
Object {
|
|
157
|
-
"
|
|
158
|
-
"position": "relative",
|
|
159
|
-
"zIndex": 200,
|
|
183
|
+
"backgroundColor": "red",
|
|
160
184
|
},
|
|
161
185
|
Object {
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"width": 195,
|
|
186
|
+
"height": 800,
|
|
187
|
+
"width": 300,
|
|
165
188
|
},
|
|
166
189
|
Object {},
|
|
167
|
-
Object {},
|
|
168
190
|
]
|
|
169
191
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"tablet_landscape_sidebar_width": "35%",
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
entry={
|
|
180
|
-
Object {
|
|
181
|
-
"id": "test",
|
|
192
|
+
>
|
|
193
|
+
<View
|
|
194
|
+
additionalData={
|
|
195
|
+
Object {
|
|
196
|
+
"saveArea": true,
|
|
197
|
+
}
|
|
182
198
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
"paddingTop": 20,
|
|
199
|
+
animationType="moveUpComponent"
|
|
200
|
+
style={
|
|
201
|
+
Object {
|
|
202
|
+
"flexDirection": "row",
|
|
203
|
+
}
|
|
189
204
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
205
|
+
>
|
|
206
|
+
<View
|
|
207
|
+
style={
|
|
208
|
+
Array [
|
|
209
|
+
Object {
|
|
210
|
+
"alignSelf": "center",
|
|
211
|
+
"position": "relative",
|
|
212
|
+
"zIndex": 200,
|
|
213
|
+
},
|
|
214
|
+
Object {
|
|
215
|
+
"aspectRatio": 1.7777777777777777,
|
|
216
|
+
"height": undefined,
|
|
217
|
+
"width": 195,
|
|
218
|
+
},
|
|
219
|
+
Object {},
|
|
220
|
+
Object {},
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
testID="test-player-container"
|
|
224
|
+
>
|
|
225
|
+
<View
|
|
226
|
+
additionalData={
|
|
227
|
+
Object {
|
|
228
|
+
"disableAnimatedComponent": false,
|
|
229
|
+
"resetAnimationValue": undefined,
|
|
230
|
+
"useLayoutMeasure": true,
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
animationType="moveUpComponent"
|
|
234
|
+
style={
|
|
235
|
+
Object {
|
|
236
|
+
"flex": 1,
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/>
|
|
240
|
+
</View>
|
|
241
|
+
<View
|
|
242
|
+
style={
|
|
243
|
+
Object {
|
|
244
|
+
"flex": 1,
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/>
|
|
248
|
+
</View>
|
|
249
|
+
</RNCSafeAreaView>
|
|
250
|
+
</RNCSafeAreaProvider>
|
|
193
251
|
`;
|
|
194
252
|
|
|
195
253
|
exports[`PlayerWrapper renders properly 1`] = `
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
Object {
|
|
199
|
-
"bottom": "off",
|
|
200
|
-
"left": "off",
|
|
201
|
-
"right": "off",
|
|
202
|
-
"top": "additive",
|
|
203
|
-
}
|
|
204
|
-
}
|
|
254
|
+
<RNCSafeAreaProvider
|
|
255
|
+
onInsetsChange={[Function]}
|
|
205
256
|
style={
|
|
206
257
|
Array [
|
|
207
258
|
Object {
|
|
208
|
-
"
|
|
209
|
-
},
|
|
210
|
-
Object {
|
|
211
|
-
"backgroundColor": "transparent",
|
|
212
|
-
},
|
|
213
|
-
Object {
|
|
214
|
-
"height": 800,
|
|
215
|
-
"width": 300,
|
|
259
|
+
"flex": 1,
|
|
216
260
|
},
|
|
217
|
-
|
|
261
|
+
undefined,
|
|
218
262
|
]
|
|
219
263
|
}
|
|
220
264
|
>
|
|
221
|
-
<
|
|
265
|
+
<RNCSafeAreaView
|
|
266
|
+
edges={
|
|
267
|
+
Object {
|
|
268
|
+
"bottom": "off",
|
|
269
|
+
"left": "off",
|
|
270
|
+
"right": "off",
|
|
271
|
+
"top": "additive",
|
|
272
|
+
}
|
|
273
|
+
}
|
|
222
274
|
style={
|
|
223
275
|
Array [
|
|
224
276
|
Object {
|
|
225
|
-
"
|
|
226
|
-
"position": "relative",
|
|
227
|
-
"zIndex": 200,
|
|
277
|
+
"backgroundColor": "transparent",
|
|
228
278
|
},
|
|
229
279
|
Object {
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"width": "100%",
|
|
280
|
+
"height": 800,
|
|
281
|
+
"width": 300,
|
|
233
282
|
},
|
|
234
283
|
Object {},
|
|
235
|
-
Object {},
|
|
236
284
|
]
|
|
237
285
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
"paddingTop": 20,
|
|
286
|
+
>
|
|
287
|
+
<View
|
|
288
|
+
additionalData={
|
|
289
|
+
Object {
|
|
290
|
+
"saveArea": true,
|
|
291
|
+
}
|
|
245
292
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
293
|
+
animationType="moveUpComponent"
|
|
294
|
+
style={
|
|
295
|
+
Object {
|
|
296
|
+
"flexDirection": "column",
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
>
|
|
300
|
+
<View
|
|
301
|
+
style={
|
|
302
|
+
Array [
|
|
303
|
+
Object {
|
|
304
|
+
"alignSelf": "center",
|
|
305
|
+
"position": "relative",
|
|
306
|
+
"zIndex": 200,
|
|
307
|
+
},
|
|
308
|
+
Object {
|
|
309
|
+
"aspectRatio": 1.7786666666666666,
|
|
310
|
+
"height": undefined,
|
|
311
|
+
"width": "100%",
|
|
312
|
+
},
|
|
313
|
+
Object {},
|
|
314
|
+
Object {},
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
testID="test-player-container"
|
|
318
|
+
/>
|
|
319
|
+
<View
|
|
320
|
+
style={
|
|
321
|
+
Object {
|
|
322
|
+
"flex": 1,
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/>
|
|
326
|
+
</View>
|
|
327
|
+
</RNCSafeAreaView>
|
|
328
|
+
</RNCSafeAreaProvider>
|
|
249
329
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { Dimensions } from "react-native";
|
|
3
3
|
import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
|
|
4
4
|
import {
|
|
@@ -39,13 +39,22 @@ export const useModalSize = (): Size => {
|
|
|
39
39
|
MODAL_SIZE_FOR_PORTRAIT
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const setNewModalSize = (
|
|
43
|
-
setModalSize(
|
|
42
|
+
const setNewModalSize = React.useCallback((newSize, log) => {
|
|
43
|
+
setModalSize((oldSize) => {
|
|
44
|
+
if (
|
|
45
|
+
oldSize.height === newSize.height &&
|
|
46
|
+
oldSize.width === newSize.width
|
|
47
|
+
) {
|
|
48
|
+
return oldSize;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return newSize;
|
|
52
|
+
});
|
|
44
53
|
|
|
45
54
|
logger.debug({
|
|
46
55
|
message: log,
|
|
47
56
|
});
|
|
48
|
-
};
|
|
57
|
+
}, []);
|
|
49
58
|
|
|
50
59
|
const isTabletLandscape = useIsTabletLandscape();
|
|
51
60
|
|
|
@@ -23,18 +23,21 @@ export const useConfiguration = () => {
|
|
|
23
23
|
const targetScreenConfiguration = rivers?.[targetScreenId];
|
|
24
24
|
|
|
25
25
|
const pluginConfiguration =
|
|
26
|
-
pluginConfigurations[targetScreenConfiguration
|
|
26
|
+
pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
|
|
27
27
|
|
|
28
28
|
const playerPluginConfig = playerManager.getPluginConfiguration();
|
|
29
29
|
|
|
30
30
|
const config = R.mergeRight(playerPluginConfig, {
|
|
31
|
-
...targetScreenConfiguration
|
|
32
|
-
...targetScreenConfiguration
|
|
31
|
+
...targetScreenConfiguration?.general,
|
|
32
|
+
...targetScreenConfiguration?.styles,
|
|
33
33
|
...pluginConfiguration,
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const {
|
|
37
|
-
|
|
36
|
+
const {
|
|
37
|
+
minimised_height = 0,
|
|
38
|
+
minimised_height_tablet = 0,
|
|
39
|
+
modal_background_color,
|
|
40
|
+
} = config;
|
|
38
41
|
|
|
39
42
|
const minimisedHeight = useIsTablet()
|
|
40
43
|
? minimised_height_tablet
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { shallow } from "enzyme";
|
|
6
|
+
import { create, act } from "react-test-renderer";
|
|
7
|
+
import { shallowToJson } from "enzyme-to-json";
|
|
8
|
+
|
|
9
|
+
import { ViewportEvents } from "../../ViewportEvents";
|
|
10
|
+
|
|
11
|
+
jest.useFakeTimers();
|
|
5
12
|
|
|
13
|
+
jest.mock("react-native/Libraries/ReactNative/UIManager", () => {
|
|
6
14
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
success(100, 100, 400, 400);
|
|
11
|
-
}),
|
|
12
|
-
},
|
|
13
|
-
findNodeHandle: jest.fn(() => 1234),
|
|
14
|
-
Animated: {
|
|
15
|
-
timing: jest.fn(() => ({ start: jest.fn() })),
|
|
15
|
+
...jest.requireActual("react-native/Libraries/ReactNative/NativeUIManager"),
|
|
16
|
+
measureLayout: (handle, parent, error, success) => {
|
|
17
|
+
success(100, 100, 400, 400);
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
jest.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
|
|
23
|
+
...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
|
|
24
|
+
findNodeHandle: () => 1234,
|
|
25
|
+
}));
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
import TestRenderer from "react-test-renderer";
|
|
24
|
-
import { act } from "@testing-library/react-hooks";
|
|
25
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
27
|
+
const ReactNative = require("react-native");
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
const { Animated, ScrollView } = ReactNative;
|
|
30
|
+
|
|
31
|
+
Animated.timing = jest.fn(() => ({ start: jest.fn() }));
|
|
28
32
|
|
|
29
33
|
const viewportEventsManager = new ViewportEvents(true);
|
|
30
34
|
|
|
31
|
-
const {
|
|
32
|
-
const { ViewportAware } = require("../index");
|
|
35
|
+
const { ViewportAware } = require("../");
|
|
33
36
|
const { ViewportTracker } = require("../../ViewportTracker");
|
|
34
37
|
|
|
35
38
|
const TestComponent = (props) => {
|
|
@@ -116,7 +119,7 @@ describe("<ViewportAware />", () => {
|
|
|
116
119
|
});
|
|
117
120
|
|
|
118
121
|
it("invokes the onViewportEnter function when entering the viewport", () => {
|
|
119
|
-
const wrapper =
|
|
122
|
+
const wrapper = create(
|
|
120
123
|
getWrapper(() => (
|
|
121
124
|
<TestComponent
|
|
122
125
|
preTriggerRatio={0.1}
|
|
@@ -134,6 +137,8 @@ describe("<ViewportAware />", () => {
|
|
|
134
137
|
width: 1920,
|
|
135
138
|
height: 1080,
|
|
136
139
|
});
|
|
140
|
+
|
|
141
|
+
jest.runAllTimers();
|
|
137
142
|
});
|
|
138
143
|
|
|
139
144
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
@@ -151,7 +156,7 @@ describe("<ViewportAware />", () => {
|
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
it("invokes the onViewportLeave function when leaving the viewport", () => {
|
|
154
|
-
const wrapper =
|
|
159
|
+
const wrapper = create(
|
|
155
160
|
getWrapper(() => (
|
|
156
161
|
<TestComponent
|
|
157
162
|
preTriggerRatio={0.1}
|