@applicaster/zapp-react-native-ui-components 12.0.0-rc.1 → 12.0.0-rc.100

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 (153) hide show
  1. package/Components/AnimatedInOut/index.tsx +18 -10
  2. package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
  3. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
  4. package/Components/AudioPlayer/helpers.tsx +1 -0
  5. package/Components/BaseFocusable/index.tsx +3 -3
  6. package/Components/Cell/Cell.tsx +32 -11
  7. package/Components/Cell/CellWithFocusable.tsx +40 -19
  8. package/Components/Cell/TvOSCellComponent.tsx +5 -9
  9. package/Components/ErrorScreen/index.tsx +1 -1
  10. package/Components/Focusable/Focusable.tsx +6 -1
  11. package/Components/FocusableCell/index.tsx +7 -7
  12. package/Components/FocusableGroup/index.tsx +11 -2
  13. package/Components/FocusableList/FocusableChild.ts +24 -14
  14. package/Components/FocusableList/FocusableItem.tsx +1 -1
  15. package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
  16. package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
  17. package/Components/FocusableList/index.tsx +26 -25
  18. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
  19. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
  20. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  21. package/Components/HandlePlayable/HandlePlayable.tsx +4 -1
  22. package/Components/HookRenderer/index.tsx +1 -6
  23. package/Components/Image/Image.android.tsx +11 -2
  24. package/Components/Image/Image.tsx +18 -2
  25. package/Components/Image/utils/index.ts +39 -0
  26. package/Components/Layout/TV/ScreenContainer.tsx +79 -5
  27. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
  28. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
  29. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
  30. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
  31. package/Components/Layout/TV/__tests__/index.test.tsx +20 -108
  32. package/Components/Layout/TV/index.tsx +15 -84
  33. package/Components/Layout/TV/index.web.tsx +33 -0
  34. package/Components/Layout/index.tsx +15 -11
  35. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
  36. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +88 -113
  37. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
  38. package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
  39. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
  40. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
  41. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
  42. package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
  43. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  44. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +37 -2
  45. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
  46. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  47. package/Components/MasterCell/DefaultComponents/Toggle.tsx +9 -3
  48. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  49. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
  50. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
  51. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
  52. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
  53. package/Components/MasterCell/dataAdapter.ts +21 -7
  54. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  55. package/Components/MasterCell/index.tsx +3 -1
  56. package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
  57. package/Components/MasterCell/utils/index.ts +33 -35
  58. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  59. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  60. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  61. package/Components/ModalComponent/Button/Item.tsx +82 -0
  62. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  63. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  64. package/Components/ModalComponent/Button/assets.ts +4 -0
  65. package/Components/ModalComponent/Button/index.tsx +111 -0
  66. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  67. package/Components/ModalComponent/Header/Title.tsx +70 -0
  68. package/Components/ModalComponent/Header/assets.ts +4 -0
  69. package/Components/ModalComponent/Header/index.tsx +71 -0
  70. package/Components/ModalComponent/Header/utils.ts +79 -0
  71. package/Components/ModalComponent/index.tsx +38 -0
  72. package/Components/ModalComponent/utils.ts +126 -0
  73. package/Components/Navigator/StackNavigator.tsx +57 -0
  74. package/Components/Navigator/index.ts +1 -0
  75. package/Components/PlayerContainer/ErrorDisplay/ErrorDisplay.tsx +4 -7
  76. package/Components/PlayerContainer/PlayerContainer.tsx +66 -31
  77. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
  78. package/Components/PlayerImageBackground/index.tsx +34 -8
  79. package/Components/River/ComponentsMap/ComponentsMap.tsx +97 -2
  80. package/Components/River/RefreshControl.tsx +55 -1
  81. package/Components/River/River.tsx +8 -5
  82. package/Components/River/TV/River.tsx +2 -25
  83. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
  84. package/Components/River/__tests__/componentsMap.test.js +7 -0
  85. package/Components/River/useScreenConfiguration.ts +5 -6
  86. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  87. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  88. package/Components/RouteManager/index.tsx +4 -2
  89. package/Components/Screen/TV/hooks/index.ts +3 -0
  90. package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
  91. package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
  92. package/Components/Screen/TV/index.web.tsx +165 -0
  93. package/Components/Screen/__tests__/Screen.test.tsx +51 -36
  94. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
  95. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  96. package/Components/Screen/index.tsx +110 -54
  97. package/Components/Screen/navigationHandler.ts +5 -82
  98. package/Components/Screen/orientationHandler.ts +1 -1
  99. package/Components/ScreenResolver/index.tsx +10 -13
  100. package/Components/Tabs/TV/styles.ts +1 -1
  101. package/Components/TrackedView/index.tsx +6 -3
  102. package/Components/Transitioner/Scene.tsx +32 -26
  103. package/Components/Transitioner/Transitioner.tsx +21 -28
  104. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
  105. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  106. package/Components/VideoLive/LiveImageManager.ts +70 -14
  107. package/Components/VideoLive/PlayerLiveImageComponent.tsx +132 -95
  108. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
  109. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +21 -29
  110. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +66 -0
  111. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +355 -0
  112. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +161 -0
  113. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +456 -0
  114. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +182 -0
  115. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  116. package/Components/VideoModal/ModalAnimation/utils.ts +302 -0
  117. package/Components/VideoModal/PlayerDetails.tsx +6 -3
  118. package/Components/VideoModal/PlayerWrapper.tsx +133 -100
  119. package/Components/VideoModal/VideoModal.tsx +23 -40
  120. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
  121. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +15 -3
  122. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +262 -170
  123. package/Components/VideoModal/hooks/useModalSize.ts +23 -16
  124. package/Components/VideoModal/utils.ts +8 -5
  125. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
  126. package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
  127. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
  128. package/Components/Viewport/ViewportTracker/index.tsx +1 -0
  129. package/Components/Viewport/utils.js +1 -1
  130. package/Components/ZappUIComponent/index.tsx +22 -12
  131. package/Components/index.js +2 -0
  132. package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
  133. package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
  134. package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
  135. package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
  136. package/Contexts/FocusableGroupContext/index.ts +7 -0
  137. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
  138. package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
  139. package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
  140. package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
  141. package/Contexts/ScreenContext/index.tsx +95 -29
  142. package/Contexts/ScreenDataContext/index.tsx +20 -0
  143. package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
  144. package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
  145. package/Decorators/RiverResolver/index.tsx +0 -4
  146. package/Decorators/index.tsx +0 -4
  147. package/events/index.ts +1 -0
  148. package/package.json +5 -6
  149. package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
  150. package/Components/VideoModal/hooks/usePosition.ts +0 -50
  151. /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
  152. /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
  153. /package/Contexts/{index.js → index.ts} +0 -0
@@ -1,257 +1,349 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`PlayerWrapper renders inline 1`] = `
4
- <RNCSafeAreaView
5
- edges={
6
- Object {
7
- "bottom": "off",
8
- "left": "off",
9
- "right": "off",
10
- "top": "additive",
11
- }
12
- }
4
+ <RNCSafeAreaProvider
5
+ onInsetsChange={[Function]}
13
6
  style={
14
7
  Array [
15
8
  Object {
16
- "flexDirection": "column",
17
- },
18
- Object {
19
- "backgroundColor": "transparent",
20
- },
21
- Object {
22
- "height": 800,
23
- "width": 300,
9
+ "flex": 1,
24
10
  },
25
- Object {},
11
+ undefined,
26
12
  ]
27
13
  }
28
14
  >
29
- <View
15
+ <RNCSafeAreaView
16
+ edges={
17
+ Object {
18
+ "bottom": "off",
19
+ "left": "off",
20
+ "right": "off",
21
+ "top": "additive",
22
+ }
23
+ }
30
24
  style={
31
25
  Array [
32
26
  Object {
33
- "alignSelf": "center",
34
- "position": "relative",
35
- "zIndex": 200,
27
+ "backgroundColor": "transparent",
36
28
  },
37
29
  Object {
38
- "height": 421.875,
30
+ "height": 800,
39
31
  "width": 300,
40
32
  },
41
33
  Object {},
42
- Object {
43
- "height": 431.875,
44
- },
45
- Object {},
46
34
  ]
47
35
  }
48
- testID="test-player-container"
49
- />
50
- <View
51
- configuration={
52
- Object {
53
- "tablet_landscape_player_container_background_color": "red",
54
- "tablet_landscape_sidebar_width": "35%",
55
- }
56
- }
57
- entry={
58
- Object {
59
- "id": "test",
36
+ >
37
+ <View
38
+ additionalData={
39
+ Object {
40
+ "saveArea": true,
41
+ }
60
42
  }
61
- }
62
- isTabletLandscape={false}
63
- style={
64
- Object {
65
- "flex": 1,
66
- "paddingTop": 20,
43
+ animationType="moveUpComponent"
44
+ style={
45
+ Array [
46
+ Object {
47
+ "flexDirection": "column",
48
+ },
49
+ Object {
50
+ "flex": 1,
51
+ },
52
+ ]
67
53
  }
68
- }
69
- />
70
- </RNCSafeAreaView>
54
+ >
55
+ <View
56
+ style={
57
+ Array [
58
+ Object {
59
+ "alignSelf": "center",
60
+ "position": "relative",
61
+ "zIndex": 200,
62
+ },
63
+ Object {
64
+ "aspectRatio": 1.7777777777777777,
65
+ "height": undefined,
66
+ "width": "100%",
67
+ },
68
+ Object {},
69
+ Object {},
70
+ ]
71
+ }
72
+ testID="test-player-container"
73
+ />
74
+ <View
75
+ style={
76
+ Object {
77
+ "flex": 1,
78
+ }
79
+ }
80
+ />
81
+ </View>
82
+ </RNCSafeAreaView>
83
+ </RNCSafeAreaProvider>
71
84
  `;
72
85
 
73
86
  exports[`PlayerWrapper renders inline and docked 1`] = `
74
- <RNCSafeAreaView
75
- edges={
76
- Object {
77
- "bottom": "additive",
78
- "left": "off",
79
- "right": "off",
80
- "top": "off",
81
- }
82
- }
87
+ <RNCSafeAreaProvider
88
+ onInsetsChange={[Function]}
83
89
  style={
84
90
  Array [
85
91
  Object {
86
- "flexDirection": "column",
87
- },
88
- Object {
89
- "backgroundColor": "transparent",
90
- },
91
- Object {
92
- "height": 50,
93
- "width": 300,
92
+ "flex": 1,
94
93
  },
95
- Object {},
94
+ undefined,
96
95
  ]
97
96
  }
98
97
  >
99
- <View
98
+ <RNCSafeAreaView
99
+ edges={
100
+ Object {
101
+ "bottom": "off",
102
+ "left": "off",
103
+ "right": "off",
104
+ "top": "additive",
105
+ }
106
+ }
100
107
  style={
101
108
  Array [
102
109
  Object {
103
- "alignSelf": "center",
104
- "position": "relative",
105
- "zIndex": 200,
110
+ "backgroundColor": "transparent",
106
111
  },
107
112
  Object {
108
- "height": 50,
113
+ "height": undefined,
109
114
  "width": 300,
110
115
  },
111
116
  Object {},
112
- Object {
113
- "height": 50,
114
- },
115
- Object {},
116
117
  ]
117
118
  }
118
- testID="test-player-container"
119
- />
120
- <View
121
- style={
122
- Object {
123
- "flex": 1,
124
- "paddingTop": 20,
119
+ >
120
+ <View
121
+ additionalData={
122
+ Object {
123
+ "saveArea": true,
124
+ }
125
125
  }
126
- }
127
- />
128
- </RNCSafeAreaView>
126
+ animationType="moveUpComponent"
127
+ style={
128
+ Array [
129
+ Object {
130
+ "flexDirection": "column",
131
+ },
132
+ Object {
133
+ "flex": 1,
134
+ },
135
+ ]
136
+ }
137
+ >
138
+ <View
139
+ style={
140
+ Array [
141
+ Object {
142
+ "alignSelf": "center",
143
+ "position": "relative",
144
+ "zIndex": 200,
145
+ },
146
+ Object {
147
+ "aspectRatio": undefined,
148
+ "height": undefined,
149
+ "width": "100%",
150
+ },
151
+ Object {},
152
+ Object {},
153
+ ]
154
+ }
155
+ testID="test-player-container"
156
+ />
157
+ <View
158
+ style={
159
+ Object {
160
+ "flex": 1,
161
+ }
162
+ }
163
+ />
164
+ </View>
165
+ </RNCSafeAreaView>
166
+ </RNCSafeAreaProvider>
129
167
  `;
130
168
 
131
169
  exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
132
- <RNCSafeAreaView
133
- edges={
134
- Object {
135
- "bottom": "off",
136
- "left": "off",
137
- "right": "off",
138
- "top": "additive",
139
- }
140
- }
170
+ <RNCSafeAreaProvider
171
+ onInsetsChange={[Function]}
141
172
  style={
142
173
  Array [
143
174
  Object {
144
- "flexDirection": "row",
145
- },
146
- Object {
147
- "backgroundColor": "red",
148
- },
149
- Object {
150
- "height": 800,
151
- "width": 300,
175
+ "flex": 1,
152
176
  },
153
- Object {},
177
+ undefined,
154
178
  ]
155
179
  }
156
180
  >
157
- <View
181
+ <RNCSafeAreaView
182
+ edges={
183
+ Object {
184
+ "bottom": "off",
185
+ "left": "off",
186
+ "right": "off",
187
+ "top": "additive",
188
+ }
189
+ }
158
190
  style={
159
191
  Array [
160
192
  Object {
161
- "alignSelf": "center",
162
- "position": "relative",
163
- "zIndex": 200,
164
- },
165
- Object {
166
- "height": 109.6875,
167
- "width": 195,
193
+ "backgroundColor": "red",
168
194
  },
169
- Object {},
170
195
  Object {
171
- "height": 119.6875,
196
+ "height": 800,
197
+ "width": 300,
172
198
  },
173
199
  Object {},
174
200
  ]
175
201
  }
176
- testID="test-player-container"
177
- />
178
- <View
179
- configuration={
180
- Object {
181
- "tablet_landscape_player_container_background_color": "red",
182
- "tablet_landscape_sidebar_width": "35%",
183
- }
184
- }
185
- entry={
186
- Object {
187
- "id": "test",
202
+ >
203
+ <View
204
+ additionalData={
205
+ Object {
206
+ "saveArea": true,
207
+ }
188
208
  }
189
- }
190
- isTabletLandscape={true}
191
- style={
192
- Object {
193
- "flex": 1,
194
- "paddingTop": 20,
209
+ animationType="moveUpComponent"
210
+ style={
211
+ Array [
212
+ Object {
213
+ "flexDirection": "row",
214
+ },
215
+ Object {
216
+ "flex": 1,
217
+ },
218
+ ]
195
219
  }
196
- }
197
- />
198
- </RNCSafeAreaView>
220
+ >
221
+ <View
222
+ style={
223
+ Array [
224
+ Object {
225
+ "alignSelf": "center",
226
+ "position": "relative",
227
+ "zIndex": 200,
228
+ },
229
+ Object {
230
+ "aspectRatio": 1.7777777777777777,
231
+ "height": undefined,
232
+ "width": 195,
233
+ },
234
+ Object {},
235
+ Object {},
236
+ ]
237
+ }
238
+ testID="test-player-container"
239
+ >
240
+ <View
241
+ additionalData={
242
+ Object {
243
+ "disableAnimatedComponent": false,
244
+ "resetAnimationValue": undefined,
245
+ "useLayoutMeasure": true,
246
+ }
247
+ }
248
+ animationType="moveUpComponent"
249
+ style={
250
+ Object {
251
+ "flex": 1,
252
+ }
253
+ }
254
+ />
255
+ </View>
256
+ <View
257
+ style={
258
+ Object {
259
+ "flex": 1,
260
+ }
261
+ }
262
+ />
263
+ </View>
264
+ </RNCSafeAreaView>
265
+ </RNCSafeAreaProvider>
199
266
  `;
200
267
 
201
268
  exports[`PlayerWrapper renders properly 1`] = `
202
- <RNCSafeAreaView
203
- edges={
204
- Object {
205
- "bottom": "off",
206
- "left": "off",
207
- "right": "off",
208
- "top": "additive",
209
- }
210
- }
269
+ <RNCSafeAreaProvider
270
+ onInsetsChange={[Function]}
211
271
  style={
212
272
  Array [
213
273
  Object {
214
- "flexDirection": "column",
215
- },
216
- Object {
217
- "backgroundColor": "transparent",
218
- },
219
- Object {
220
- "height": 800,
221
- "width": 300,
274
+ "flex": 1,
222
275
  },
223
- Object {},
276
+ undefined,
224
277
  ]
225
278
  }
226
279
  >
227
- <View
280
+ <RNCSafeAreaView
281
+ edges={
282
+ Object {
283
+ "bottom": "off",
284
+ "left": "off",
285
+ "right": "off",
286
+ "top": "additive",
287
+ }
288
+ }
228
289
  style={
229
290
  Array [
230
291
  Object {
231
- "alignSelf": "center",
232
- "position": "relative",
233
- "zIndex": 200,
292
+ "backgroundColor": "transparent",
234
293
  },
235
294
  Object {
236
295
  "height": 800,
237
296
  "width": 300,
238
297
  },
239
298
  Object {},
240
- Object {
241
- "height": 800,
242
- },
243
- Object {},
244
299
  ]
245
300
  }
246
- testID="test-player-container"
247
- />
248
- <View
249
- style={
250
- Object {
251
- "flex": 1,
252
- "paddingTop": 20,
301
+ >
302
+ <View
303
+ additionalData={
304
+ Object {
305
+ "saveArea": true,
306
+ }
253
307
  }
254
- }
255
- />
256
- </RNCSafeAreaView>
308
+ animationType="moveUpComponent"
309
+ style={
310
+ Array [
311
+ Object {
312
+ "flexDirection": "column",
313
+ },
314
+ Object {
315
+ "flex": 1,
316
+ },
317
+ ]
318
+ }
319
+ >
320
+ <View
321
+ style={
322
+ Array [
323
+ Object {
324
+ "alignSelf": "center",
325
+ "position": "relative",
326
+ "zIndex": 200,
327
+ },
328
+ Object {
329
+ "aspectRatio": 1.7786666666666666,
330
+ "height": undefined,
331
+ "width": "100%",
332
+ },
333
+ Object {},
334
+ Object {},
335
+ ]
336
+ }
337
+ testID="test-player-container"
338
+ />
339
+ <View
340
+ style={
341
+ Object {
342
+ "flex": 1,
343
+ }
344
+ }
345
+ />
346
+ </View>
347
+ </RNCSafeAreaView>
348
+ </RNCSafeAreaProvider>
257
349
  `;
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { Dimensions } from "react-native";
1
+ import * as React from "react";
3
2
  import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
4
3
  import {
5
4
  addOrientationChangeListener,
@@ -9,11 +8,10 @@ import {
9
8
  } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
10
9
 
11
10
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
11
+ import { useSafeAreaFrame } from "react-native-safe-area-context";
12
12
 
13
13
  const { Logger } = getXray();
14
14
 
15
- const { width: WIDTH, height: HEIGHT } = Dimensions.get("window");
16
-
17
15
  const logger = new Logger(
18
16
  "hooks",
19
17
  "zapp-react-native-ui-components/Components/VideoModal"
@@ -24,28 +22,35 @@ type Size = {
24
22
  height: number | string;
25
23
  };
26
24
 
27
- const MODAL_SIZE_FOR_PORTRAIT: Size = {
28
- width: WIDTH,
29
- height: HEIGHT,
30
- };
31
-
32
25
  const MODAL_SIZE_FOR_LANDSCAPE: Size = {
33
26
  width: "100%",
34
27
  height: "100%",
35
28
  };
36
29
 
37
30
  export const useModalSize = (): Size => {
38
- const [modalSize, setModalSize] = React.useState<Size>(
39
- MODAL_SIZE_FOR_PORTRAIT
40
- );
31
+ const frame = useSafeAreaFrame();
32
+
33
+ const [modalSize, setModalSize] = React.useState<Size>({
34
+ width: frame.width,
35
+ height: frame.height,
36
+ });
37
+
38
+ const setNewModalSize = React.useCallback((newSize, log) => {
39
+ setModalSize((oldSize) => {
40
+ if (
41
+ oldSize.height === newSize.height &&
42
+ oldSize.width === newSize.width
43
+ ) {
44
+ return oldSize;
45
+ }
41
46
 
42
- const setNewModalSize = (size, log) => {
43
- setModalSize(size);
47
+ return newSize;
48
+ });
44
49
 
45
50
  logger.debug({
46
51
  message: log,
47
52
  });
48
- };
53
+ }, []);
49
54
 
50
55
  const isTabletLandscape = useIsTabletLandscape();
51
56
 
@@ -81,7 +86,9 @@ export const useModalSize = (): Size => {
81
86
  toOrientation === ORIENTATIONS.landscapeSensor;
82
87
 
83
88
  setNewModalSize(
84
- isLandscape ? MODAL_SIZE_FOR_LANDSCAPE : MODAL_SIZE_FOR_PORTRAIT,
89
+ isLandscape
90
+ ? MODAL_SIZE_FOR_LANDSCAPE
91
+ : { width: frame.width, height: frame.height },
85
92
  `useModalSize: set modal size ${
86
93
  isLandscape ? "landscape" : "portrait"
87
94
  } for orientation: ${to}`
@@ -23,18 +23,21 @@ export const useConfiguration = () => {
23
23
  const targetScreenConfiguration = rivers?.[targetScreenId];
24
24
 
25
25
  const pluginConfiguration =
26
- pluginConfigurations[targetScreenConfiguration.type].configuration_json;
26
+ pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
27
27
 
28
28
  const playerPluginConfig = playerManager.getPluginConfiguration();
29
29
 
30
30
  const config = R.mergeRight(playerPluginConfig, {
31
- ...targetScreenConfiguration.general,
32
- ...targetScreenConfiguration.styles,
31
+ ...targetScreenConfiguration?.general,
32
+ ...targetScreenConfiguration?.styles,
33
33
  ...pluginConfiguration,
34
34
  });
35
35
 
36
- const { minimised_height, minimised_height_tablet, modal_background_color } =
37
- config;
36
+ const {
37
+ minimised_height = 0,
38
+ minimised_height_tablet = 0,
39
+ modal_background_color,
40
+ } = config;
38
41
 
39
42
  const minimisedHeight = useIsTablet()
40
43
  ? minimised_height_tablet
@@ -1,35 +1,38 @@
1
1
  /* eslint-disable react/prop-types */
2
2
 
3
- jest.mock("react-native", () => {
4
- const { ScrollView } = jest.requireActual("react-native");
3
+ import * as React from "react";
4
+
5
+ import { shallow } from "enzyme";
6
+ import { create, act } from "react-test-renderer";
7
+ import { shallowToJson } from "enzyme-to-json";
8
+
9
+ import { ViewportEvents } from "../../ViewportEvents";
10
+
11
+ jest.useFakeTimers();
5
12
 
13
+ jest.mock("react-native/Libraries/ReactNative/UIManager", () => {
6
14
  return {
7
- ScrollView,
8
- UIManager: {
9
- measureLayout: jest.fn((handle, parent, error, success) => {
10
- success(100, 100, 400, 400);
11
- }),
12
- },
13
- findNodeHandle: jest.fn(() => 1234),
14
- Animated: {
15
- timing: jest.fn(() => ({ start: jest.fn() })),
15
+ ...jest.requireActual("react-native/Libraries/ReactNative/NativeUIManager"),
16
+ measureLayout: (handle, parent, error, success) => {
17
+ success(100, 100, 400, 400);
16
18
  },
17
19
  };
18
20
  });
19
21
 
20
- import * as React from "react";
22
+ jest.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
23
+ ...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
24
+ findNodeHandle: () => 1234,
25
+ }));
21
26
 
22
- import { shallow } from "enzyme";
23
- import TestRenderer from "react-test-renderer";
24
- import { act } from "@testing-library/react-hooks";
25
- import { shallowToJson } from "enzyme-to-json";
27
+ const ReactNative = require("react-native");
26
28
 
27
- import { ViewportEvents } from "../../ViewportEvents";
29
+ const { Animated, ScrollView } = ReactNative;
30
+
31
+ Animated.timing = jest.fn(() => ({ start: jest.fn() }));
28
32
 
29
33
  const viewportEventsManager = new ViewportEvents(true);
30
34
 
31
- const { ScrollView } = require("react-native");
32
- const { ViewportAware } = require("../index");
35
+ const { ViewportAware } = require("../");
33
36
  const { ViewportTracker } = require("../../ViewportTracker");
34
37
 
35
38
  const TestComponent = (props) => {
@@ -116,7 +119,7 @@ describe("<ViewportAware />", () => {
116
119
  });
117
120
 
118
121
  it("invokes the onViewportEnter function when entering the viewport", () => {
119
- const wrapper = TestRenderer.create(
122
+ const wrapper = create(
120
123
  getWrapper(() => (
121
124
  <TestComponent
122
125
  preTriggerRatio={0.1}
@@ -134,6 +137,8 @@ describe("<ViewportAware />", () => {
134
137
  width: 1920,
135
138
  height: 1080,
136
139
  });
140
+
141
+ jest.runAllTimers();
137
142
  });
138
143
 
139
144
  expect(wrapper.toJSON()).toMatchSnapshot();
@@ -151,7 +156,7 @@ describe("<ViewportAware />", () => {
151
156
  });
152
157
 
153
158
  it("invokes the onViewportLeave function when leaving the viewport", () => {
154
- const wrapper = TestRenderer.create(
159
+ const wrapper = create(
155
160
  getWrapper(() => (
156
161
  <TestComponent
157
162
  preTriggerRatio={0.1}