@applicaster/zapp-react-native-ui-components 13.0.5-rc.0 → 14.0.0-alpha.1101330035

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 (32) hide show
  1. package/Components/AudioPlayer/tv/Layout.tsx +4 -2
  2. package/Components/Cell/index.js +6 -2
  3. package/Components/Focusable/Focusable.tsx +5 -3
  4. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  5. package/Components/Focusable/index.android.tsx +12 -8
  6. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
  7. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
  8. package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
  9. package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
  10. package/Components/MasterCell/utils/index.ts +23 -3
  11. package/Components/PlayerContainer/PlayerContainer.tsx +17 -15
  12. package/Components/River/TV/River.tsx +0 -3
  13. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
  14. package/Components/Transitioner/Scene.tsx +1 -0
  15. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
  16. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  17. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  18. package/Components/VideoModal/VideoModal.tsx +3 -17
  19. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  20. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  21. package/Components/VideoModal/hooks/index.ts +0 -2
  22. package/Components/VideoModal/hooks/useModalSize.ts +18 -2
  23. package/Components/VideoModal/utils.ts +6 -0
  24. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  25. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  26. package/Decorators/RiverFeedLoader/index.tsx +8 -2
  27. package/Decorators/RiverFeedLoader/utils/index.ts +7 -2
  28. package/Decorators/ZappPipesDataConnector/index.tsx +20 -2
  29. package/index.d.ts +0 -1
  30. package/package.json +5 -9
  31. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
  32. package/Decorators/Navigator/__tests__/react-router-native-mock.js +0 -11
@@ -21,87 +21,27 @@ exports[`PlayerWrapper renders inline 1`] = `
21
21
  "top": "additive",
22
22
  }
23
23
  }
24
- style={
25
- [
26
- {
27
- "backgroundColor": "transparent",
28
- },
29
- {
30
- "height": 800,
31
- "width": 300,
32
- },
33
- {},
34
- ]
35
- }
24
+ style={{}}
36
25
  >
37
26
  <View
38
- additionalData={
39
- {
40
- "saveArea": true,
41
- }
42
- }
43
- animationType="moveUpComponent"
44
27
  style={
45
28
  [
46
29
  {
47
- "flexDirection": "column",
30
+ "alignSelf": "center",
31
+ "position": "relative",
32
+ "zIndex": 200,
48
33
  },
34
+ {},
49
35
  {
50
- "flex": 1,
36
+ "aspectRatio": 1.7777777777777777,
37
+ "height": undefined,
38
+ "width": "100%",
51
39
  },
40
+ {},
52
41
  ]
53
42
  }
54
- >
55
- <View
56
- style={
57
- [
58
- {
59
- "alignSelf": "center",
60
- "position": "relative",
61
- "zIndex": 200,
62
- },
63
- {
64
- "aspectRatio": 1.7777777777777777,
65
- "height": undefined,
66
- "width": "100%",
67
- },
68
- {},
69
- {},
70
- ]
71
- }
72
- testID="test-player-container"
73
- />
74
- <View
75
- animationType="componentFade"
76
- style={
77
- {
78
- "flex": 1,
79
- }
80
- }
81
- >
82
- <View
83
- configuration={
84
- {
85
- "tablet_landscape_player_container_background_color": "red",
86
- "tablet_landscape_sidebar_width": "35%",
87
- }
88
- }
89
- entry={
90
- {
91
- "id": "test",
92
- }
93
- }
94
- isTablet={false}
95
- isTabletLandscape={false}
96
- style={
97
- {
98
- "flex": 1,
99
- "paddingTop": 20,
100
- }
101
- }
102
- />
103
- </View>
104
- </View>
43
+ testID="test-player-container"
44
+ />
105
45
  </RNCSafeAreaView>
106
46
  </RNCSafeAreaProvider>
107
47
  `;
@@ -127,57 +67,27 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
127
67
  "top": "additive",
128
68
  }
129
69
  }
130
- style={
131
- [
132
- {
133
- "backgroundColor": "transparent",
134
- },
135
- {
136
- "height": undefined,
137
- "width": 300,
138
- },
139
- {},
140
- ]
141
- }
70
+ style={{}}
142
71
  >
143
72
  <View
144
- additionalData={
145
- {
146
- "saveArea": true,
147
- }
148
- }
149
- animationType="moveUpComponent"
150
73
  style={
151
74
  [
152
75
  {
153
- "flexDirection": "column",
76
+ "alignSelf": "center",
77
+ "position": "relative",
78
+ "zIndex": 200,
154
79
  },
80
+ {},
155
81
  {
156
- "flex": 1,
82
+ "aspectRatio": 1.7777777777777777,
83
+ "height": undefined,
84
+ "width": "100%",
157
85
  },
86
+ {},
158
87
  ]
159
88
  }
160
- >
161
- <View
162
- style={
163
- [
164
- {
165
- "alignSelf": "center",
166
- "position": "relative",
167
- "zIndex": 200,
168
- },
169
- {
170
- "aspectRatio": undefined,
171
- "height": undefined,
172
- "width": "100%",
173
- },
174
- {},
175
- {},
176
- ]
177
- }
178
- testID="test-player-container"
179
- />
180
- </View>
89
+ testID="test-player-container"
90
+ />
181
91
  </RNCSafeAreaView>
182
92
  </RNCSafeAreaProvider>
183
93
  `;
@@ -203,103 +113,27 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
203
113
  "top": "additive",
204
114
  }
205
115
  }
206
- style={
207
- [
208
- {
209
- "backgroundColor": "red",
210
- },
211
- {
212
- "height": 800,
213
- "width": 300,
214
- },
215
- {},
216
- ]
217
- }
116
+ style={{}}
218
117
  >
219
118
  <View
220
- additionalData={
221
- {
222
- "saveArea": true,
223
- }
224
- }
225
- animationType="moveUpComponent"
226
119
  style={
227
120
  [
228
121
  {
229
- "flexDirection": "row",
122
+ "alignSelf": "center",
123
+ "position": "relative",
124
+ "zIndex": 200,
230
125
  },
126
+ {},
231
127
  {
232
- "flex": 1,
128
+ "aspectRatio": 1.7777777777777777,
129
+ "height": undefined,
130
+ "width": 195,
233
131
  },
132
+ {},
234
133
  ]
235
134
  }
236
- >
237
- <View
238
- style={
239
- [
240
- {
241
- "alignSelf": "center",
242
- "position": "relative",
243
- "zIndex": 200,
244
- },
245
- {
246
- "aspectRatio": 1.7777777777777777,
247
- "height": undefined,
248
- "width": 195,
249
- },
250
- {},
251
- {},
252
- ]
253
- }
254
- testID="test-player-container"
255
- >
256
- <View
257
- additionalData={
258
- {
259
- "disableAnimatedComponent": false,
260
- "resetAnimationValue": undefined,
261
- "useLayoutMeasure": true,
262
- }
263
- }
264
- animationType="moveUpComponent"
265
- style={
266
- {
267
- "flex": 1,
268
- }
269
- }
270
- />
271
- </View>
272
- <View
273
- animationType="componentFade"
274
- style={
275
- {
276
- "flex": 1,
277
- }
278
- }
279
- >
280
- <View
281
- configuration={
282
- {
283
- "tablet_landscape_player_container_background_color": "red",
284
- "tablet_landscape_sidebar_width": "35%",
285
- }
286
- }
287
- entry={
288
- {
289
- "id": "test",
290
- }
291
- }
292
- isTablet={true}
293
- isTabletLandscape={true}
294
- style={
295
- {
296
- "flex": 1,
297
- "paddingTop": 20,
298
- }
299
- }
300
- />
301
- </View>
302
- </View>
135
+ testID="test-player-container"
136
+ />
303
137
  </RNCSafeAreaView>
304
138
  </RNCSafeAreaProvider>
305
139
  `;
@@ -325,57 +159,27 @@ exports[`PlayerWrapper renders properly 1`] = `
325
159
  "top": "additive",
326
160
  }
327
161
  }
328
- style={
329
- [
330
- {
331
- "backgroundColor": "transparent",
332
- },
333
- {
334
- "height": 800,
335
- "width": 300,
336
- },
337
- {},
338
- ]
339
- }
162
+ style={{}}
340
163
  >
341
164
  <View
342
- additionalData={
343
- {
344
- "saveArea": true,
345
- }
346
- }
347
- animationType="moveUpComponent"
348
165
  style={
349
166
  [
350
167
  {
351
- "flexDirection": "column",
168
+ "alignSelf": "center",
169
+ "position": "relative",
170
+ "zIndex": 200,
352
171
  },
172
+ {},
353
173
  {
354
- "flex": 1,
174
+ "aspectRatio": 1.7786666666666666,
175
+ "height": undefined,
176
+ "width": "100%",
355
177
  },
178
+ {},
356
179
  ]
357
180
  }
358
- >
359
- <View
360
- style={
361
- [
362
- {
363
- "alignSelf": "center",
364
- "position": "relative",
365
- "zIndex": 200,
366
- },
367
- {
368
- "aspectRatio": 1.7786666666666666,
369
- "height": undefined,
370
- "width": "100%",
371
- },
372
- {},
373
- {},
374
- ]
375
- }
376
- testID="test-player-container"
377
- />
378
- </View>
181
+ testID="test-player-container"
182
+ />
379
183
  </RNCSafeAreaView>
380
184
  </RNCSafeAreaProvider>
381
185
  `;
@@ -1,5 +1,3 @@
1
- export { useBackgroundColor } from "./useBackgroundColor";
2
-
3
1
  export { useDelayedPlayerDetails } from "./useDelayedPlayerDetails";
4
2
 
5
3
  export { useInitialPlayerState } from "./useInitialPlayerState";
@@ -9,6 +9,12 @@ import {
9
9
 
10
10
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
11
11
  import { useSafeAreaFrame } from "react-native-safe-area-context";
12
+ import {
13
+ isAndroidPlatform,
14
+ isAndroidVersionAtLeast,
15
+ } from "@applicaster/zapp-react-native-utils/reactUtils";
16
+ import { StatusBar } from "react-native";
17
+ import { isAndroidTablet } from "@applicaster/zapp-react-native-utils/reactHooks/layout/isTablet";
12
18
 
13
19
  const { Logger } = getXray();
14
20
 
@@ -27,12 +33,17 @@ const MODAL_SIZE_FOR_LANDSCAPE: Size = {
27
33
  height: "100%",
28
34
  };
29
35
 
36
+ const isOldAndroidDevice =
37
+ isAndroidPlatform() && !isAndroidVersionAtLeast(35) && !isAndroidTablet();
38
+
30
39
  export const useModalSize = (): Size => {
31
40
  const frame = useSafeAreaFrame();
32
41
 
33
42
  const [modalSize, setModalSize] = React.useState<Size>({
34
43
  width: frame.width,
35
- height: frame.height,
44
+ height: isOldAndroidDevice
45
+ ? frame.height + StatusBar.currentHeight
46
+ : frame.height,
36
47
  });
37
48
 
38
49
  const setNewModalSize = React.useCallback((newSize, log) => {
@@ -44,7 +55,12 @@ export const useModalSize = (): Size => {
44
55
  return oldSize;
45
56
  }
46
57
 
47
- return newSize;
58
+ return {
59
+ width: newSize.width,
60
+ height: isOldAndroidDevice
61
+ ? newSize.height + StatusBar.currentHeight
62
+ : newSize.height,
63
+ };
48
64
  });
49
65
 
50
66
  logger.debug({
@@ -34,6 +34,9 @@ export const useConfiguration = () => {
34
34
  minimised_height = 0,
35
35
  minimised_height_tablet = 0,
36
36
  modal_background_color,
37
+ tablet_landscape_player_container_background_color,
38
+ screen_background_color,
39
+ audio_player_background_color,
37
40
  } = config;
38
41
 
39
42
  const minimisedHeight = useIsTablet()
@@ -43,6 +46,9 @@ export const useConfiguration = () => {
43
46
  return {
44
47
  minimised_height: Number(minimisedHeight),
45
48
  modal_background_color,
49
+ tablet_landscape_player_container_background_color,
50
+ audio_player_background_color,
51
+ screen_background_color,
46
52
  };
47
53
  };
48
54
 
@@ -4,8 +4,8 @@ which helps in detecting whether a given component is visible within the viewpor
4
4
  It is useful for implementing lazy loading or triggering specific actions when a component comes into view.
5
5
  */
6
6
 
7
- import React, { useEffect, useState, useRef, ReactNode, FC } from "react";
8
- import { View, Dimensions } from "react-native";
7
+ import React, { FC, ReactNode, useEffect, useRef, useState } from "react";
8
+ import { Dimensions, View } from "react-native";
9
9
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
10
10
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
11
 
@@ -78,7 +78,7 @@ const VisibilitySensorComponent: FC<Props> = ({
78
78
  };
79
79
 
80
80
  const stopWatching = () => {
81
- interval = clearInterval(interval);
81
+ clearInterval(interval);
82
82
  };
83
83
 
84
84
  const isInViewPort = () => {
@@ -1,10 +1,10 @@
1
1
  import {
2
- getColor,
3
2
  ACTIVE_COLOR,
4
3
  BACKGROUND_COLOR,
5
- MAIN_TEXT_COLOR,
6
4
  FOCUSED_TEXT_COLOR,
7
- } from "../../../colors/index";
5
+ getColor,
6
+ MAIN_TEXT_COLOR,
7
+ } from "../../../colors";
8
8
 
9
9
  const Image = "Image";
10
10
  const View = "View";
@@ -13,6 +13,7 @@ import {
13
13
  loadDatasources,
14
14
  usePipesContexts,
15
15
  } from "./utils";
16
+ import { useScreenResolvers } from "@applicaster/zapp-react-native-utils/actionsExecutor/screenResolver";
16
17
 
17
18
  type RiverProps = {
18
19
  dispatch: DispatchProp;
@@ -25,7 +26,7 @@ export function WithRiverFeedLoader(Component: ZappComponent) {
25
26
  return function WrappedWithRiverFeedLoader(props: RiverProps) {
26
27
  const { river } = props;
27
28
  const { screenData, pathname } = useRoute();
28
-
29
+ const resolvers = useScreenResolvers();
29
30
  const pipesContexts = usePipesContexts(river.id, pathname);
30
31
 
31
32
  const componentsToLoad = ignoreComponentsWithClearCacheFlag(
@@ -49,7 +50,12 @@ export function WithRiverFeedLoader(Component: ZappComponent) {
49
50
  item?.filter((item2) => item2 !== undefined)
50
51
  );
51
52
 
52
- loadDatasources(nonEmptyDataSources, river?.id, props.dispatch);
53
+ loadDatasources(
54
+ nonEmptyDataSources,
55
+ river?.id,
56
+ props.dispatch,
57
+ resolvers
58
+ );
53
59
  }, []);
54
60
 
55
61
  return <Component {...props} />;
@@ -12,11 +12,16 @@ export { getDatasourceUrl } from "./getDatasourceUrl";
12
12
 
13
13
  export const DATASOURCE_CHUNKS = 10;
14
14
 
15
- export async function loadDatasources(urls: string[][], riverId, dispatch) {
15
+ export async function loadDatasources(
16
+ urls: string[][],
17
+ riverId,
18
+ dispatch,
19
+ resolvers
20
+ ) {
16
21
  return reducePromises<string, void>(
17
22
  mapPromises<string, void>((url) => {
18
23
  if (url) {
19
- return dispatch(loadPipesData(url, { riverId }));
24
+ return dispatch(loadPipesData(url, { riverId, resolvers }));
20
25
  }
21
26
  }),
22
27
  undefined,
@@ -19,7 +19,11 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
19
19
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
20
20
 
21
21
  import { isVerticalListOrGrid } from "./utils";
22
- import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
22
+ import {
23
+ subscribeForUrlContextKeyChanges,
24
+ subscribeForUrlScreenKeyChanges,
25
+ } from "@applicaster/zapp-pipes-v2-client";
26
+ import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
23
27
 
24
28
  type Props = {
25
29
  component: ZappUIComponent;
@@ -204,7 +208,9 @@ export function zappPipesDataConnector(
204
208
  Component: React.FC<any> | React.ComponentClass<any>
205
209
  ) {
206
210
  return function WrappedWithZappPipesData(props: Props) {
207
- const { screenData } = useRoute();
211
+ const { screenData, pathname } = useRoute();
212
+ const screenStateStore = useScreenStateStore();
213
+
208
214
  const { plugins } = usePickFromState(["plugins"]);
209
215
 
210
216
  const screenContextData = useScreenContext();
@@ -286,6 +292,18 @@ export function zappPipesDataConnector(
286
292
  componentIndex
287
293
  );
288
294
 
295
+ useEffect(() => {
296
+ if (!(dataSourceUrl?.includes("pipesv2://") && reloadData)) {
297
+ return subscribeForUrlScreenKeyChanges(
298
+ dataSourceUrl,
299
+ pathname,
300
+ screenStateStore,
301
+ {},
302
+ reloadData
303
+ );
304
+ }
305
+ }, [dataSourceUrl, reloadData]);
306
+
289
307
  useEffect(() => {
290
308
  if (dataSourceUrl?.includes("pipesv2://") && reloadData) {
291
309
  const addListener = getListenerFromPlugin(dataSourceUrl, plugins);
package/index.d.ts CHANGED
@@ -24,7 +24,6 @@ type GeneralContentScreenProps = {
24
24
  } & Record<string, any>;
25
25
  focused?: boolean;
26
26
  parentFocus?: ParentFocus;
27
- extraOffset?: number;
28
27
  containerHeight?: number;
29
28
  };
30
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.5-rc.0",
3
+ "version": "14.0.0-alpha.1101330035",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,16 +27,12 @@
27
27
  "url": "https://github.com/applicaster/quickbrick/issues"
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
- "devDependencies": {
31
- "redux-mock-store": "^1.5.3"
32
- },
33
30
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.5-rc.0",
35
- "@applicaster/zapp-react-native-bridge": "13.0.5-rc.0",
36
- "@applicaster/zapp-react-native-redux": "13.0.5-rc.0",
37
- "@applicaster/zapp-react-native-utils": "13.0.5-rc.0",
31
+ "@applicaster/applicaster-types": "14.0.0-alpha.1101330035",
32
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.1101330035",
33
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.1101330035",
34
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1101330035",
38
35
  "promise": "^8.3.0",
39
- "react-router-native": "^5.1.2",
40
36
  "url": "^0.11.0",
41
37
  "uuid": "^3.3.2"
42
38
  },
@@ -1,10 +0,0 @@
1
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
2
- import { useConfiguration } from "../utils";
3
-
4
- export const useBackgroundColor = (): string => {
5
- const { modal_background_color: modalBackgroundColor } = useConfiguration();
6
-
7
- const theme = useTheme<BaseThemePropertiesMobile>();
8
-
9
- return modalBackgroundColor || theme?.status_background_color;
10
- };
@@ -1,11 +0,0 @@
1
- import React from "react";
2
-
3
- const reactRouter = jest.genMockFromModule("react-router-native");
4
-
5
- function withRouter(Component) {
6
- return (props) => <Component {...props} />; // eslint-disable-line react/display-name
7
- }
8
-
9
- reactRouter.withRouter = withRouter;
10
-
11
- module.exports = reactRouter;