@applicaster/zapp-react-native-ui-components 14.0.0-alpha.8419134002 → 14.0.0-alpha.8557119261
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/mobile/Layout.tsx +1 -1
- package/Components/AudioPlayer/tv/helpers.tsx +10 -3
- package/Components/BaseFocusable/index.tsx +23 -12
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
- package/Components/Cell/index.js +1 -1
- package/Components/ComponentResolver/index.ts +1 -1
- package/Components/FeedLoader/FeedLoader.tsx +6 -15
- package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
- package/Components/FeedLoader/index.js +2 -8
- package/Components/Focusable/Focusable.tsx +5 -3
- package/Components/Focusable/FocusableTvOS.tsx +3 -3
- package/Components/Focusable/FocusableiOS.tsx +2 -2
- package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
- package/Components/Focusable/index.android.tsx +12 -8
- package/Components/Focusable/index.tsx +1 -1
- package/Components/FocusableList/index.tsx +4 -0
- package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +13 -10
- package/Components/HandlePlayable/HandlePlayable.tsx +25 -9
- package/Components/Layout/TV/LayoutBackground.tsx +1 -1
- package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
- package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
- package/Components/MasterCell/elementMapper.tsx +1 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
- package/Components/MasterCell/utils/index.ts +11 -5
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
- package/Components/OfflineHandler/__tests__/index.test.tsx +26 -35
- package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +41 -28
- package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
- package/Components/PlayerContainer/index.ts +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +0 -1
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +378 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
- package/Components/River/RefreshControl.tsx +11 -17
- package/Components/River/TV/River.tsx +2 -17
- package/Components/River/TV/index.tsx +3 -1
- package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
- package/Components/River/TV/withRiverDataLoader.tsx +17 -0
- package/Components/River/TV/withTVEventHandler.tsx +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/River/__tests__/river.test.js +12 -26
- package/Components/River/index.tsx +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +28 -29
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
- package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
- package/Components/ScreenRevealManager/index.ts +1 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +79 -0
- package/Components/Tabs/TV/Tabs.android.tsx +0 -2
- package/Components/Tabs/Tabs.tsx +2 -3
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
- package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
- package/Components/VideoLive/animationUtils.ts +3 -3
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +3 -9
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -8
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useModalSize.ts +18 -2
- package/Components/VideoModal/utils.ts +6 -0
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
- package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
- package/Contexts/ScreenContext/index.tsx +46 -6
- package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
- package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
- package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
- package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
- package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
- package/Decorators/RiverFeedLoader/index.tsx +22 -4
- package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
- package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
- package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
- package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
- package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
- package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
- package/Decorators/ZappPipesDataConnector/index.tsx +26 -293
- package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +266 -0
- package/Decorators/ZappPipesDataConnector/types.ts +29 -0
- package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
- package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +157 -0
- package/events/index.ts +1 -0
- package/package.json +5 -10
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
|
@@ -21,87 +21,27 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
21
21
|
"top": "additive",
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
style={
|
|
25
|
-
[
|
|
26
|
-
{
|
|
27
|
-
"backgroundColor": "transparent",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"height": 800,
|
|
31
|
-
"width": 300,
|
|
32
|
-
},
|
|
33
|
-
{},
|
|
34
|
-
]
|
|
35
|
-
}
|
|
24
|
+
style={{}}
|
|
36
25
|
>
|
|
37
26
|
<View
|
|
38
|
-
additionalData={
|
|
39
|
-
{
|
|
40
|
-
"saveArea": true,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
animationType="moveUpComponent"
|
|
44
27
|
style={
|
|
45
28
|
[
|
|
46
29
|
{
|
|
47
|
-
"
|
|
30
|
+
"alignSelf": "center",
|
|
31
|
+
"position": "relative",
|
|
32
|
+
"zIndex": 200,
|
|
48
33
|
},
|
|
34
|
+
{},
|
|
49
35
|
{
|
|
50
|
-
"
|
|
36
|
+
"aspectRatio": 1.7777777777777777,
|
|
37
|
+
"height": undefined,
|
|
38
|
+
"width": "100%",
|
|
51
39
|
},
|
|
40
|
+
{},
|
|
52
41
|
]
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
style={
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
"alignSelf": "center",
|
|
60
|
-
"position": "relative",
|
|
61
|
-
"zIndex": 200,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"aspectRatio": 1.7777777777777777,
|
|
65
|
-
"height": undefined,
|
|
66
|
-
"width": "100%",
|
|
67
|
-
},
|
|
68
|
-
{},
|
|
69
|
-
{},
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
testID="test-player-container"
|
|
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>
|
|
104
|
-
</View>
|
|
43
|
+
testID="test-player-container"
|
|
44
|
+
/>
|
|
105
45
|
</RNCSafeAreaView>
|
|
106
46
|
</RNCSafeAreaProvider>
|
|
107
47
|
`;
|
|
@@ -127,57 +67,27 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
127
67
|
"top": "additive",
|
|
128
68
|
}
|
|
129
69
|
}
|
|
130
|
-
style={
|
|
131
|
-
[
|
|
132
|
-
{
|
|
133
|
-
"backgroundColor": "transparent",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"height": undefined,
|
|
137
|
-
"width": 300,
|
|
138
|
-
},
|
|
139
|
-
{},
|
|
140
|
-
]
|
|
141
|
-
}
|
|
70
|
+
style={{}}
|
|
142
71
|
>
|
|
143
72
|
<View
|
|
144
|
-
additionalData={
|
|
145
|
-
{
|
|
146
|
-
"saveArea": true,
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
animationType="moveUpComponent"
|
|
150
73
|
style={
|
|
151
74
|
[
|
|
152
75
|
{
|
|
153
|
-
"
|
|
76
|
+
"alignSelf": "center",
|
|
77
|
+
"position": "relative",
|
|
78
|
+
"zIndex": 200,
|
|
154
79
|
},
|
|
80
|
+
{},
|
|
155
81
|
{
|
|
156
|
-
"
|
|
82
|
+
"aspectRatio": 1.7777777777777777,
|
|
83
|
+
"height": undefined,
|
|
84
|
+
"width": "100%",
|
|
157
85
|
},
|
|
86
|
+
{},
|
|
158
87
|
]
|
|
159
88
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
style={
|
|
163
|
-
[
|
|
164
|
-
{
|
|
165
|
-
"alignSelf": "center",
|
|
166
|
-
"position": "relative",
|
|
167
|
-
"zIndex": 200,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"aspectRatio": undefined,
|
|
171
|
-
"height": undefined,
|
|
172
|
-
"width": "100%",
|
|
173
|
-
},
|
|
174
|
-
{},
|
|
175
|
-
{},
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
testID="test-player-container"
|
|
179
|
-
/>
|
|
180
|
-
</View>
|
|
89
|
+
testID="test-player-container"
|
|
90
|
+
/>
|
|
181
91
|
</RNCSafeAreaView>
|
|
182
92
|
</RNCSafeAreaProvider>
|
|
183
93
|
`;
|
|
@@ -203,103 +113,27 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
203
113
|
"top": "additive",
|
|
204
114
|
}
|
|
205
115
|
}
|
|
206
|
-
style={
|
|
207
|
-
[
|
|
208
|
-
{
|
|
209
|
-
"backgroundColor": "red",
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"height": 800,
|
|
213
|
-
"width": 300,
|
|
214
|
-
},
|
|
215
|
-
{},
|
|
216
|
-
]
|
|
217
|
-
}
|
|
116
|
+
style={{}}
|
|
218
117
|
>
|
|
219
118
|
<View
|
|
220
|
-
additionalData={
|
|
221
|
-
{
|
|
222
|
-
"saveArea": true,
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
animationType="moveUpComponent"
|
|
226
119
|
style={
|
|
227
120
|
[
|
|
228
121
|
{
|
|
229
|
-
"
|
|
122
|
+
"alignSelf": "center",
|
|
123
|
+
"position": "relative",
|
|
124
|
+
"zIndex": 200,
|
|
230
125
|
},
|
|
126
|
+
{},
|
|
231
127
|
{
|
|
232
|
-
"
|
|
128
|
+
"aspectRatio": 1.7777777777777777,
|
|
129
|
+
"height": undefined,
|
|
130
|
+
"width": 195,
|
|
233
131
|
},
|
|
132
|
+
{},
|
|
234
133
|
]
|
|
235
134
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
style={
|
|
239
|
-
[
|
|
240
|
-
{
|
|
241
|
-
"alignSelf": "center",
|
|
242
|
-
"position": "relative",
|
|
243
|
-
"zIndex": 200,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"aspectRatio": 1.7777777777777777,
|
|
247
|
-
"height": undefined,
|
|
248
|
-
"width": 195,
|
|
249
|
-
},
|
|
250
|
-
{},
|
|
251
|
-
{},
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
testID="test-player-container"
|
|
255
|
-
>
|
|
256
|
-
<View
|
|
257
|
-
additionalData={
|
|
258
|
-
{
|
|
259
|
-
"disableAnimatedComponent": false,
|
|
260
|
-
"resetAnimationValue": undefined,
|
|
261
|
-
"useLayoutMeasure": true,
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
animationType="moveUpComponent"
|
|
265
|
-
style={
|
|
266
|
-
{
|
|
267
|
-
"flex": 1,
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/>
|
|
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>
|
|
302
|
-
</View>
|
|
135
|
+
testID="test-player-container"
|
|
136
|
+
/>
|
|
303
137
|
</RNCSafeAreaView>
|
|
304
138
|
</RNCSafeAreaProvider>
|
|
305
139
|
`;
|
|
@@ -325,57 +159,27 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
325
159
|
"top": "additive",
|
|
326
160
|
}
|
|
327
161
|
}
|
|
328
|
-
style={
|
|
329
|
-
[
|
|
330
|
-
{
|
|
331
|
-
"backgroundColor": "transparent",
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"height": 800,
|
|
335
|
-
"width": 300,
|
|
336
|
-
},
|
|
337
|
-
{},
|
|
338
|
-
]
|
|
339
|
-
}
|
|
162
|
+
style={{}}
|
|
340
163
|
>
|
|
341
164
|
<View
|
|
342
|
-
additionalData={
|
|
343
|
-
{
|
|
344
|
-
"saveArea": true,
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
animationType="moveUpComponent"
|
|
348
165
|
style={
|
|
349
166
|
[
|
|
350
167
|
{
|
|
351
|
-
"
|
|
168
|
+
"alignSelf": "center",
|
|
169
|
+
"position": "relative",
|
|
170
|
+
"zIndex": 200,
|
|
352
171
|
},
|
|
172
|
+
{},
|
|
353
173
|
{
|
|
354
|
-
"
|
|
174
|
+
"aspectRatio": 1.7786666666666666,
|
|
175
|
+
"height": undefined,
|
|
176
|
+
"width": "100%",
|
|
355
177
|
},
|
|
178
|
+
{},
|
|
356
179
|
]
|
|
357
180
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
style={
|
|
361
|
-
[
|
|
362
|
-
{
|
|
363
|
-
"alignSelf": "center",
|
|
364
|
-
"position": "relative",
|
|
365
|
-
"zIndex": 200,
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"aspectRatio": 1.7786666666666666,
|
|
369
|
-
"height": undefined,
|
|
370
|
-
"width": "100%",
|
|
371
|
-
},
|
|
372
|
-
{},
|
|
373
|
-
{},
|
|
374
|
-
]
|
|
375
|
-
}
|
|
376
|
-
testID="test-player-container"
|
|
377
|
-
/>
|
|
378
|
-
</View>
|
|
181
|
+
testID="test-player-container"
|
|
182
|
+
/>
|
|
379
183
|
</RNCSafeAreaView>
|
|
380
184
|
</RNCSafeAreaProvider>
|
|
381
185
|
`;
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
11
11
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
12
|
+
import {
|
|
13
|
+
isAndroidPlatform,
|
|
14
|
+
isAndroidVersionAtLeast,
|
|
15
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
16
|
+
import { StatusBar } from "react-native";
|
|
17
|
+
import { isAndroidTablet } from "@applicaster/zapp-react-native-utils/reactHooks/layout/isTablet";
|
|
12
18
|
|
|
13
19
|
const { Logger } = getXray();
|
|
14
20
|
|
|
@@ -27,12 +33,17 @@ const MODAL_SIZE_FOR_LANDSCAPE: Size = {
|
|
|
27
33
|
height: "100%",
|
|
28
34
|
};
|
|
29
35
|
|
|
36
|
+
const isOldAndroidDevice =
|
|
37
|
+
isAndroidPlatform() && !isAndroidVersionAtLeast(35) && !isAndroidTablet();
|
|
38
|
+
|
|
30
39
|
export const useModalSize = (): Size => {
|
|
31
40
|
const frame = useSafeAreaFrame();
|
|
32
41
|
|
|
33
42
|
const [modalSize, setModalSize] = React.useState<Size>({
|
|
34
43
|
width: frame.width,
|
|
35
|
-
height:
|
|
44
|
+
height: isOldAndroidDevice
|
|
45
|
+
? frame.height + StatusBar.currentHeight
|
|
46
|
+
: frame.height,
|
|
36
47
|
});
|
|
37
48
|
|
|
38
49
|
const setNewModalSize = React.useCallback((newSize, log) => {
|
|
@@ -44,7 +55,12 @@ export const useModalSize = (): Size => {
|
|
|
44
55
|
return oldSize;
|
|
45
56
|
}
|
|
46
57
|
|
|
47
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
width: newSize.width,
|
|
60
|
+
height: isOldAndroidDevice
|
|
61
|
+
? newSize.height + StatusBar.currentHeight
|
|
62
|
+
: newSize.height,
|
|
63
|
+
};
|
|
48
64
|
});
|
|
49
65
|
|
|
50
66
|
logger.debug({
|
|
@@ -34,6 +34,9 @@ export const useConfiguration = () => {
|
|
|
34
34
|
minimised_height = 0,
|
|
35
35
|
minimised_height_tablet = 0,
|
|
36
36
|
modal_background_color,
|
|
37
|
+
tablet_landscape_player_container_background_color,
|
|
38
|
+
screen_background_color,
|
|
39
|
+
audio_player_background_color,
|
|
37
40
|
} = config;
|
|
38
41
|
|
|
39
42
|
const minimisedHeight = useIsTablet()
|
|
@@ -43,6 +46,9 @@ export const useConfiguration = () => {
|
|
|
43
46
|
return {
|
|
44
47
|
minimised_height: Number(minimisedHeight),
|
|
45
48
|
modal_background_color,
|
|
49
|
+
tablet_landscape_player_container_background_color,
|
|
50
|
+
audio_player_background_color,
|
|
51
|
+
screen_background_color,
|
|
46
52
|
};
|
|
47
53
|
};
|
|
48
54
|
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { useConfiguration } from "@applicaster/zapp-react-native-utils/reactHooks/configuration";
|
|
5
5
|
|
|
@@ -14,12 +14,12 @@ describe("withConfigurationProvider", () => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
it("provides configuration to children", () => {
|
|
17
|
-
const
|
|
17
|
+
const { toJSON } = render(
|
|
18
18
|
<ConfigurationProvider configuration={{ target: "foobar" }}>
|
|
19
19
|
<TestComponent />
|
|
20
20
|
</ConfigurationProvider>
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
expect(
|
|
23
|
+
expect(toJSON()).toMatchSnapshot();
|
|
24
24
|
});
|
|
25
25
|
});
|