@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1436249127 → 13.0.0-alpha.1488035644

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 (112) hide show
  1. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  2. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  3. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +6 -6
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +7 -7
  6. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  7. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  8. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  9. package/Components/BaseFocusable/index.ios.ts +1 -1
  10. package/Components/BaseFocusable/index.tsx +1 -1
  11. package/Components/Cell/Cell.tsx +7 -3
  12. package/Components/Cell/CellWithFocusable.tsx +13 -10
  13. package/Components/Cell/TvOSCellComponent.tsx +0 -4
  14. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +20 -20
  15. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +5 -3
  16. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +5 -5
  17. package/Components/ComponentResolver/__tests__/componentResolver.test.js +11 -9
  18. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  19. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  20. package/Components/Focusable/Touchable.tsx +19 -20
  21. package/Components/FocusableList/index.tsx +0 -1
  22. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  23. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  24. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
  25. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  26. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
  27. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
  28. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  29. package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
  30. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  31. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  32. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  33. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  34. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  35. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  36. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  37. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  38. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  39. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
  40. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -45
  41. package/Components/MasterCell/elementMapper.tsx +12 -1
  42. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  43. package/Components/MasterCell/index.tsx +84 -18
  44. package/Components/MasterCell/utils/index.ts +1 -1
  45. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  46. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  47. package/Components/PlayerContainer/PlayerContainer.tsx +5 -11
  48. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  49. package/Components/River/RefreshControl.tsx +1 -1
  50. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +17 -17
  51. package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
  52. package/Components/River/__tests__/componentsMap.test.js +61 -13
  53. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
  54. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
  55. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  56. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  57. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
  58. package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
  59. package/Components/Tabs/Tab.tsx +7 -6
  60. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  61. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  62. package/Components/TextInputTv/index.tsx +4 -4
  63. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  64. package/Components/Transitioner/AnimationManager.js +8 -8
  65. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  66. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -9
  67. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  68. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  69. package/Components/VideoLive/LiveImageManager.ts +27 -1
  70. package/Components/VideoLive/PlayerLiveImageComponent.tsx +18 -16
  71. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  72. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -10
  73. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +5 -1
  74. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  75. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +8 -7
  76. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
  77. package/Components/VideoModal/ModalAnimation/index.ts +2 -1
  78. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  79. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  80. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  81. package/Components/VideoModal/PlayerWrapper.tsx +16 -35
  82. package/Components/VideoModal/VideoModal.tsx +14 -23
  83. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  84. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  85. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  86. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  87. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  88. package/Components/VideoModal/hooks/index.ts +7 -0
  89. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  90. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  91. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  92. package/Components/VideoModal/utils.ts +3 -5
  93. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
  94. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  95. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
  96. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -62
  97. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  98. package/Contexts/ScreenContext/index.tsx +3 -2
  99. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
  100. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  101. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  102. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  103. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  104. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  105. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  106. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  107. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +5 -5
  108. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
  109. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  110. package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
  111. package/package.json +12 -6
  112. package/Decorators/RiverFeedLoader/utils.ts +0 -100
@@ -10,7 +10,7 @@ exports[`elementMapper renders the nodes 1`] = `
10
10
  <ImageContainer
11
11
  key="0"
12
12
  style={
13
- Object {
13
+ {
14
14
  "borderTopLeftRadius": 4,
15
15
  "borderTopRightRadius": 4,
16
16
  "height": 216,
@@ -22,7 +22,7 @@ exports[`elementMapper renders the nodes 1`] = `
22
22
  <View
23
23
  key="1"
24
24
  style={
25
- Object {
25
+ {
26
26
  "height": 30,
27
27
  "marginHorizontal": 24,
28
28
  "marginTop": 24,
@@ -37,7 +37,7 @@ exports[`elementMapper renders the nodes 1`] = `
37
37
  label="Test Entry"
38
38
  numberOfLines={1}
39
39
  style={
40
- Object {
40
+ {
41
41
  "color": "#EFEFEF",
42
42
  "fontSize": 26,
43
43
  "fontStyle": "normal",
@@ -49,7 +49,7 @@ exports[`elementMapper renders the nodes 1`] = `
49
49
  <View
50
50
  key="2"
51
51
  style={
52
- Object {
52
+ {
53
53
  "height": 60,
54
54
  "marginHorizontal": 24,
55
55
  "marginTop": 10,
@@ -63,7 +63,7 @@ exports[`elementMapper renders the nodes 1`] = `
63
63
  label="Summary of the test entry"
64
64
  numberOfLines={2}
65
65
  style={
66
- Object {
66
+ {
67
67
  "color": "#EFEFEF",
68
68
  "fontSize": 24,
69
69
  "fontStyle": "normal",
@@ -76,7 +76,7 @@ exports[`elementMapper renders the nodes 1`] = `
76
76
  <View
77
77
  key="3"
78
78
  style={
79
- Object {
79
+ {
80
80
  "height": 42,
81
81
  "margin": 24,
82
82
  "width": 56,
@@ -88,7 +88,7 @@ exports[`elementMapper renders the nodes 1`] = `
88
88
  <ImageContainer
89
89
  key="0"
90
90
  style={
91
- Object {
91
+ {
92
92
  "height": 42,
93
93
  "width": 56,
94
94
  }
@@ -3,7 +3,7 @@
3
3
  exports[`masterCellBuilder when using a custom data adapter renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
- Object {
6
+ {
7
7
  "flex": 1,
8
8
  }
9
9
  }
@@ -11,9 +11,8 @@ exports[`masterCellBuilder when using a custom data adapter renders correctly 1`
11
11
  <View
12
12
  cellUUID="mocked-uuid"
13
13
  key="0"
14
- skipButtons={false}
15
14
  style={
16
- Object {
15
+ {
17
16
  "backgroundColor": "#2F2F2F",
18
17
  "borderRadius": 4,
19
18
  "height": 436,
@@ -22,7 +21,7 @@ exports[`masterCellBuilder when using a custom data adapter renders correctly 1`
22
21
  }
23
22
  }
24
23
  wrapperRef={
25
- Object {
24
+ {
26
25
  "current": null,
27
26
  }
28
27
  }
@@ -33,7 +32,7 @@ exports[`masterCellBuilder when using a custom data adapter renders correctly 1`
33
32
  exports[`masterCellBuilder when using custom containerStyle renders correctly 1`] = `
34
33
  <View
35
34
  style={
36
- Object {
35
+ {
37
36
  "backgroundColor": "black",
38
37
  }
39
38
  }
@@ -41,10 +40,9 @@ exports[`masterCellBuilder when using custom containerStyle renders correctly 1`
41
40
  <View
42
41
  cellUUID="mocked-uuid"
43
42
  key="0"
44
- skipButtons={false}
45
- style={Object {}}
43
+ style={{}}
46
44
  wrapperRef={
47
- Object {
45
+ {
48
46
  "current": null,
49
47
  }
50
48
  }
@@ -55,7 +53,7 @@ exports[`masterCellBuilder when using custom containerStyle renders correctly 1`
55
53
  exports[`masterCellBuilder when using custom default components renders correctly 1`] = `
56
54
  <mockConstructor
57
55
  style={
58
- Object {
56
+ {
59
57
  "flex": 1,
60
58
  }
61
59
  }
@@ -63,10 +61,9 @@ exports[`masterCellBuilder when using custom default components renders correctl
63
61
  <mockConstructor
64
62
  cellUUID="mocked-uuid"
65
63
  key="0"
66
- skipButtons={false}
67
- style={Object {}}
64
+ style={{}}
68
65
  wrapperRef={
69
- Object {
66
+ {
70
67
  "current": null,
71
68
  }
72
69
  }
@@ -77,7 +74,7 @@ exports[`masterCellBuilder when using custom default components renders correctl
77
74
  exports[`masterCellBuilder when using default options can be invoked as a React Component 1`] = `
78
75
  <View
79
76
  style={
80
- Object {
77
+ {
81
78
  "flex": 1,
82
79
  }
83
80
  }
@@ -85,9 +82,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
85
82
  <View
86
83
  cellUUID="mocked-uuid"
87
84
  key="0"
88
- skipButtons={false}
89
85
  style={
90
- Object {
86
+ {
91
87
  "backgroundColor": "#2F2F2F",
92
88
  "borderRadius": 4,
93
89
  "height": 436,
@@ -96,13 +92,13 @@ exports[`masterCellBuilder when using default options can be invoked as a React
96
92
  }
97
93
  }
98
94
  whoAmI={
99
- Object {
95
+ {
100
96
  "contentType": "feed",
101
97
  "state": "default",
102
98
  }
103
99
  }
104
100
  wrapperRef={
105
- Object {
101
+ {
106
102
  "current": null,
107
103
  }
108
104
  }
@@ -111,9 +107,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
111
107
  cellUUID="mocked-uuid"
112
108
  key="0"
113
109
  numberOfLines={1}
114
- skipButtons={false}
115
110
  style={
116
- Object {
111
+ {
117
112
  "borderTopLeftRadius": 4,
118
113
  "borderTopRightRadius": 4,
119
114
  "height": 216,
@@ -125,9 +120,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
125
120
  <View
126
121
  cellUUID="mocked-uuid"
127
122
  key="1"
128
- skipButtons={false}
129
123
  style={
130
- Object {
124
+ {
131
125
  "height": 30,
132
126
  "marginHorizontal": 24,
133
127
  "marginTop": 24,
@@ -135,7 +129,7 @@ exports[`masterCellBuilder when using default options can be invoked as a React
135
129
  }
136
130
  }
137
131
  wrapperRef={
138
- Object {
132
+ {
139
133
  "current": null,
140
134
  }
141
135
  }
@@ -144,9 +138,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
144
138
  key="0"
145
139
  label="Test Entry"
146
140
  numberOfLines={1}
147
- skipButtons={false}
148
141
  style={
149
- Object {
142
+ {
150
143
  "color": "#EFEFEF",
151
144
  "fontSize": 26,
152
145
  "fontStyle": "normal",
@@ -158,9 +151,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
158
151
  <View
159
152
  cellUUID="mocked-uuid"
160
153
  key="2"
161
- skipButtons={false}
162
154
  style={
163
- Object {
155
+ {
164
156
  "height": 60,
165
157
  "marginHorizontal": 24,
166
158
  "marginTop": 10,
@@ -168,7 +160,7 @@ exports[`masterCellBuilder when using default options can be invoked as a React
168
160
  }
169
161
  }
170
162
  wrapperRef={
171
- Object {
163
+ {
172
164
  "current": null,
173
165
  }
174
166
  }
@@ -177,9 +169,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
177
169
  key="0"
178
170
  label="Summary of the test entry"
179
171
  numberOfLines={2}
180
- skipButtons={false}
181
172
  style={
182
- Object {
173
+ {
183
174
  "color": "#EFEFEF",
184
175
  "fontSize": 24,
185
176
  "fontStyle": "normal",
@@ -192,16 +183,15 @@ exports[`masterCellBuilder when using default options can be invoked as a React
192
183
  <View
193
184
  cellUUID="mocked-uuid"
194
185
  key="3"
195
- skipButtons={false}
196
186
  style={
197
- Object {
187
+ {
198
188
  "height": 42,
199
189
  "margin": 24,
200
190
  "width": 56,
201
191
  }
202
192
  }
203
193
  wrapperRef={
204
- Object {
194
+ {
205
195
  "current": null,
206
196
  }
207
197
  }
@@ -209,9 +199,8 @@ exports[`masterCellBuilder when using default options can be invoked as a React
209
199
  <ImageContainer
210
200
  cellUUID="mocked-uuid"
211
201
  key="0"
212
- skipButtons={false}
213
202
  style={
214
- Object {
203
+ {
215
204
  "height": 42,
216
205
  "width": 56,
217
206
  }
@@ -227,24 +216,24 @@ exports[`masterCellBuilder when using default options renders correctly 1`] = `
227
216
  <View>
228
217
  <Memo(MasterCell)
229
218
  item={
230
- Object {
231
- "author": Object {
219
+ {
220
+ "author": {
232
221
  "name": "John Doe",
233
222
  },
234
223
  "id": "A1234",
235
- "media_group": Array [
236
- Object {
237
- "media_item": Array [
238
- Object {
224
+ "media_group": [
225
+ {
226
+ "media_item": [
227
+ {
239
228
  "key": "image_base",
240
229
  "src": "http://urlOfTheImage.net/img.png",
241
230
  },
242
231
  ],
243
232
  "type": "image",
244
233
  },
245
- Object {
246
- "media_item": Array [
247
- Object {
234
+ {
235
+ "media_item": [
236
+ {
248
237
  "key": "logo_thumbnail",
249
238
  "src": "http://urlOfTheImage.net/channelLogo.png",
250
239
  },
@@ -255,7 +244,7 @@ exports[`masterCellBuilder when using default options renders correctly 1`] = `
255
244
  "published": "2019/03/17 02:17:46 +0000",
256
245
  "summary": "Summary of the test entry",
257
246
  "title": "Test Entry",
258
- "type": Object {
247
+ "type": {
259
248
  "value": "feed",
260
249
  },
261
250
  }
@@ -265,7 +254,7 @@ exports[`masterCellBuilder when using default options renders correctly 1`] = `
265
254
  `;
266
255
 
267
256
  exports[`masterCellBuilder when using default options returns a function 1`] = `
268
- Object {
257
+ {
269
258
  "$$typeof": Symbol(react.memo),
270
259
  "compare": null,
271
260
  "hasFocusableInside": [Function],
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { View } from "react-native";
2
3
 
3
4
  type ElementProps = {
4
5
  type: string;
@@ -44,11 +45,21 @@ const cellPlayerTypes = new Set([
44
45
  export function elementMapper(
45
46
  components,
46
47
  otherProps?: {
48
+ preferredFocus?: boolean;
47
49
  skipButtons?: boolean;
48
50
  cellUUID?: string;
49
- [key: string]: any;
50
51
  emitAsyncElementRegistrate?: () => void;
51
52
  emitAsyncElementLayout?: () => void;
53
+ focused?: boolean;
54
+ focusedButtonId?: string;
55
+ groupId?: string;
56
+ isFocusable?: boolean;
57
+ onToggleFocus?: (arg0: unknown) => void;
58
+ prefixId?: string;
59
+ skipFocusManagerRegistration?: boolean;
60
+ component?: ZappUIComponent;
61
+ componentId?: string;
62
+ wrapperRef: React.RefObject<typeof View>;
52
63
  }
53
64
  ) {
54
65
  return function Element({
@@ -8,7 +8,7 @@ import { MasterCellAsyncRenderManager } from "./MasterCellAsyncRenderManager";
8
8
  const layoutMeasure = (viewRef, onMeasure) => {
9
9
  viewRef?.measureLayout?.(
10
10
  findNodeHandle(viewRef),
11
- (x, y, width, height) => {
11
+ (_x, _y, width, height) => {
12
12
  onMeasure({ width, height });
13
13
  },
14
14
  noop
@@ -16,7 +16,7 @@ const layoutMeasure = (viewRef, onMeasure) => {
16
16
  };
17
17
 
18
18
  const regularMeasure = (viewRef, onMeasure) => {
19
- viewRef?.measure?.((x, y, width, height) => {
19
+ viewRef?.measure?.((_x, _y, width, height) => {
20
20
  onMeasure({ width, height });
21
21
  });
22
22
  };
@@ -11,7 +11,24 @@ import { getEntryState, hasFocusableInsideBuilder } from "./utils";
11
11
 
12
12
  type Props = {
13
13
  item: ZappEntry;
14
- state: null | "selected" | "focused";
14
+ state: null | "selected" | "focused" | "default";
15
+ emitAsyncElementRegistrate?: () => void;
16
+ emitAsyncElementLayout?: () => void;
17
+ skipButtons?: boolean;
18
+ cellUUID?: string;
19
+ // New props from CellWithFocusable
20
+ groupId?: string;
21
+ onToggleFocus?: (arg0: unknown) => void;
22
+ prefixId?: string;
23
+ focusedButtonId?: string;
24
+ preferredFocus?: boolean;
25
+ skipFocusManagerRegistration?: boolean;
26
+ isFocusable?: boolean;
27
+ focused?: boolean;
28
+ // New props from Gallery
29
+ component?: ZappUIComponent;
30
+ componentId?: string;
31
+ screenId: string;
15
32
  };
16
33
 
17
34
  const defaultContainerStyle = { flex: 1 };
@@ -39,6 +56,24 @@ type MasterCellBuilderOptions = {
39
56
  };
40
57
  };
41
58
 
59
+ // retrieve screendata from route
60
+ const useMasterCellScreen = (screenId?: string) => {
61
+ let _screenId = screenId;
62
+ const { screenData } = useRoute();
63
+
64
+ if (!screenId) {
65
+ // get screenId from targetScreen or screenData
66
+ _screenId =
67
+ screenData && "targetScreen" in screenData
68
+ ? screenData?.targetScreen?.id
69
+ : screenData?.id;
70
+ }
71
+
72
+ const { screen } = useScreenState(_screenId);
73
+
74
+ return screen;
75
+ };
76
+
42
77
  export function masterCellBuilder({
43
78
  components = defaultComponents,
44
79
  cellConfiguration,
@@ -63,15 +98,8 @@ export function masterCellBuilder({
63
98
  * inflated with the data coming from the data source
64
99
  * @param {"selected" | "focused" | null} props.state state of the component
65
100
  */
66
- function MasterCell({ item, state, ...otherProps }: Props) {
67
- const { screenData } = useRoute();
68
-
69
- const screenId =
70
- screenData && "targetScreen" in screenData
71
- ? screenData?.targetScreen?.id
72
- : screenData?.id;
73
-
74
- const { screen } = useScreenState(screenId);
101
+ function MasterCell({ item, state, screenId, ...otherProps }: Props) {
102
+ const screen = useMasterCellScreen(screenId);
75
103
 
76
104
  const selectedState = screen?.selectedEntry;
77
105
 
@@ -97,18 +125,56 @@ export function masterCellBuilder({
97
125
  item?.id,
98
126
  ]);
99
127
 
100
- const remapElements = mapElementWithKey(
101
- elementMapper(componentsMap, {
102
- ...otherProps,
103
- wrapperRef,
104
- cellUUID,
105
- skipButtons,
106
- })
128
+ const remapElements = React.useMemo(
129
+ () =>
130
+ mapElementWithKey(
131
+ elementMapper(componentsMap, {
132
+ wrapperRef,
133
+ emitAsyncElementRegistrate: otherProps.emitAsyncElementRegistrate,
134
+ emitAsyncElementLayout: otherProps.emitAsyncElementLayout,
135
+ preferredFocus: otherProps.preferredFocus,
136
+ cellUUID: cellUUID || otherProps.cellUUID,
137
+ skipButtons: skipButtons || otherProps.skipButtons,
138
+ // cellWithFocusable
139
+ focused: otherProps.focused,
140
+ focusedButtonId: otherProps.focusedButtonId,
141
+ groupId: otherProps.groupId,
142
+ isFocusable: otherProps.isFocusable,
143
+ onToggleFocus: otherProps.onToggleFocus,
144
+ prefixId: otherProps.prefixId,
145
+ skipFocusManagerRegistration:
146
+ otherProps.skipFocusManagerRegistration,
147
+ // gallery
148
+ component: otherProps.component,
149
+ componentId: otherProps.componentId,
150
+ })
151
+ ),
152
+ [
153
+ componentsMap,
154
+ otherProps.emitAsyncElementRegistrate,
155
+ otherProps.emitAsyncElementLayout,
156
+ cellUUID || otherProps.cellUUID,
157
+ skipButtons || otherProps.skipButtons,
158
+ otherProps.focused,
159
+ otherProps.focusedButtonId,
160
+ otherProps.groupId,
161
+ otherProps.isFocusable,
162
+ otherProps.onToggleFocus,
163
+ otherProps.prefixId,
164
+ otherProps.skipFocusManagerRegistration,
165
+ otherProps.component,
166
+ otherProps.componentId,
167
+ ]
168
+ );
169
+
170
+ const renderElements = React.useMemo(
171
+ () => elements.map(remapElements),
172
+ [remapElements, elements]
107
173
  );
108
174
 
109
175
  return (
110
176
  <View style={containerStyle} ref={wrapperRef}>
111
- {elements.map(remapElements)}
177
+ {renderElements}
112
178
  </View>
113
179
  );
114
180
  }
@@ -103,7 +103,7 @@ export const useFilterChildren = <
103
103
  item: any;
104
104
  pluginIdentifier: string;
105
105
  };
106
- }
106
+ },
107
107
  >(
108
108
  children: T[]
109
109
  ): T[] => {
@@ -3,7 +3,7 @@
3
3
  exports[`OfflineHandler renders 1`] = `
4
4
  <View
5
5
  style={
6
- Object {
6
+ {
7
7
  "flex": 1,
8
8
  "position": "relative",
9
9
  }
@@ -11,7 +11,7 @@ exports[`OfflineHandler renders 1`] = `
11
11
  >
12
12
  <View
13
13
  style={
14
- Object {
14
+ {
15
15
  "bottom": 0,
16
16
  "left": 0,
17
17
  "position": "absolute",
@@ -32,7 +32,7 @@ exports[`OfflineHandler renders 1`] = `
32
32
  onResponderTerminationRequest={[Function]}
33
33
  onStartShouldSetResponder={[Function]}
34
34
  style={
35
- Object {
35
+ {
36
36
  "alignItems": "center",
37
37
  "backgroundColor": undefined,
38
38
  "flex": 1,
@@ -43,8 +43,8 @@ exports[`OfflineHandler renders 1`] = `
43
43
  "position": "absolute",
44
44
  "right": 0,
45
45
  "top": 0,
46
- "transform": Array [
47
- Object {
46
+ "transform": [
47
+ {
48
48
  "translateY": -88,
49
49
  },
50
50
  ],
@@ -54,7 +54,7 @@ exports[`OfflineHandler renders 1`] = `
54
54
  >
55
55
  <View
56
56
  style={
57
- Object {
57
+ {
58
58
  "backgroundColor": undefined,
59
59
  "height": 44,
60
60
  }
@@ -62,7 +62,7 @@ exports[`OfflineHandler renders 1`] = `
62
62
  />
63
63
  <Text
64
64
  style={
65
- Object {
65
+ {
66
66
  "color": undefined,
67
67
  "fontFamily": undefined,
68
68
  "fontSize": undefined,
@@ -2,43 +2,46 @@ import React from "react";
2
2
 
3
3
  import renderer, { act } from "react-test-renderer";
4
4
 
5
- jest.useFakeTimers();
5
+ jest.useFakeTimers({ legacyFakeTimers: true });
6
6
 
7
- let connectionStatus = false;
8
- const previousValue = null;
7
+ let mockConnectionStatus = false;
8
+ const mockPreviousValue = null;
9
9
 
10
10
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/connection", () => {
11
11
  return {
12
- useConnectionInfo: jest.fn(() => connectionStatus),
12
+ useConnectionInfo: jest.fn(() => mockConnectionStatus),
13
13
  };
14
14
  });
15
15
 
16
16
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
17
17
  return {
18
- usePrevious: jest.fn(() => previousValue),
18
+ usePrevious: jest.fn(() => mockPreviousValue),
19
19
  };
20
20
  });
21
21
 
22
- jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
23
- usePickFromState: () => ({
24
- plugins: [
25
- {
26
- name: "offline experience",
27
- identifier: "offline-experience",
28
- type: "general",
29
- module: {
30
- useOfflineExperienceConfiguration: () => ({
31
- configurationFields: {},
32
- localizations: {
33
- offline_toast_message: "No internet connection",
34
- online_toast_message: "You are back online",
35
- },
36
- }),
22
+ jest.mock(
23
+ "@applicaster/zapp-react-native-redux/hooks/usePickFromState",
24
+ () => ({
25
+ usePickFromState: () => ({
26
+ plugins: [
27
+ {
28
+ name: "offline experience",
29
+ identifier: "offline-experience",
30
+ type: "general",
31
+ module: {
32
+ useOfflineExperienceConfiguration: () => ({
33
+ configurationFields: {},
34
+ localizations: {
35
+ offline_toast_message: "No internet connection",
36
+ online_toast_message: "You are back online",
37
+ },
38
+ }),
39
+ },
37
40
  },
38
- },
39
- ],
40
- }),
41
- }));
41
+ ],
42
+ }),
43
+ })
44
+ );
42
45
 
43
46
  jest.mock("react-native-safe-area-context", () => ({
44
47
  useSafeAreaInsets: () => ({ top: 44 }),
@@ -53,7 +56,7 @@ describe("OfflineHandler", () => {
53
56
  });
54
57
 
55
58
  it("renders Notification mode if component was rendered while online", () => {
56
- connectionStatus = true;
59
+ mockConnectionStatus = true;
57
60
 
58
61
  let instance;
59
62
 
@@ -35,10 +35,8 @@ import {
35
35
  log_warning,
36
36
  } from "./logger";
37
37
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
38
- import {
39
- useSetNavbarState,
40
- useTargetScreenData,
41
- } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
38
+ import { useSetNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
39
+ import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData";
42
40
  import {
43
41
  PlayerContainerContext,
44
42
  PlayerContainerContextProvider,
@@ -382,7 +380,7 @@ const PlayerContainerComponent = (props: Props) => {
382
380
  }
383
381
  };
384
382
 
385
- const playerRemoteHandler = (component, event, isLanguageOverlayVisible) => {
383
+ const playerRemoteHandler = (event, isLanguageOverlayVisible) => {
386
384
  const { eventType } = event;
387
385
 
388
386
  if (!isLanguageOverlayVisible && eventType === "menu") {
@@ -625,12 +623,8 @@ const PlayerContainerComponent = (props: Props) => {
625
623
  <PlayerContainerContext.Consumer>
626
624
  {(context) => (
627
625
  <TVEventHandlerComponent
628
- tvEventHandler={(component, event) =>
629
- playerRemoteHandler(
630
- component,
631
- event,
632
- context.isLanguageOverlayVisible
633
- )
626
+ tvEventHandler={(_component, event) =>
627
+ playerRemoteHandler(event, context.isLanguageOverlayVisible)
634
628
  }
635
629
  >
636
630
  <FocusableGroup