@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3552323332 → 14.0.0-alpha.4009339136
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/MasterCell/index.tsx +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +7 -17
- package/Components/PlayerImageBackground/index.tsx +1 -1
- 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/index.ts +2 -0
- package/Components/VideoModal/hooks/useBackgroundColor.ts +10 -0
- package/Components/VideoModal/utils.ts +0 -6
- package/package.json +5 -5
- 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
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
|
|
18
18
|
|
|
19
19
|
import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
useModalSize,
|
|
22
|
+
useBackgroundColor,
|
|
23
|
+
useInitialPlayerState,
|
|
24
|
+
} from "./hooks";
|
|
21
25
|
|
|
22
26
|
import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
|
|
23
27
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
@@ -29,6 +33,8 @@ import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
|
29
33
|
import { Spinner } from "../Spinner";
|
|
30
34
|
import { OpaqueLayer } from "./OpaqueLayer";
|
|
31
35
|
|
|
36
|
+
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
37
|
+
|
|
32
38
|
const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
|
|
33
39
|
|
|
34
40
|
const styles = StyleSheet.create({
|
|
@@ -59,6 +65,7 @@ const VideoModalComponent = () => {
|
|
|
59
65
|
|
|
60
66
|
const modalSize = useModalSize();
|
|
61
67
|
const isFirstRender = useIsInitialRender();
|
|
68
|
+
const backgroundColor = useBackgroundColor();
|
|
62
69
|
|
|
63
70
|
const {
|
|
64
71
|
closeVideoModal,
|
|
@@ -138,13 +145,20 @@ const VideoModalComponent = () => {
|
|
|
138
145
|
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
139
146
|
|
|
140
147
|
{itemIdHooksFinished === item?.id ? (
|
|
141
|
-
<
|
|
148
|
+
<AnimatedPlayerModalWrapper
|
|
149
|
+
style={[
|
|
150
|
+
styles.container,
|
|
151
|
+
{
|
|
152
|
+
backgroundColor,
|
|
153
|
+
},
|
|
154
|
+
]}
|
|
155
|
+
>
|
|
142
156
|
<HandlePlayable
|
|
143
157
|
item={item}
|
|
144
158
|
isModal={mode !== "PIP"}
|
|
145
159
|
mode={mode}
|
|
146
160
|
/>
|
|
147
|
-
</
|
|
161
|
+
</AnimatedPlayerModalWrapper>
|
|
148
162
|
) : (
|
|
149
163
|
<View style={styles.loaderContainer}>
|
|
150
164
|
<Spinner />
|
|
@@ -13,7 +13,6 @@ const props = {
|
|
|
13
13
|
tablet_landscape_sidebar_width: "35%",
|
|
14
14
|
tablet_landscape_player_container_background_color: "red",
|
|
15
15
|
},
|
|
16
|
-
playerContent: jest.fn(() => <></>),
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
const mockUseIsDeviceTablet = jest.fn();
|
|
@@ -123,6 +122,13 @@ describe("PlayerWrapper", () => {
|
|
|
123
122
|
</PlayerWrapper>
|
|
124
123
|
);
|
|
125
124
|
|
|
125
|
+
const expectDimensions = {
|
|
126
|
+
...dimensions,
|
|
127
|
+
width: undefined,
|
|
128
|
+
aspectRatio: 16 / 9,
|
|
129
|
+
};
|
|
130
|
+
|
|
126
131
|
expect(element).toMatchSnapshot();
|
|
132
|
+
expect(children).toHaveBeenCalledWith(expectDimensions);
|
|
127
133
|
});
|
|
128
134
|
});
|
|
@@ -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
|
`;
|
|
@@ -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
|
+
};
|
|
@@ -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
|
|
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.4009339136",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"redux-mock-store": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"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.
|
|
34
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.4009339136",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.4009339136",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.4009339136",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.4009339136",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"url": "^0.11.0",
|
|
40
40
|
"uuid": "^3.3.2"
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { View, ImageBackground, Animated } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
-
|
|
6
|
-
import { Artwork } from "./Artwork";
|
|
7
|
-
import { directionStyles } from "./helpers";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
artwork?: string;
|
|
11
|
-
config: {
|
|
12
|
-
titleColor: string;
|
|
13
|
-
summaryColor: string;
|
|
14
|
-
backgroundColor: string;
|
|
15
|
-
backgroundImage: string;
|
|
16
|
-
isRTL: boolean;
|
|
17
|
-
artworkBorderRadius: Option<number>;
|
|
18
|
-
};
|
|
19
|
-
children: React.ReactNode;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function AudioPlayerLayout({ artwork, config, children }: Props) {
|
|
23
|
-
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
24
|
-
|
|
25
|
-
const fadeAudioPlayerIn = () => {
|
|
26
|
-
Animated.timing(fadeAnimation, {
|
|
27
|
-
toValue: 1,
|
|
28
|
-
duration: 3000,
|
|
29
|
-
useNativeDriver: true,
|
|
30
|
-
}).start();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
34
|
-
|
|
35
|
-
const backgroundImageSource = { uri: backgroundImage || artwork };
|
|
36
|
-
|
|
37
|
-
const backgroundColorStyle = backgroundImageSource.uri
|
|
38
|
-
? "transparent"
|
|
39
|
-
: backgroundColor;
|
|
40
|
-
|
|
41
|
-
const mainContainerStyles = platformSelect({
|
|
42
|
-
tvos: {
|
|
43
|
-
width: "100%",
|
|
44
|
-
height: "100%",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
48
|
-
backgroundColor: backgroundColorStyle,
|
|
49
|
-
},
|
|
50
|
-
android_tv: {
|
|
51
|
-
width: "100%",
|
|
52
|
-
height: "100%",
|
|
53
|
-
alignItems: "center",
|
|
54
|
-
justifyContent: "center",
|
|
55
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
56
|
-
backgroundColor: backgroundColorStyle,
|
|
57
|
-
},
|
|
58
|
-
web: {
|
|
59
|
-
width: 1920,
|
|
60
|
-
height: 1080,
|
|
61
|
-
alignItems: "center",
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
64
|
-
backgroundColor: backgroundColorStyle,
|
|
65
|
-
},
|
|
66
|
-
native: {
|
|
67
|
-
backgroundColor: backgroundColorStyle,
|
|
68
|
-
overflow: "hidden",
|
|
69
|
-
width: "100%",
|
|
70
|
-
height: "100%",
|
|
71
|
-
},
|
|
72
|
-
samsung_tv: {
|
|
73
|
-
position: "absolute",
|
|
74
|
-
margin: "auto",
|
|
75
|
-
display: "flex",
|
|
76
|
-
flexWrap: "wrap",
|
|
77
|
-
width: "100vw",
|
|
78
|
-
flex: 1,
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
justifyContent: "center",
|
|
81
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
82
|
-
backgroundColor: backgroundColorStyle,
|
|
83
|
-
},
|
|
84
|
-
lg_tv: {
|
|
85
|
-
position: "absolute",
|
|
86
|
-
margin: "auto",
|
|
87
|
-
display: "flex",
|
|
88
|
-
flexWrap: "wrap",
|
|
89
|
-
width: "100vw",
|
|
90
|
-
flex: 1,
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
justifyContent: "center",
|
|
93
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
94
|
-
backgroundColor: backgroundColorStyle,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const backgroundImgStyles = platformSelect({
|
|
99
|
-
tvos: {
|
|
100
|
-
width: "100%",
|
|
101
|
-
height: "100%",
|
|
102
|
-
alignItems: "center",
|
|
103
|
-
justifyContent: "center",
|
|
104
|
-
},
|
|
105
|
-
android_tv: {
|
|
106
|
-
width: "100%",
|
|
107
|
-
height: "100%",
|
|
108
|
-
alignItems: "center",
|
|
109
|
-
justifyContent: "center",
|
|
110
|
-
},
|
|
111
|
-
web: {
|
|
112
|
-
position: "absolute",
|
|
113
|
-
margin: "auto",
|
|
114
|
-
display: "flex",
|
|
115
|
-
flexWrap: "wrap",
|
|
116
|
-
width: "100%",
|
|
117
|
-
height: "100%",
|
|
118
|
-
flex: 1,
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
justifyContent: "center",
|
|
121
|
-
},
|
|
122
|
-
native: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const textContainerStyles = platformSelect({
|
|
128
|
-
tvos: {
|
|
129
|
-
width: 600,
|
|
130
|
-
height: 362,
|
|
131
|
-
marginHorizontal: 24,
|
|
132
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
133
|
-
},
|
|
134
|
-
android_tv: {
|
|
135
|
-
width: 600,
|
|
136
|
-
height: 362,
|
|
137
|
-
marginHorizontal: 24,
|
|
138
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
139
|
-
},
|
|
140
|
-
web: {
|
|
141
|
-
margin: 10,
|
|
142
|
-
height: "100vh",
|
|
143
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
144
|
-
justifyContent: "center",
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
|
|
149
|
-
<ImageBackground
|
|
150
|
-
source={backgroundImageSource}
|
|
151
|
-
style={backgroundImgStyles}
|
|
152
|
-
resizeMode="cover"
|
|
153
|
-
>
|
|
154
|
-
<View style={mainContainerStyles}>
|
|
155
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
156
|
-
<View style={textContainerStyles}>{children}</View>
|
|
157
|
-
</View>
|
|
158
|
-
</ImageBackground>
|
|
159
|
-
) : (
|
|
160
|
-
<View style={mainContainerStyles}>
|
|
161
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
162
|
-
<View style={textContainerStyles}>{children}</View>
|
|
163
|
-
</View>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
const audioPlayerLayoutMobile = () => {
|
|
167
|
-
fadeAudioPlayerIn();
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<View style={mainContainerStyles} pointerEvents="none">
|
|
171
|
-
<Animated.View
|
|
172
|
-
style={[
|
|
173
|
-
mainContainerStyles,
|
|
174
|
-
{
|
|
175
|
-
opacity: fadeAnimation,
|
|
176
|
-
},
|
|
177
|
-
]}
|
|
178
|
-
>
|
|
179
|
-
<ImageBackground
|
|
180
|
-
source={backgroundImageSource}
|
|
181
|
-
style={backgroundImgStyles}
|
|
182
|
-
resizeMode="cover"
|
|
183
|
-
>
|
|
184
|
-
<View style={mainContainerStyles} />
|
|
185
|
-
</ImageBackground>
|
|
186
|
-
</Animated.View>
|
|
187
|
-
</View>
|
|
188
|
-
);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const audioPlayerLayout = platformSelect({
|
|
192
|
-
tvos: audioPlayerLayoutTV,
|
|
193
|
-
android_tv: audioPlayerLayoutTV,
|
|
194
|
-
web: audioPlayerLayoutTV,
|
|
195
|
-
samsung_tv: audioPlayerLayoutTV,
|
|
196
|
-
lg_tv: audioPlayerLayoutTV,
|
|
197
|
-
ios: audioPlayerLayoutMobile(),
|
|
198
|
-
android: audioPlayerLayoutMobile(),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
return audioPlayerLayout;
|
|
202
|
-
}
|