@applicaster/zapp-react-native-ui-components 14.0.0-alpha.1661204539 → 14.0.0-alpha.1887720441

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 (122) hide show
  1. package/Components/AnimatedInOut/index.tsx +5 -3
  2. package/Components/AudioPlayer/index.tsx +15 -0
  3. package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
  4. package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -2
  5. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  6. package/Components/AudioPlayer/mobile/index.tsx +18 -0
  7. package/Components/AudioPlayer/tv/Artwork.tsx +41 -0
  8. package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
  9. package/Components/AudioPlayer/tv/Layout.tsx +168 -0
  10. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +9 -2
  11. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +17 -10
  12. package/Components/AudioPlayer/tv/Title.tsx +46 -0
  13. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +4 -4
  14. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +9 -4
  15. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
  16. package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
  17. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +2 -3
  18. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +2 -3
  19. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
  20. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +13 -7
  21. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +18 -57
  22. package/Components/AudioPlayer/types.ts +40 -0
  23. package/Components/Cell/index.js +7 -3
  24. package/Components/ComponentResolver/index.ts +1 -1
  25. package/Components/FeedLoader/index.js +1 -1
  26. package/Components/Focusable/Focusable.tsx +5 -3
  27. package/Components/Focusable/FocusableTvOS.tsx +3 -3
  28. package/Components/Focusable/FocusableiOS.tsx +2 -2
  29. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  30. package/Components/Focusable/index.android.tsx +12 -8
  31. package/Components/Focusable/index.tsx +1 -1
  32. package/Components/FocusableList/index.tsx +4 -0
  33. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
  34. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
  35. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +12 -8
  36. package/Components/HandlePlayable/HandlePlayable.tsx +25 -9
  37. package/Components/Layout/TV/LayoutBackground.tsx +1 -1
  38. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
  39. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
  40. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
  41. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
  42. package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
  43. package/Components/MasterCell/elementMapper.tsx +1 -2
  44. package/Components/MasterCell/index.tsx +1 -1
  45. package/Components/MasterCell/utils/behaviorProvider.ts +12 -67
  46. package/Components/MasterCell/utils/index.ts +3 -13
  47. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
  48. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
  49. package/Components/OfflineHandler/__tests__/index.test.tsx +20 -22
  50. package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
  51. package/Components/PlayerContainer/PlayerContainer.tsx +62 -66
  52. package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
  53. package/Components/PlayerContainer/index.ts +1 -1
  54. package/Components/PlayerImageBackground/index.tsx +1 -1
  55. package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -6
  56. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +379 -0
  57. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
  58. package/Components/River/RefreshControl.tsx +6 -4
  59. package/Components/River/RiverItem.tsx +8 -8
  60. package/Components/River/TV/River.tsx +2 -20
  61. package/Components/River/TV/index.tsx +3 -1
  62. package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
  63. package/Components/River/TV/withRiverDataLoader.tsx +17 -0
  64. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  65. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -6
  66. package/Components/River/index.tsx +1 -1
  67. package/Components/Screen/__tests__/Screen.test.tsx +23 -12
  68. package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
  69. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
  70. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
  71. package/Components/ScreenRevealManager/index.ts +1 -0
  72. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +79 -0
  73. package/Components/Tabs/TV/Tabs.android.tsx +0 -2
  74. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
  75. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
  76. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
  77. package/Components/VideoLive/animationUtils.ts +3 -3
  78. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -8
  79. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  80. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  81. package/Components/VideoModal/VideoModal.tsx +3 -17
  82. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  83. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -180
  84. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
  85. package/Components/VideoModal/hooks/index.ts +0 -2
  86. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
  87. package/Components/VideoModal/hooks/useModalSize.ts +18 -2
  88. package/Components/VideoModal/utils.ts +6 -0
  89. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
  90. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
  91. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  92. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  93. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  94. package/Decorators/RiverFeedLoader/index.tsx +2 -8
  95. package/Decorators/RiverFeedLoader/utils/index.ts +2 -7
  96. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
  97. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
  98. package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
  99. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
  100. package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
  101. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
  102. package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
  103. package/Decorators/ZappPipesDataConnector/index.tsx +27 -308
  104. package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
  105. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
  106. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +241 -0
  107. package/Decorators/ZappPipesDataConnector/types.ts +29 -0
  108. package/index.d.ts +0 -1
  109. package/package.json +5 -10
  110. package/Components/AudioPlayer/Artwork.tsx +0 -35
  111. package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
  112. package/Components/AudioPlayer/Title.tsx +0 -39
  113. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
  114. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
  115. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
  116. package/Components/AudioPlayer/index.ts +0 -1
  117. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
  118. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
  119. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
  120. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
  121. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
  122. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
@@ -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
  };
@@ -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: frame.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 newSize;
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, create as render } from "react-test-renderer";
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
- jest.mock("react-native/Libraries/ReactNative/UIManager", () => {
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.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
25
- ...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
26
- findNodeHandle: () => 1234,
27
- }));
17
+ jest.spyOn(ReactNative, "findNodeHandle").mockImplementation(() => 1234);
28
18
 
29
- const { ScrollView } = ReactNative;
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.root.findAllByType(ScrollView);
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.root.findAllByType(ScrollView);
178
+ const scrollviews = wrapper.UNSAFE_getAllByType(ScrollView);
183
179
  expect(scrollviews).toBeArray();
184
180
  expect(scrollviews).toHaveProperty("length", 2);
185
181