@applicaster/zapp-react-native-ui-components 14.0.0-alpha.2345544020 → 14.0.0-alpha.3552323332

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.
Files changed (34) hide show
  1. package/Components/AudioPlayer/Artwork.tsx +13 -12
  2. package/Components/AudioPlayer/AudioPlayer.tsx +2 -2
  3. package/Components/AudioPlayer/AudioPlayerLayout.tsx +10 -11
  4. package/Components/AudioPlayer/Runtime.tsx +2 -1
  5. package/Components/AudioPlayer/Summary.tsx +12 -9
  6. package/Components/AudioPlayer/Title.tsx +12 -9
  7. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +2 -2
  8. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +9 -5
  9. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +6 -0
  10. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +6 -0
  11. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +1 -1
  12. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +1 -1
  13. package/Components/AudioPlayer/helpers.tsx +2 -2
  14. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
  15. package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
  16. package/Components/PlayerContainer/PlayerContainer.tsx +17 -7
  17. package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -5
  18. package/Components/River/RiverItem.tsx +8 -8
  19. package/Components/River/TV/River.tsx +0 -3
  20. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -6
  21. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
  22. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
  23. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  24. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  25. package/Components/VideoModal/VideoModal.tsx +3 -17
  26. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  27. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -180
  28. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
  29. package/Components/VideoModal/hooks/index.ts +0 -2
  30. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
  31. package/Components/VideoModal/utils.ts +6 -0
  32. package/index.d.ts +0 -1
  33. package/package.json +5 -5
  34. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
@@ -21,57 +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
- "flexDirection": "column",
30
+ "alignSelf": "center",
31
+ "position": "relative",
32
+ "zIndex": 200,
48
33
  },
34
+ {},
49
35
  {
50
- "flex": 1,
36
+ "aspectRatio": 1.7777777777777777,
37
+ "height": undefined,
38
+ "width": "100%",
51
39
  },
40
+ {},
52
41
  ]
53
42
  }
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>
43
+ testID="test-player-container"
44
+ />
75
45
  </RNCSafeAreaView>
76
46
  </RNCSafeAreaProvider>
77
47
  `;
@@ -97,57 +67,27 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
97
67
  "top": "additive",
98
68
  }
99
69
  }
100
- style={
101
- [
102
- {
103
- "backgroundColor": "transparent",
104
- },
105
- {
106
- "height": undefined,
107
- "width": 300,
108
- },
109
- {},
110
- ]
111
- }
70
+ style={{}}
112
71
  >
113
72
  <View
114
- additionalData={
115
- {
116
- "saveArea": true,
117
- }
118
- }
119
- animationType="moveUpComponent"
120
73
  style={
121
74
  [
122
75
  {
123
- "flexDirection": "column",
76
+ "alignSelf": "center",
77
+ "position": "relative",
78
+ "zIndex": 200,
124
79
  },
80
+ {},
125
81
  {
126
- "flex": 1,
82
+ "aspectRatio": 1.7777777777777777,
83
+ "height": undefined,
84
+ "width": "100%",
127
85
  },
86
+ {},
128
87
  ]
129
88
  }
130
- >
131
- <View
132
- style={
133
- [
134
- {
135
- "alignSelf": "center",
136
- "position": "relative",
137
- "zIndex": 200,
138
- },
139
- {
140
- "aspectRatio": undefined,
141
- "height": undefined,
142
- "width": "100%",
143
- },
144
- {},
145
- {},
146
- ]
147
- }
148
- testID="test-player-container"
149
- />
150
- </View>
89
+ testID="test-player-container"
90
+ />
151
91
  </RNCSafeAreaView>
152
92
  </RNCSafeAreaProvider>
153
93
  `;
@@ -173,73 +113,27 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
173
113
  "top": "additive",
174
114
  }
175
115
  }
176
- style={
177
- [
178
- {
179
- "backgroundColor": "red",
180
- },
181
- {
182
- "height": 800,
183
- "width": 300,
184
- },
185
- {},
186
- ]
187
- }
116
+ style={{}}
188
117
  >
189
118
  <View
190
- additionalData={
191
- {
192
- "saveArea": true,
193
- }
194
- }
195
- animationType="moveUpComponent"
196
119
  style={
197
120
  [
198
121
  {
199
- "flexDirection": "row",
122
+ "alignSelf": "center",
123
+ "position": "relative",
124
+ "zIndex": 200,
200
125
  },
126
+ {},
201
127
  {
202
- "flex": 1,
128
+ "aspectRatio": 1.7777777777777777,
129
+ "height": undefined,
130
+ "width": 195,
203
131
  },
132
+ {},
204
133
  ]
205
134
  }
206
- >
207
- <View
208
- style={
209
- [
210
- {
211
- "alignSelf": "center",
212
- "position": "relative",
213
- "zIndex": 200,
214
- },
215
- {
216
- "aspectRatio": 1.7777777777777777,
217
- "height": undefined,
218
- "width": 195,
219
- },
220
- {},
221
- {},
222
- ]
223
- }
224
- testID="test-player-container"
225
- >
226
- <View
227
- additionalData={
228
- {
229
- "disableAnimatedComponent": false,
230
- "resetAnimationValue": undefined,
231
- "useLayoutMeasure": true,
232
- }
233
- }
234
- animationType="moveUpComponent"
235
- style={
236
- {
237
- "flex": 1,
238
- }
239
- }
240
- />
241
- </View>
242
- </View>
135
+ testID="test-player-container"
136
+ />
243
137
  </RNCSafeAreaView>
244
138
  </RNCSafeAreaProvider>
245
139
  `;
@@ -265,57 +159,27 @@ exports[`PlayerWrapper renders properly 1`] = `
265
159
  "top": "additive",
266
160
  }
267
161
  }
268
- style={
269
- [
270
- {
271
- "backgroundColor": "transparent",
272
- },
273
- {
274
- "height": 800,
275
- "width": 300,
276
- },
277
- {},
278
- ]
279
- }
162
+ style={{}}
280
163
  >
281
164
  <View
282
- additionalData={
283
- {
284
- "saveArea": true,
285
- }
286
- }
287
- animationType="moveUpComponent"
288
165
  style={
289
166
  [
290
167
  {
291
- "flexDirection": "column",
168
+ "alignSelf": "center",
169
+ "position": "relative",
170
+ "zIndex": 200,
292
171
  },
172
+ {},
293
173
  {
294
- "flex": 1,
174
+ "aspectRatio": 1.7786666666666666,
175
+ "height": undefined,
176
+ "width": "100%",
295
177
  },
178
+ {},
296
179
  ]
297
180
  }
298
- >
299
- <View
300
- style={
301
- [
302
- {
303
- "alignSelf": "center",
304
- "position": "relative",
305
- "zIndex": 200,
306
- },
307
- {
308
- "aspectRatio": 1.7786666666666666,
309
- "height": undefined,
310
- "width": "100%",
311
- },
312
- {},
313
- {},
314
- ]
315
- }
316
- testID="test-player-container"
317
- />
318
- </View>
181
+ testID="test-player-container"
182
+ />
319
183
  </RNCSafeAreaView>
320
184
  </RNCSafeAreaProvider>
321
185
  `;
@@ -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 false initially", () => {
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(false);
19
+ expect(result.current).toBe(true);
34
20
  });
35
21
 
36
- it("should return true if showDetails returns true", () => {
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: false, isPip: false })
24
+ useDelayedPlayerDetails({ isInline: true, isDocked: true, isPip: true })
50
25
  );
51
26
 
52
- expect(result.current).toBe(true);
27
+ expect(result.current).toBe(false);
53
28
  });
54
29
 
55
- it("should return false if showDetails returns 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: false, isPip: false })
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 unsubscribe on unmount", () => {
75
- const unsubscribeMock = jest.fn();
38
+ it("should return true for tablet regardless of other flags", () => {
39
+ (useIsTablet as jest.Mock).mockReturnValue(true);
76
40
 
77
- (withTimeout$ as jest.Mock).mockReturnValue({
78
- subscribe: jest.fn().mockReturnValue({ unsubscribe: unsubscribeMock }),
79
- });
80
-
81
- const { unmount } = renderHook(() =>
82
- useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
41
+ const { result } = renderHook(() =>
42
+ useDelayedPlayerDetails({
43
+ isInline: false,
44
+ isDocked: false,
45
+ isPip: false,
46
+ })
83
47
  );
84
48
 
85
- unmount();
86
-
87
- expect(unsubscribeMock).toHaveBeenCalled();
49
+ expect(result.current).toBe(true);
88
50
  });
89
51
  });
@@ -1,5 +1,3 @@
1
- export { useBackgroundColor } from "./useBackgroundColor";
2
-
3
1
  export { useDelayedPlayerDetails } from "./useDelayedPlayerDetails";
4
2
 
5
3
  export { useInitialPlayerState } from "./useInitialPlayerState";
@@ -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
- React.useEffect(() => {
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,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
 
package/index.d.ts CHANGED
@@ -24,7 +24,6 @@ type GeneralContentScreenProps = {
24
24
  } & Record<string, any>;
25
25
  focused?: boolean;
26
26
  parentFocus?: ParentFocus;
27
- extraOffset?: number;
28
27
  containerHeight?: number;
29
28
  };
30
29
 
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.2345544020",
3
+ "version": "14.0.0-alpha.3552323332",
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.2345544020",
35
- "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.2345544020",
36
- "@applicaster/zapp-react-native-redux": "14.0.0-alpha.2345544020",
37
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.2345544020",
34
+ "@applicaster/applicaster-types": "14.0.0-alpha.3552323332",
35
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.3552323332",
36
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.3552323332",
37
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.3552323332",
38
38
  "promise": "^8.3.0",
39
39
  "url": "^0.11.0",
40
40
  "uuid": "^3.3.2"
@@ -1,10 +0,0 @@
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
- };