@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4757075613 → 12.0.0-alpha.4796013211

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 (114) hide show
  1. package/Components/BaseFocusable/index.tsx +3 -3
  2. package/Components/Cell/Cell.tsx +30 -9
  3. package/Components/Cell/CellWithFocusable.tsx +23 -9
  4. package/Components/Cell/TvOSCellComponent.tsx +3 -7
  5. package/Components/Focusable/Focusable.tsx +6 -1
  6. package/Components/FocusableGroup/index.tsx +11 -2
  7. package/Components/FreezeWithCallback/Freeze.tsx +31 -0
  8. package/Components/FreezeWithCallback/LICENSE +21 -0
  9. package/Components/FreezeWithCallback/Suspender.tsx +17 -0
  10. package/Components/FreezeWithCallback/__tests__/index.test.tsx +170 -0
  11. package/Components/FreezeWithCallback/index.tsx +3 -0
  12. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
  13. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  14. package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
  15. package/Components/Layout/TV/ScreenContainer.tsx +79 -5
  16. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
  17. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
  18. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
  19. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
  20. package/Components/Layout/TV/__tests__/index.test.tsx +20 -75
  21. package/Components/Layout/TV/index.tsx +14 -67
  22. package/Components/Layout/TV/index.web.tsx +33 -0
  23. package/Components/Layout/index.tsx +15 -11
  24. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
  25. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +86 -116
  26. package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
  27. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +16 -1
  28. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
  29. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +71 -0
  30. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  31. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +34 -1
  32. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  33. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  34. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
  35. package/Components/MasterCell/DefaultComponents/index.ts +2 -0
  36. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
  37. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
  38. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -3
  39. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
  40. package/Components/MasterCell/dataAdapter.ts +21 -7
  41. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  42. package/Components/MasterCell/index.tsx +5 -3
  43. package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
  44. package/Components/MasterCell/utils/index.ts +33 -35
  45. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  46. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  47. package/Components/Navigator/StackNavigator.tsx +57 -0
  48. package/Components/Navigator/index.ts +1 -0
  49. package/Components/PlayerContainer/PlayerContainer.tsx +20 -3
  50. package/Components/PlayerImageBackground/index.tsx +34 -8
  51. package/Components/River/ComponentsMap/ComponentsMap.tsx +92 -22
  52. package/Components/River/RefreshControl.tsx +55 -1
  53. package/Components/River/TV/River.tsx +0 -23
  54. package/Components/River/__tests__/componentsMap.test.js +6 -0
  55. package/Components/RouteManager/index.tsx +2 -2
  56. package/Components/Screen/TV/hooks/index.ts +1 -0
  57. package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
  58. package/Components/Screen/TV/index.web.tsx +178 -0
  59. package/Components/Screen/__tests__/Screen.test.tsx +3 -49
  60. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -0
  61. package/Components/Screen/index.tsx +62 -72
  62. package/Components/Screen/navigationHandler.ts +6 -3
  63. package/Components/Screen/orientationHandler.ts +18 -7
  64. package/Components/Screen/utils.ts +16 -0
  65. package/Components/ScreenResolver/index.tsx +9 -12
  66. package/Components/Transitioner/Scene.tsx +39 -26
  67. package/Components/Transitioner/Transitioner.tsx +46 -48
  68. package/Components/Transitioner/__tests__/Scene.test.js +7 -0
  69. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
  70. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -0
  71. package/Components/VideoLive/LiveImageManager.ts +28 -1
  72. package/Components/VideoLive/PlayerLiveImageComponent.tsx +52 -24
  73. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +20 -5
  74. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +25 -28
  75. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +66 -0
  76. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +376 -0
  77. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +165 -0
  78. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +473 -0
  79. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +182 -0
  80. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  81. package/Components/VideoModal/ModalAnimation/utils.ts +302 -0
  82. package/Components/VideoModal/PlayerDetails.tsx +3 -3
  83. package/Components/VideoModal/PlayerWrapper.tsx +77 -47
  84. package/Components/VideoModal/VideoModal.tsx +23 -40
  85. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -1
  86. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +203 -105
  87. package/Components/VideoModal/hooks/useModalSize.ts +10 -12
  88. package/Components/VideoModal/utils.ts +8 -5
  89. package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
  90. package/Components/Viewport/ViewportTracker/index.tsx +1 -0
  91. package/Components/Viewport/utils.js +1 -1
  92. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +4 -3
  93. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
  94. package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
  95. package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
  96. package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
  97. package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
  98. package/Contexts/FocusableGroupContext/index.ts +7 -0
  99. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
  100. package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
  101. package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
  102. package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
  103. package/Contexts/ScreenContext/index.tsx +94 -25
  104. package/Contexts/ScreenDataContext/index.tsx +20 -0
  105. package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
  106. package/const.ts +6 -0
  107. package/events/index.ts +1 -0
  108. package/index.js +3 -0
  109. package/package.json +5 -5
  110. package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
  111. package/Components/VideoModal/hooks/usePosition.ts +0 -50
  112. /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
  113. /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
  114. /package/Contexts/{index.js → index.ts} +0 -0
@@ -23,9 +23,6 @@ exports[`PlayerWrapper renders inline 1`] = `
23
23
  }
24
24
  style={
25
25
  Array [
26
- Object {
27
- "flexDirection": "column",
28
- },
29
26
  Object {
30
27
  "backgroundColor": "transparent",
31
28
  },
@@ -38,44 +35,72 @@ exports[`PlayerWrapper renders inline 1`] = `
38
35
  }
39
36
  >
40
37
  <View
38
+ additionalData={
39
+ Object {
40
+ "saveArea": true,
41
+ }
42
+ }
43
+ animationType="moveUpComponent"
41
44
  style={
42
45
  Array [
43
46
  Object {
44
- "alignSelf": "center",
45
- "position": "relative",
46
- "zIndex": 200,
47
+ "flexDirection": "column",
47
48
  },
48
49
  Object {
49
- "aspectRatio": 1.7777777777777777,
50
- "height": undefined,
51
- "width": "100%",
50
+ "flex": 1,
52
51
  },
53
- Object {},
54
- Object {},
55
52
  ]
56
53
  }
57
- testID="test-player-container"
58
- />
59
- <View
60
- configuration={
61
- Object {
62
- "tablet_landscape_player_container_background_color": "red",
63
- "tablet_landscape_sidebar_width": "35%",
64
- }
65
- }
66
- entry={
67
- Object {
68
- "id": "test",
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
+ ]
69
71
  }
70
- }
71
- isTabletLandscape={false}
72
- style={
73
- Object {
74
- "flex": 1,
75
- "paddingTop": 20,
72
+ testID="test-player-container"
73
+ />
74
+ <View
75
+ animationType="componentFade"
76
+ style={
77
+ Object {
78
+ "flex": 1,
79
+ }
76
80
  }
77
- }
78
- />
81
+ >
82
+ <View
83
+ configuration={
84
+ Object {
85
+ "tablet_landscape_player_container_background_color": "red",
86
+ "tablet_landscape_sidebar_width": "35%",
87
+ }
88
+ }
89
+ entry={
90
+ Object {
91
+ "id": "test",
92
+ }
93
+ }
94
+ isTabletLandscape={false}
95
+ style={
96
+ Object {
97
+ "flex": 1,
98
+ "paddingTop": 20,
99
+ }
100
+ }
101
+ />
102
+ </View>
103
+ </View>
79
104
  </RNCSafeAreaView>
80
105
  </RNCSafeAreaProvider>
81
106
  `;
@@ -95,22 +120,19 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
95
120
  <RNCSafeAreaView
96
121
  edges={
97
122
  Object {
98
- "bottom": "additive",
123
+ "bottom": "off",
99
124
  "left": "off",
100
125
  "right": "off",
101
- "top": "off",
126
+ "top": "additive",
102
127
  }
103
128
  }
104
129
  style={
105
130
  Array [
106
- Object {
107
- "flexDirection": "column",
108
- },
109
131
  Object {
110
132
  "backgroundColor": "transparent",
111
133
  },
112
134
  Object {
113
- "height": 50,
135
+ "height": undefined,
114
136
  "width": 300,
115
137
  },
116
138
  Object {},
@@ -118,32 +140,51 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
118
140
  }
119
141
  >
120
142
  <View
143
+ additionalData={
144
+ Object {
145
+ "saveArea": true,
146
+ }
147
+ }
148
+ animationType="moveUpComponent"
121
149
  style={
122
150
  Array [
123
151
  Object {
124
- "alignSelf": "center",
125
- "position": "relative",
126
- "zIndex": 200,
152
+ "flexDirection": "column",
127
153
  },
128
154
  Object {
129
- "aspectRatio": undefined,
130
- "height": 50,
131
- "width": "100%",
155
+ "flex": 1,
132
156
  },
133
- Object {},
134
- Object {},
135
157
  ]
136
158
  }
137
- testID="test-player-container"
138
- />
139
- <View
140
- style={
141
- Object {
142
- "flex": 1,
143
- "paddingTop": 20,
159
+ >
160
+ <View
161
+ style={
162
+ Array [
163
+ Object {
164
+ "alignSelf": "center",
165
+ "position": "relative",
166
+ "zIndex": 200,
167
+ },
168
+ Object {
169
+ "aspectRatio": undefined,
170
+ "height": undefined,
171
+ "width": "100%",
172
+ },
173
+ Object {},
174
+ Object {},
175
+ ]
144
176
  }
145
- }
146
- />
177
+ testID="test-player-container"
178
+ />
179
+ <View
180
+ style={
181
+ Object {
182
+ "flex": 1,
183
+ "paddingTop": 20,
184
+ }
185
+ }
186
+ />
187
+ </View>
147
188
  </RNCSafeAreaView>
148
189
  </RNCSafeAreaProvider>
149
190
  `;
@@ -171,9 +212,6 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
171
212
  }
172
213
  style={
173
214
  Array [
174
- Object {
175
- "flexDirection": "row",
176
- },
177
215
  Object {
178
216
  "backgroundColor": "red",
179
217
  },
@@ -186,44 +224,88 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
186
224
  }
187
225
  >
188
226
  <View
227
+ additionalData={
228
+ Object {
229
+ "saveArea": true,
230
+ }
231
+ }
232
+ animationType="moveUpComponent"
189
233
  style={
190
234
  Array [
191
235
  Object {
192
- "alignSelf": "center",
193
- "position": "relative",
194
- "zIndex": 200,
236
+ "flexDirection": "row",
195
237
  },
196
238
  Object {
197
- "aspectRatio": 1.7777777777777777,
198
- "height": undefined,
199
- "width": 195,
239
+ "flex": 1,
200
240
  },
201
- Object {},
202
- Object {},
203
241
  ]
204
242
  }
205
- testID="test-player-container"
206
- />
207
- <View
208
- configuration={
209
- Object {
210
- "tablet_landscape_player_container_background_color": "red",
211
- "tablet_landscape_sidebar_width": "35%",
212
- }
213
- }
214
- entry={
215
- Object {
216
- "id": "test",
243
+ >
244
+ <View
245
+ style={
246
+ Array [
247
+ Object {
248
+ "alignSelf": "center",
249
+ "position": "relative",
250
+ "zIndex": 200,
251
+ },
252
+ Object {
253
+ "aspectRatio": 1.7777777777777777,
254
+ "height": undefined,
255
+ "width": 195,
256
+ },
257
+ Object {},
258
+ Object {},
259
+ ]
217
260
  }
218
- }
219
- isTabletLandscape={true}
220
- style={
221
- Object {
222
- "flex": 1,
223
- "paddingTop": 20,
261
+ testID="test-player-container"
262
+ >
263
+ <View
264
+ additionalData={
265
+ Object {
266
+ "disableAnimatedComponent": false,
267
+ "resetAnimationValue": undefined,
268
+ "useLayoutMeasure": true,
269
+ }
270
+ }
271
+ animationType="moveUpComponent"
272
+ style={
273
+ Object {
274
+ "flex": 1,
275
+ }
276
+ }
277
+ />
278
+ </View>
279
+ <View
280
+ animationType="componentFade"
281
+ style={
282
+ Object {
283
+ "flex": 1,
284
+ }
224
285
  }
225
- }
226
- />
286
+ >
287
+ <View
288
+ configuration={
289
+ Object {
290
+ "tablet_landscape_player_container_background_color": "red",
291
+ "tablet_landscape_sidebar_width": "35%",
292
+ }
293
+ }
294
+ entry={
295
+ Object {
296
+ "id": "test",
297
+ }
298
+ }
299
+ isTabletLandscape={true}
300
+ style={
301
+ Object {
302
+ "flex": 1,
303
+ "paddingTop": 20,
304
+ }
305
+ }
306
+ />
307
+ </View>
308
+ </View>
227
309
  </RNCSafeAreaView>
228
310
  </RNCSafeAreaProvider>
229
311
  `;
@@ -251,9 +333,6 @@ exports[`PlayerWrapper renders properly 1`] = `
251
333
  }
252
334
  style={
253
335
  Array [
254
- Object {
255
- "flexDirection": "column",
256
- },
257
336
  Object {
258
337
  "backgroundColor": "transparent",
259
338
  },
@@ -266,32 +345,51 @@ exports[`PlayerWrapper renders properly 1`] = `
266
345
  }
267
346
  >
268
347
  <View
348
+ additionalData={
349
+ Object {
350
+ "saveArea": true,
351
+ }
352
+ }
353
+ animationType="moveUpComponent"
269
354
  style={
270
355
  Array [
271
356
  Object {
272
- "alignSelf": "center",
273
- "position": "relative",
274
- "zIndex": 200,
357
+ "flexDirection": "column",
275
358
  },
276
359
  Object {
277
- "aspectRatio": 1.7786666666666666,
278
- "height": undefined,
279
- "width": "100%",
360
+ "flex": 1,
280
361
  },
281
- Object {},
282
- Object {},
283
362
  ]
284
363
  }
285
- testID="test-player-container"
286
- />
287
- <View
288
- style={
289
- Object {
290
- "flex": 1,
291
- "paddingTop": 20,
364
+ >
365
+ <View
366
+ style={
367
+ Array [
368
+ Object {
369
+ "alignSelf": "center",
370
+ "position": "relative",
371
+ "zIndex": 200,
372
+ },
373
+ Object {
374
+ "aspectRatio": 1.7786666666666666,
375
+ "height": undefined,
376
+ "width": "100%",
377
+ },
378
+ Object {},
379
+ Object {},
380
+ ]
292
381
  }
293
- }
294
- />
382
+ testID="test-player-container"
383
+ />
384
+ <View
385
+ style={
386
+ Object {
387
+ "flex": 1,
388
+ "paddingTop": 20,
389
+ }
390
+ }
391
+ />
392
+ </View>
295
393
  </RNCSafeAreaView>
296
394
  </RNCSafeAreaProvider>
297
395
  `;
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import { Dimensions } from "react-native";
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,20 +22,18 @@ 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
+ });
41
37
 
42
38
  const setNewModalSize = React.useCallback((newSize, log) => {
43
39
  setModalSize((oldSize) => {
@@ -90,7 +86,9 @@ export const useModalSize = (): Size => {
90
86
  toOrientation === ORIENTATIONS.landscapeSensor;
91
87
 
92
88
  setNewModalSize(
93
- isLandscape ? MODAL_SIZE_FOR_LANDSCAPE : MODAL_SIZE_FOR_PORTRAIT,
89
+ isLandscape
90
+ ? MODAL_SIZE_FOR_LANDSCAPE
91
+ : { width: frame.width, height: frame.height },
94
92
  `useModalSize: set modal size ${
95
93
  isLandscape ? "landscape" : "portrait"
96
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
@@ -6,23 +6,23 @@ import { callOnChildren } from "../utils";
6
6
 
7
7
  export function ViewportTracker(props) {
8
8
  const viewportEvents = useViewportEventsContext();
9
- const { children } = props;
10
- const [width, setWidth] = React.useState(0);
11
- const [height, setHeight] = React.useState(0);
12
- const [offsetX, setOffsetX] = React.useState(0);
13
- const [offsetY, setOffsetY] = React.useState(0);
14
9
  const [nodeHandle, setNodeHandle] = React.useState(null);
15
10
 
16
- const assignRef = React.useCallback(
17
- (ref) => {
18
- callOnChildren(children, "ref", ref);
19
- setNodeHandle(findNodeHandle(ref));
20
- },
21
- [children]
22
- );
11
+ const childrenRef = React.useRef(props.children);
12
+
13
+ const dimensionsRef = React.useRef({ width: 0, height: 0 });
14
+ const offsetRef = React.useRef({ offsetX: 0, offsetY: 0 });
15
+
16
+ const assignRef = React.useCallback((ref) => {
17
+ childrenRef.current?.ref?.(ref);
18
+ setNodeHandle(findNodeHandle(ref));
19
+ }, []);
23
20
 
24
21
  const onViewportChange = React.useCallback(
25
- (event, shouldMeasureLayout = true) => {
22
+ ({
23
+ event = { ...dimensionsRef.current, ...offsetRef.current },
24
+ shouldMeasureLayout = true,
25
+ } = {}) => {
26
26
  if (nodeHandle && event?.width > 0 && event?.height > 0) {
27
27
  viewportEvents?.notify?.({
28
28
  parentHandle: nodeHandle,
@@ -36,54 +36,45 @@ export function ViewportTracker(props) {
36
36
 
37
37
  const onLayout = React.useCallback(
38
38
  (event) => {
39
- callOnChildren(children, "onLayout", event);
40
- setWidth(event?.nativeEvent?.layout?.width);
41
- setHeight(event?.nativeEvent?.layout?.height);
39
+ callOnChildren(childrenRef.current, "onLayout", event);
40
+ dimensionsRef.current = event?.nativeEvent?.layout;
42
41
 
43
- onViewportChange({
44
- width: event?.nativeEvent?.layout?.width,
45
- height: event?.nativeEvent?.layout?.height,
46
- offsetX,
47
- offsetY,
48
- });
42
+ onViewportChange();
49
43
  },
50
- [offsetX, offsetY, children, onViewportChange]
44
+ [onViewportChange]
51
45
  );
52
46
 
53
47
  const onContentSizeChange = React.useCallback(
54
48
  (contentWidth, contentHeight) => {
55
49
  callOnChildren(
56
- children,
50
+ childrenRef.current,
57
51
  "onContentSizeChange",
58
52
  contentWidth,
59
53
  contentHeight
60
54
  );
61
55
 
62
- onViewportChange({ width, height, offsetX, offsetY });
56
+ onViewportChange();
63
57
  },
64
- [onViewportChange, children, width, height, offsetX, offsetY]
58
+ [onViewportChange]
65
59
  );
66
60
 
67
61
  const onScroll = React.useCallback(
68
62
  (event) => {
69
- callOnChildren(children, "onScroll", event);
70
- setOffsetX(event?.nativeEvent?.contentOffset?.x);
71
- setOffsetY(event?.nativeEvent?.contentOffset?.y);
63
+ callOnChildren(childrenRef.current, "onScroll", event);
64
+ offsetRef.current = event?.nativeEvent?.contentOffset;
72
65
 
73
- onViewportChange(
74
- {
75
- width,
76
- height,
77
- offsetX: event?.nativeEvent?.contentOffset?.x,
78
- offsetY: event?.nativeEvent?.contentOffset?.y,
79
- },
80
- false
81
- );
66
+ onViewportChange({
67
+ shouldMeasureLayout: false,
68
+ });
82
69
  },
83
- [onViewportChange, width, height, children]
70
+ [onViewportChange]
84
71
  );
85
72
 
86
- return React.cloneElement(React.Children.only(children), {
73
+ React.useEffect(() => {
74
+ childrenRef.current = props.children;
75
+ }, [props.children]);
76
+
77
+ return React.cloneElement(React.Children.only(props.children), {
87
78
  ref: assignRef,
88
79
  onLayout,
89
80
  onContentSizeChange,
@@ -6,6 +6,7 @@ import { ViewportEventContext, ViewportEvents } from "../ViewportEvents";
6
6
  type Props = {
7
7
  viewportEventsManager?: any;
8
8
  children: React.ReactNode;
9
+ flatListRef?: any; // this ref is used to bind to children component
9
10
  };
10
11
 
11
12
  export function ViewportTracker(props: Props) {
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
 
3
3
  export function callOnChildren(children, method, ...args) {
4
4
  const childMethod = React.Children.only(children).props[method];
5
- childMethod && childMethod(...args);
5
+ typeof childMethod === "function" && childMethod?.(...args);
6
6
  }
7
7
 
8
8
  export function isInViewport(
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { View, StyleSheet } from "react-native";
2
+ import { StyleSheet } from "react-native";
3
+ import { SafeAreaView } from "react-native-safe-area-context";
3
4
 
4
5
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
5
6
  import CloseButton from "./Buttons/CloseButton";
@@ -44,11 +45,11 @@ const BarView = ({ screenStyles, barState = defaultState }: Props) => {
44
45
  );
45
46
 
46
47
  return (
47
- <View style={[style.view, isRTL ? style.rtlStyle : {}]}>
48
+ <SafeAreaView style={[style.view, isRTL ? style.rtlStyle : {}]}>
48
49
  {backButton}
49
50
  <BarTitle title={barState.title} screenStyles={screenStyles} />
50
51
  {closeButton}
51
- </View>
52
+ </SafeAreaView>
52
53
  );
53
54
  };
54
55
 
@@ -16,9 +16,9 @@ exports[`DefaultCellRenderer returns a react component and it renders correctly
16
16
  store={null}
17
17
  style={
18
18
  Object {
19
- "backgroundColor": "#CCC",
19
+ "backgroundColor": "transparent",
20
20
  "margin": 12,
21
- "opacity": 0.6,
21
+ "opacity": 1,
22
22
  "width": 169,
23
23
  }
24
24
  }
@@ -105,7 +105,7 @@ exports[`DefaultCellRenderer returns a react component for LG TVs 1`] = `
105
105
  store={null}
106
106
  style={
107
107
  Object {
108
- "backgroundColor": "rgba(252,70,27,1.0)",
108
+ "backgroundColor": "rgba(47,47,47,1.0)",
109
109
  "borderRadius": 4,
110
110
  "flex": 1,
111
111
  "overflow": "hidden",
@@ -238,7 +238,7 @@ exports[`DefaultCellRenderer returns a react component for Samsung TVs 1`] = `
238
238
  store={null}
239
239
  style={
240
240
  Object {
241
- "backgroundColor": "rgba(252,70,27,1.0)",
241
+ "backgroundColor": "rgba(47,47,47,1.0)",
242
242
  "borderRadius": 4,
243
243
  "flex": 1,
244
244
  "overflow": "hidden",
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+
3
+ export const FocusableGroupContext = React.createContext<string | null>(null);