@applicaster/zapp-react-native-ui-components 12.0.0-rc.9 → 12.0.0-rc.90

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 (147) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
  2. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
  3. package/Components/AudioPlayer/helpers.tsx +1 -0
  4. package/Components/BaseFocusable/index.tsx +3 -3
  5. package/Components/Cell/Cell.tsx +12 -7
  6. package/Components/Cell/CellWithFocusable.tsx +40 -19
  7. package/Components/Cell/TvOSCellComponent.tsx +5 -9
  8. package/Components/ErrorScreen/index.tsx +1 -1
  9. package/Components/Focusable/Focusable.tsx +6 -1
  10. package/Components/FocusableCell/index.tsx +7 -7
  11. package/Components/FocusableGroup/index.tsx +11 -2
  12. package/Components/FocusableList/FocusableChild.ts +24 -14
  13. package/Components/FocusableList/FocusableItem.tsx +1 -1
  14. package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
  15. package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
  16. package/Components/FocusableList/index.tsx +26 -25
  17. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
  18. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
  19. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  20. package/Components/HandlePlayable/HandlePlayable.tsx +4 -1
  21. package/Components/HookRenderer/index.tsx +1 -6
  22. package/Components/Image/Image.android.tsx +3 -26
  23. package/Components/Image/Image.tsx +18 -2
  24. package/Components/Image/utils/index.ts +39 -0
  25. package/Components/Layout/TV/ScreenContainer.tsx +84 -5
  26. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
  27. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
  28. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
  29. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
  30. package/Components/Layout/TV/__tests__/index.test.tsx +20 -108
  31. package/Components/Layout/TV/index.tsx +15 -84
  32. package/Components/Layout/TV/index.web.tsx +33 -0
  33. package/Components/Layout/index.tsx +15 -11
  34. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
  35. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +88 -113
  36. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
  37. package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
  38. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
  39. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
  40. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
  41. package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
  42. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  43. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
  44. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
  45. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  46. package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
  47. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  48. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
  49. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
  50. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
  51. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -10
  52. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  53. package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
  54. package/Components/MasterCell/utils/index.ts +33 -35
  55. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  56. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  57. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  58. package/Components/ModalComponent/Button/Item.tsx +82 -0
  59. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  60. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  61. package/Components/ModalComponent/Button/assets.ts +4 -0
  62. package/Components/ModalComponent/Button/index.tsx +111 -0
  63. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  64. package/Components/ModalComponent/Header/Title.tsx +70 -0
  65. package/Components/ModalComponent/Header/assets.ts +4 -0
  66. package/Components/ModalComponent/Header/index.tsx +71 -0
  67. package/Components/ModalComponent/Header/utils.ts +79 -0
  68. package/Components/ModalComponent/index.tsx +38 -0
  69. package/Components/ModalComponent/utils.ts +126 -0
  70. package/Components/Navigator/StackNavigator.tsx +57 -0
  71. package/Components/Navigator/index.ts +1 -0
  72. package/Components/PlayerContainer/PlayerContainer.tsx +69 -31
  73. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
  74. package/Components/PlayerImageBackground/index.tsx +34 -8
  75. package/Components/River/ComponentsMap/ComponentsMap.tsx +97 -2
  76. package/Components/River/RefreshControl.tsx +55 -1
  77. package/Components/River/River.tsx +8 -5
  78. package/Components/River/TV/River.tsx +2 -25
  79. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
  80. package/Components/River/__tests__/componentsMap.test.js +7 -0
  81. package/Components/River/useScreenConfiguration.ts +2 -2
  82. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  83. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  84. package/Components/RouteManager/index.tsx +4 -2
  85. package/Components/Screen/TV/hooks/index.ts +3 -0
  86. package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
  87. package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
  88. package/Components/Screen/TV/index.web.tsx +169 -0
  89. package/Components/Screen/__tests__/Screen.test.tsx +91 -74
  90. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
  91. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  92. package/Components/Screen/index.tsx +131 -44
  93. package/Components/Screen/navigationHandler.ts +0 -82
  94. package/Components/ScreenResolver/index.tsx +4 -2
  95. package/Components/Tabs/TV/styles.ts +1 -1
  96. package/Components/TrackedView/index.tsx +6 -3
  97. package/Components/Transitioner/Scene.tsx +24 -19
  98. package/Components/Transitioner/Transitioner.tsx +21 -28
  99. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
  100. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  101. package/Components/VideoLive/LiveImageManager.ts +70 -14
  102. package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
  103. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
  104. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +18 -28
  105. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
  106. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +352 -0
  107. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +158 -0
  108. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +455 -0
  109. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +162 -0
  110. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  111. package/Components/VideoModal/ModalAnimation/utils.ts +301 -0
  112. package/Components/VideoModal/PlayerDetails.tsx +6 -3
  113. package/Components/VideoModal/PlayerWrapper.tsx +81 -49
  114. package/Components/VideoModal/VideoModal.tsx +23 -40
  115. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
  116. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -1
  117. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +266 -166
  118. package/Components/VideoModal/utils.ts +8 -5
  119. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
  120. package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
  121. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
  122. package/Components/Viewport/ViewportTracker/index.tsx +1 -0
  123. package/Components/Viewport/utils.js +1 -1
  124. package/Components/ZappUIComponent/index.tsx +22 -12
  125. package/Components/index.js +2 -0
  126. package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
  127. package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
  128. package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
  129. package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
  130. package/Contexts/FocusableGroupContext/index.ts +7 -0
  131. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
  132. package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
  133. package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
  134. package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
  135. package/Contexts/ScreenContext/index.tsx +95 -29
  136. package/Contexts/ScreenDataContext/index.tsx +20 -0
  137. package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
  138. package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
  139. package/Decorators/RiverResolver/index.tsx +0 -4
  140. package/Decorators/index.tsx +0 -4
  141. package/events/index.ts +1 -0
  142. package/package.json +5 -6
  143. package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
  144. package/Components/VideoModal/hooks/usePosition.ts +0 -50
  145. /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
  146. /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
  147. /package/Contexts/{index.js → index.ts} +0 -0
@@ -21,8 +21,17 @@ const useIsTablet = jest.fn();
21
21
 
22
22
  jest.mock("react-native");
23
23
 
24
+ jest.mock("react-native-gesture-handler");
25
+
24
26
  jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
25
27
 
28
+ jest.mock(
29
+ "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
30
+ () => ({
31
+ useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
32
+ })
33
+ );
34
+
26
35
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
27
36
  useIsTablet,
28
37
  }));
@@ -38,6 +47,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
38
47
  }));
39
48
 
40
49
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
50
+ isNavBarVisible: jest.fn(() => true),
41
51
  useRoute: jest.fn(() => ({
42
52
  pathname: "/river/testId",
43
53
  })),
@@ -45,6 +55,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
45
55
  canGoBack: () => false,
46
56
  currentRoute: "/river/testId",
47
57
  data: { screen: { id: "testId" } },
58
+ videoModalState: { visible: false },
48
59
  })),
49
60
  }));
50
61
 
@@ -94,7 +105,7 @@ describe("PlayerWrapper", () => {
94
105
  useIsTablet.mockReturnValue(false);
95
106
 
96
107
  const children = jest.fn(() => {});
97
- const dimensions = { height: 50, width: props.style.width };
108
+ const dimensions = { height: undefined, width: props.style.width };
98
109
 
99
110
  const element = renderWithProviders(
100
111
  <PlayerWrapper
@@ -1,249 +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
- "aspectRatio": 1.7777777777777777,
39
- "height": undefined,
40
- "width": "100%",
30
+ "height": 800,
31
+ "width": 300,
41
32
  },
42
33
  Object {},
43
- Object {},
44
34
  ]
45
35
  }
46
- testID="test-player-container"
47
- />
48
- <View
49
- configuration={
50
- Object {
51
- "tablet_landscape_player_container_background_color": "red",
52
- "tablet_landscape_sidebar_width": "35%",
53
- }
54
- }
55
- entry={
56
- Object {
57
- "id": "test",
36
+ >
37
+ <View
38
+ additionalData={
39
+ Object {
40
+ "saveArea": true,
41
+ }
58
42
  }
59
- }
60
- isTabletLandscape={false}
61
- style={
62
- Object {
63
- "flex": 1,
64
- "paddingTop": 20,
43
+ animationType="moveUpComponent"
44
+ style={
45
+ Array [
46
+ Object {
47
+ "flexDirection": "column",
48
+ },
49
+ Object {
50
+ "flex": 1,
51
+ },
52
+ ]
65
53
  }
66
- }
67
- />
68
- </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>
69
84
  `;
70
85
 
71
86
  exports[`PlayerWrapper renders inline and docked 1`] = `
72
- <RNCSafeAreaView
73
- edges={
74
- Object {
75
- "bottom": "additive",
76
- "left": "off",
77
- "right": "off",
78
- "top": "off",
79
- }
80
- }
87
+ <RNCSafeAreaProvider
88
+ onInsetsChange={[Function]}
81
89
  style={
82
90
  Array [
83
91
  Object {
84
- "flexDirection": "column",
85
- },
86
- Object {
87
- "backgroundColor": "transparent",
88
- },
89
- Object {
90
- "height": 50,
91
- "width": 300,
92
+ "flex": 1,
92
93
  },
93
- Object {},
94
+ undefined,
94
95
  ]
95
96
  }
96
97
  >
97
- <View
98
+ <RNCSafeAreaView
99
+ edges={
100
+ Object {
101
+ "bottom": "off",
102
+ "left": "off",
103
+ "right": "off",
104
+ "top": "additive",
105
+ }
106
+ }
98
107
  style={
99
108
  Array [
100
109
  Object {
101
- "alignSelf": "center",
102
- "position": "relative",
103
- "zIndex": 200,
110
+ "backgroundColor": "transparent",
104
111
  },
105
112
  Object {
106
- "aspectRatio": undefined,
107
- "height": 50,
108
- "width": "100%",
113
+ "height": undefined,
114
+ "width": 300,
109
115
  },
110
116
  Object {},
111
- Object {},
112
117
  ]
113
118
  }
114
- testID="test-player-container"
115
- />
116
- <View
117
- style={
118
- Object {
119
- "flex": 1,
120
- "paddingTop": 20,
119
+ >
120
+ <View
121
+ additionalData={
122
+ Object {
123
+ "saveArea": true,
124
+ }
121
125
  }
122
- }
123
- />
124
- </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>
125
167
  `;
126
168
 
127
169
  exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
128
- <RNCSafeAreaView
129
- edges={
130
- Object {
131
- "bottom": "off",
132
- "left": "off",
133
- "right": "off",
134
- "top": "additive",
135
- }
136
- }
170
+ <RNCSafeAreaProvider
171
+ onInsetsChange={[Function]}
137
172
  style={
138
173
  Array [
139
174
  Object {
140
- "flexDirection": "row",
141
- },
142
- Object {
143
- "backgroundColor": "red",
144
- },
145
- Object {
146
- "height": 800,
147
- "width": 300,
175
+ "flex": 1,
148
176
  },
149
- Object {},
177
+ undefined,
150
178
  ]
151
179
  }
152
180
  >
153
- <View
181
+ <RNCSafeAreaView
182
+ edges={
183
+ Object {
184
+ "bottom": "off",
185
+ "left": "off",
186
+ "right": "off",
187
+ "top": "additive",
188
+ }
189
+ }
154
190
  style={
155
191
  Array [
156
192
  Object {
157
- "alignSelf": "center",
158
- "position": "relative",
159
- "zIndex": 200,
193
+ "backgroundColor": "red",
160
194
  },
161
195
  Object {
162
- "aspectRatio": 1.7777777777777777,
163
- "height": undefined,
164
- "width": 195,
196
+ "height": 800,
197
+ "width": 300,
165
198
  },
166
199
  Object {},
167
- Object {},
168
200
  ]
169
201
  }
170
- testID="test-player-container"
171
- />
172
- <View
173
- configuration={
174
- Object {
175
- "tablet_landscape_player_container_background_color": "red",
176
- "tablet_landscape_sidebar_width": "35%",
177
- }
178
- }
179
- entry={
180
- Object {
181
- "id": "test",
202
+ >
203
+ <View
204
+ additionalData={
205
+ Object {
206
+ "saveArea": true,
207
+ }
182
208
  }
183
- }
184
- isTabletLandscape={true}
185
- style={
186
- Object {
187
- "flex": 1,
188
- "paddingTop": 20,
209
+ animationType="moveUpComponent"
210
+ style={
211
+ Array [
212
+ Object {
213
+ "flexDirection": "row",
214
+ },
215
+ Object {
216
+ "flex": 1,
217
+ },
218
+ ]
189
219
  }
190
- }
191
- />
192
- </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>
193
266
  `;
194
267
 
195
268
  exports[`PlayerWrapper renders properly 1`] = `
196
- <RNCSafeAreaView
197
- edges={
198
- Object {
199
- "bottom": "off",
200
- "left": "off",
201
- "right": "off",
202
- "top": "additive",
203
- }
204
- }
269
+ <RNCSafeAreaProvider
270
+ onInsetsChange={[Function]}
205
271
  style={
206
272
  Array [
207
273
  Object {
208
- "flexDirection": "column",
209
- },
210
- Object {
211
- "backgroundColor": "transparent",
212
- },
213
- Object {
214
- "height": 800,
215
- "width": 300,
274
+ "flex": 1,
216
275
  },
217
- Object {},
276
+ undefined,
218
277
  ]
219
278
  }
220
279
  >
221
- <View
280
+ <RNCSafeAreaView
281
+ edges={
282
+ Object {
283
+ "bottom": "off",
284
+ "left": "off",
285
+ "right": "off",
286
+ "top": "additive",
287
+ }
288
+ }
222
289
  style={
223
290
  Array [
224
291
  Object {
225
- "alignSelf": "center",
226
- "position": "relative",
227
- "zIndex": 200,
292
+ "backgroundColor": "transparent",
228
293
  },
229
294
  Object {
230
- "aspectRatio": 1.7786666666666666,
231
- "height": undefined,
232
- "width": "100%",
295
+ "height": 800,
296
+ "width": 300,
233
297
  },
234
298
  Object {},
235
- Object {},
236
299
  ]
237
300
  }
238
- testID="test-player-container"
239
- />
240
- <View
241
- style={
242
- Object {
243
- "flex": 1,
244
- "paddingTop": 20,
301
+ >
302
+ <View
303
+ additionalData={
304
+ Object {
305
+ "saveArea": true,
306
+ }
245
307
  }
246
- }
247
- />
248
- </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>
249
349
  `;
@@ -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}