@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5621117258 → 14.0.0-alpha.6242515303
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/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 -8
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +3 -2
- package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
- package/Components/AudioPlayer/tv/Layout.tsx +168 -0
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +7 -1
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +6 -2
- package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +6 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +1 -2
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +17 -58
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/Cell/index.js +6 -2
- package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
- package/Components/Focusable/index.android.tsx +12 -8
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
- package/Components/HandlePlayable/HandlePlayable.tsx +11 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
- package/Components/MasterCell/index.tsx +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +7 -22
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -5
- package/Components/River/RiverItem.tsx +8 -8
- package/Components/River/TV/River.tsx +0 -3
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -6
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -9
- package/Components/VideoModal/PlayerDetails.tsx +2 -24
- package/Components/VideoModal/PlayerWrapper.tsx +142 -26
- package/Components/VideoModal/VideoModal.tsx +17 -3
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +240 -44
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
- package/Components/VideoModal/hooks/index.ts +2 -0
- package/Components/VideoModal/hooks/useBackgroundColor.ts +10 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/Components/VideoModal/utils.ts +0 -6
- package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
- package/index.d.ts +0 -1
- package/package.json +5 -8
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -72
- package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.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
|
@@ -21,27 +21,87 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
21
21
|
"top": "additive",
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
style={
|
|
24
|
+
style={
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
"backgroundColor": "transparent",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"height": 800,
|
|
31
|
+
"width": 300,
|
|
32
|
+
},
|
|
33
|
+
{},
|
|
34
|
+
]
|
|
35
|
+
}
|
|
25
36
|
>
|
|
26
37
|
<View
|
|
38
|
+
additionalData={
|
|
39
|
+
{
|
|
40
|
+
"saveArea": true,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
animationType="moveUpComponent"
|
|
27
44
|
style={
|
|
28
45
|
[
|
|
29
46
|
{
|
|
30
|
-
"
|
|
31
|
-
"position": "relative",
|
|
32
|
-
"zIndex": 200,
|
|
47
|
+
"flexDirection": "column",
|
|
33
48
|
},
|
|
34
|
-
{},
|
|
35
49
|
{
|
|
36
|
-
"
|
|
37
|
-
"height": undefined,
|
|
38
|
-
"width": "100%",
|
|
50
|
+
"flex": 1,
|
|
39
51
|
},
|
|
40
|
-
{},
|
|
41
52
|
]
|
|
42
53
|
}
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
>
|
|
55
|
+
<View
|
|
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>
|
|
45
105
|
</RNCSafeAreaView>
|
|
46
106
|
</RNCSafeAreaProvider>
|
|
47
107
|
`;
|
|
@@ -67,27 +127,57 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
67
127
|
"top": "additive",
|
|
68
128
|
}
|
|
69
129
|
}
|
|
70
|
-
style={
|
|
130
|
+
style={
|
|
131
|
+
[
|
|
132
|
+
{
|
|
133
|
+
"backgroundColor": "transparent",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"height": undefined,
|
|
137
|
+
"width": 300,
|
|
138
|
+
},
|
|
139
|
+
{},
|
|
140
|
+
]
|
|
141
|
+
}
|
|
71
142
|
>
|
|
72
143
|
<View
|
|
144
|
+
additionalData={
|
|
145
|
+
{
|
|
146
|
+
"saveArea": true,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
animationType="moveUpComponent"
|
|
73
150
|
style={
|
|
74
151
|
[
|
|
75
152
|
{
|
|
76
|
-
"
|
|
77
|
-
"position": "relative",
|
|
78
|
-
"zIndex": 200,
|
|
153
|
+
"flexDirection": "column",
|
|
79
154
|
},
|
|
80
|
-
{},
|
|
81
155
|
{
|
|
82
|
-
"
|
|
83
|
-
"height": undefined,
|
|
84
|
-
"width": "100%",
|
|
156
|
+
"flex": 1,
|
|
85
157
|
},
|
|
86
|
-
{},
|
|
87
158
|
]
|
|
88
159
|
}
|
|
89
|
-
|
|
90
|
-
|
|
160
|
+
>
|
|
161
|
+
<View
|
|
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>
|
|
91
181
|
</RNCSafeAreaView>
|
|
92
182
|
</RNCSafeAreaProvider>
|
|
93
183
|
`;
|
|
@@ -113,27 +203,103 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
113
203
|
"top": "additive",
|
|
114
204
|
}
|
|
115
205
|
}
|
|
116
|
-
style={
|
|
206
|
+
style={
|
|
207
|
+
[
|
|
208
|
+
{
|
|
209
|
+
"backgroundColor": "red",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"height": 800,
|
|
213
|
+
"width": 300,
|
|
214
|
+
},
|
|
215
|
+
{},
|
|
216
|
+
]
|
|
217
|
+
}
|
|
117
218
|
>
|
|
118
219
|
<View
|
|
220
|
+
additionalData={
|
|
221
|
+
{
|
|
222
|
+
"saveArea": true,
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
animationType="moveUpComponent"
|
|
119
226
|
style={
|
|
120
227
|
[
|
|
121
228
|
{
|
|
122
|
-
"
|
|
123
|
-
"position": "relative",
|
|
124
|
-
"zIndex": 200,
|
|
229
|
+
"flexDirection": "row",
|
|
125
230
|
},
|
|
126
|
-
{},
|
|
127
231
|
{
|
|
128
|
-
"
|
|
129
|
-
"height": undefined,
|
|
130
|
-
"width": 195,
|
|
232
|
+
"flex": 1,
|
|
131
233
|
},
|
|
132
|
-
{},
|
|
133
234
|
]
|
|
134
235
|
}
|
|
135
|
-
|
|
136
|
-
|
|
236
|
+
>
|
|
237
|
+
<View
|
|
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>
|
|
137
303
|
</RNCSafeAreaView>
|
|
138
304
|
</RNCSafeAreaProvider>
|
|
139
305
|
`;
|
|
@@ -159,27 +325,57 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
159
325
|
"top": "additive",
|
|
160
326
|
}
|
|
161
327
|
}
|
|
162
|
-
style={
|
|
328
|
+
style={
|
|
329
|
+
[
|
|
330
|
+
{
|
|
331
|
+
"backgroundColor": "transparent",
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"height": 800,
|
|
335
|
+
"width": 300,
|
|
336
|
+
},
|
|
337
|
+
{},
|
|
338
|
+
]
|
|
339
|
+
}
|
|
163
340
|
>
|
|
164
341
|
<View
|
|
342
|
+
additionalData={
|
|
343
|
+
{
|
|
344
|
+
"saveArea": true,
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
animationType="moveUpComponent"
|
|
165
348
|
style={
|
|
166
349
|
[
|
|
167
350
|
{
|
|
168
|
-
"
|
|
169
|
-
"position": "relative",
|
|
170
|
-
"zIndex": 200,
|
|
351
|
+
"flexDirection": "column",
|
|
171
352
|
},
|
|
172
|
-
{},
|
|
173
353
|
{
|
|
174
|
-
"
|
|
175
|
-
"height": undefined,
|
|
176
|
-
"width": "100%",
|
|
354
|
+
"flex": 1,
|
|
177
355
|
},
|
|
178
|
-
{},
|
|
179
356
|
]
|
|
180
357
|
}
|
|
181
|
-
|
|
182
|
-
|
|
358
|
+
>
|
|
359
|
+
<View
|
|
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>
|
|
183
379
|
</RNCSafeAreaView>
|
|
184
380
|
</RNCSafeAreaProvider>
|
|
185
381
|
`;
|
|
@@ -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
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
2
|
+
import { useConfiguration } from "../utils";
|
|
3
|
+
|
|
4
|
+
export const useBackgroundColor = (): string => {
|
|
5
|
+
const { modal_background_color: modalBackgroundColor } = useConfiguration();
|
|
6
|
+
|
|
7
|
+
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
8
|
+
|
|
9
|
+
return modalBackgroundColor || theme?.status_background_color;
|
|
10
|
+
};
|
|
@@ -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
|
};
|
|
@@ -34,9 +34,6 @@ 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,
|
|
40
37
|
} = config;
|
|
41
38
|
|
|
42
39
|
const minimisedHeight = useIsTablet()
|
|
@@ -46,9 +43,6 @@ export const useConfiguration = () => {
|
|
|
46
43
|
return {
|
|
47
44
|
minimised_height: Number(minimisedHeight),
|
|
48
45
|
modal_background_color,
|
|
49
|
-
tablet_landscape_player_container_background_color,
|
|
50
|
-
audio_player_background_color,
|
|
51
|
-
screen_background_color,
|
|
52
46
|
};
|
|
53
47
|
};
|
|
54
48
|
|
|
@@ -4,8 +4,8 @@ which helps in detecting whether a given component is visible within the viewpor
|
|
|
4
4
|
It is useful for implementing lazy loading or triggering specific actions when a component comes into view.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, {
|
|
8
|
-
import {
|
|
7
|
+
import React, { FC, ReactNode, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { Dimensions, View } from "react-native";
|
|
9
9
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
10
10
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
11
11
|
|
|
@@ -78,7 +78,7 @@ const VisibilitySensorComponent: FC<Props> = ({
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const stopWatching = () => {
|
|
81
|
-
|
|
81
|
+
clearInterval(interval);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
const isInViewPort = () => {
|
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": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.6242515303",
|
|
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",
|
|
@@ -27,14 +27,11 @@
|
|
|
27
27
|
"url": "https://github.com/applicaster/quickbrick/issues"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"redux-mock-store": "^1.5.3"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "14.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.6242515303",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.6242515303",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.6242515303",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.6242515303",
|
|
38
35
|
"promise": "^8.3.0",
|
|
39
36
|
"url": "^0.11.0",
|
|
40
37
|
"uuid": "^3.3.2"
|