@applicaster/zapp-react-native-utils 13.0.0-alpha.6400875052 → 13.0.0-alpha.6444233049

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 (49) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +32 -0
  2. package/actionsExecutor/consts.ts +4 -0
  3. package/appUtils/__tests__/__snapshots__/localizationsHelper.test.ts.snap +151 -0
  4. package/appUtils/__tests__/allZappLocales.ts +79 -0
  5. package/appUtils/__tests__/{localizationsHelper.test.js → localizationsHelper.test.ts} +11 -0
  6. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +2 -0
  7. package/appUtils/focusManager/index.ios.ts +14 -4
  8. package/appUtils/focusManager/index.ts +13 -0
  9. package/appUtils/focusManager/utils/__tests__/findChild.test.ts +35 -0
  10. package/appUtils/focusManager/utils/index.ts +5 -0
  11. package/appUtils/localizationsHelper.ts +31 -0
  12. package/appUtils/playerManager/playerHooks/usePlayerCurrentTime.tsx +11 -7
  13. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +7 -1
  14. package/cellUtils/index.ts +9 -5
  15. package/componentsUtils/__tests__/isFirstComponentGallery.test.ts +33 -0
  16. package/componentsUtils/__tests__/isFirstComponentScreenPicker.test.ts +33 -0
  17. package/componentsUtils/__tests__/isGallery.test.ts +33 -0
  18. package/componentsUtils/__tests__/isScreenPicker.test.ts +33 -0
  19. package/componentsUtils/index.ts +39 -0
  20. package/dateUtils/index.ts +17 -0
  21. package/functionUtils/index.ts +25 -0
  22. package/index.d.ts +0 -12
  23. package/localizationUtils/index.ts +8 -13
  24. package/manifestUtils/defaultManifestConfigurations/generalContent.js +13 -0
  25. package/manifestUtils/defaultManifestConfigurations/player.js +6 -8
  26. package/manifestUtils/index.js +2 -0
  27. package/manifestUtils/keys.js +27 -2
  28. package/modalState/__tests__/index.test.ts +51 -0
  29. package/navigationUtils/__tests__/__snapshots__/navigationUtils.test.js.snap +1 -0
  30. package/navigationUtils/index.ts +3 -1
  31. package/numberUtils/__tests__/toPositiveNumberWithDefault.test.ts +23 -3
  32. package/numberUtils/index.ts +4 -0
  33. package/package.json +2 -2
  34. package/playerUtils/configurationGenerator.ts +6 -16
  35. package/reactHooks/feed/useBatchLoading.ts +10 -12
  36. package/reactHooks/feed/useFeedLoader.tsx +13 -6
  37. package/reactHooks/navigation/{useGetTabBarHeight.ts → getTabBarHeight.ts} +1 -1
  38. package/reactHooks/navigation/useGetBottomTabBarHeight.ts +10 -3
  39. package/reactHooks/navigation/useNavigationPluginData.ts +8 -4
  40. package/reactHooks/navigation/useNavigationType.ts +4 -2
  41. package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +69 -0
  42. package/reactHooks/screen/useScreenBackgroundColor.ts +3 -15
  43. package/reactHooks/state/README.md +79 -0
  44. package/reactHooks/state/ZStoreProvider.tsx +71 -0
  45. package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +66 -0
  46. package/reactHooks/state/index.ts +2 -0
  47. package/reactHooks/useListenEventBusEvent.ts +1 -1
  48. package/reactUtils/index.ts +9 -0
  49. package/utils/index.ts +1 -1
@@ -0,0 +1,33 @@
1
+ import { isScreenPicker } from "..";
2
+
3
+ describe("isScreenPicker", () => {
4
+ it("should return true if the component type is 'screen-picker-qb-tv'", () => {
5
+ const item = { component_type: "screen-picker-qb-tv" };
6
+ expect(isScreenPicker(item)).toBe(true);
7
+ });
8
+
9
+ it("should return false if the component type is not 'screen-picker-qb-tv'", () => {
10
+ const item = { component_type: "other-component" };
11
+ expect(isScreenPicker(item)).toBe(false);
12
+ });
13
+
14
+ it("should return false if the component type is undefined", () => {
15
+ const item = { component_type: undefined };
16
+ expect(isScreenPicker(item)).toBe(false);
17
+ });
18
+
19
+ it("should return false if the item is null", () => {
20
+ const item = null;
21
+ expect(isScreenPicker(item)).toBe(false);
22
+ });
23
+
24
+ it("should return false if the item is undefined", () => {
25
+ const item = undefined;
26
+ expect(isScreenPicker(item)).toBe(false);
27
+ });
28
+
29
+ it("should return false if the item is an empty object", () => {
30
+ const item = {};
31
+ expect(isScreenPicker(item)).toBe(false);
32
+ });
33
+ });
@@ -0,0 +1,39 @@
1
+ const GROUP = "group-qb";
2
+ const GROUP_INFO = "group-info-qb";
3
+ const GROUP_INFO_OLD = "group-info";
4
+ const EMPTY_GROUP_COMPONENT = "empty_group_component";
5
+
6
+ const GALLERY = "gallery-qb";
7
+
8
+ const SCREEN_PICKER = "screen-picker-qb-tv";
9
+
10
+ const HORIZONTAL_LIST = "horizontal_list_qb";
11
+
12
+ export const isGallery = (item): boolean => item?.component_type === GALLERY;
13
+
14
+ export const isHorizontalList = (item): boolean =>
15
+ item?.component_type === HORIZONTAL_LIST;
16
+
17
+ export const isScreenPicker = (item): boolean =>
18
+ item?.component_type === SCREEN_PICKER;
19
+
20
+ export const isFirstComponentScreenPicker = (
21
+ components: ZappUIComponent[]
22
+ ): boolean => {
23
+ return isScreenPicker(components?.[0]);
24
+ };
25
+
26
+ export const isFirstComponentGallery = (
27
+ components: ZappUIComponent[]
28
+ ): boolean => {
29
+ return isGallery(components?.[0]);
30
+ };
31
+
32
+ export const isGroup = (item): boolean => item?.component_type === GROUP;
33
+
34
+ export const isEmptyGroup = (item): boolean =>
35
+ item?.component_type === EMPTY_GROUP_COMPONENT;
36
+
37
+ export const isGroupInfo = (item): boolean =>
38
+ item?.component_type === GROUP_INFO ||
39
+ item?.component_type === GROUP_INFO_OLD;
@@ -3,6 +3,7 @@ import utc from "dayjs/plugin/utc";
3
3
  import timezone from "dayjs/plugin/timezone";
4
4
  import isoWeek from "dayjs/plugin/isoWeek";
5
5
  import duration from "dayjs/plugin/duration";
6
+ import relativeTime from "dayjs/plugin/relativeTime";
6
7
 
7
8
  // Extend dayjs with plugins
8
9
  dayjs.extend(utc);
@@ -10,4 +11,20 @@ dayjs.extend(timezone);
10
11
  dayjs.extend(isoWeek);
11
12
  dayjs.extend(duration);
12
13
 
14
+ dayjs.extend(relativeTime, {
15
+ thresholds: [
16
+ { l: "s", r: 1 },
17
+ { l: "m", r: 1 },
18
+ { l: "mm", r: 59, d: "minute" },
19
+ { l: "h", r: 1 },
20
+ { l: "hh", r: 23, d: "hour" },
21
+ { l: "d", r: 1 },
22
+ { l: "dd", r: 29, d: "day" },
23
+ { l: "M", r: 1 },
24
+ { l: "MM", r: 11, d: "month" },
25
+ { l: "y", r: 1 },
26
+ { l: "yy", d: "year" },
27
+ ],
28
+ });
29
+
13
30
  export { dayjs };
@@ -258,3 +258,28 @@ export const extractDataFromProperty = (property, data): any =>
258
258
  );
259
259
 
260
260
  export const then = (fn) => (promise) => promise.then(fn);
261
+
262
+ /**
263
+ * Returns a replacer function for JSON.stringify that handles circular references,
264
+ * functions, and React context objects
265
+ * @returns {Function} A replacer function that detects and handles circular references,
266
+ * functions, and React context objects
267
+ */
268
+ export const getJsonReplacer = () => {
269
+ return (_key, value) => {
270
+ if (typeof value === "function") {
271
+ return "[Function]";
272
+ }
273
+
274
+ if (
275
+ typeof value === "object" &&
276
+ value !== null &&
277
+ value.Provider &&
278
+ value.Consumer
279
+ ) {
280
+ return "[ReactContext]";
281
+ }
282
+
283
+ return value;
284
+ };
285
+ };
package/index.d.ts CHANGED
@@ -105,18 +105,6 @@ declare type NavBarState = {
105
105
  title: string;
106
106
  };
107
107
 
108
- declare type StorageValuesToAdd = Record<string, NamespaceValues>;
109
-
110
- declare type StorageValuesToRemove = {
111
- string?: string[];
112
- };
113
-
114
- declare type StorageOwnedValues = {
115
- string?: string[];
116
- };
117
-
118
- declare type NamespaceValues = Record<string, string>;
119
-
120
108
  declare type RefreshProps = {
121
109
  forceRefresh?: boolean;
122
110
  };
@@ -1,9 +1,8 @@
1
- import * as R from "ramda";
2
1
  import { ViewStyle } from "react-native";
3
2
 
4
3
  import { useMemo } from "react";
5
- import { getUILanguage } from "../appUtils/localizationsHelper";
6
- import { utilsLogger } from "../logger";
4
+ import { getUILanguage } from "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper";
5
+ import { utilsLogger } from "@applicaster/zapp-react-native-utils/logger";
7
6
 
8
7
  export {
9
8
  getLocale,
@@ -11,7 +10,7 @@ export {
11
10
  getCountryCode,
12
11
  getLocalizations,
13
12
  getUILanguage,
14
- } from "../appUtils/localizationsHelper";
13
+ } from "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper";
15
14
 
16
15
  const RTL_LOCALES = [
17
16
  "ar", // Arabic
@@ -29,14 +28,16 @@ const RTL_LOCALES = [
29
28
  "yi", // Yiddish
30
29
  ];
31
30
 
32
- export function useLocalizedStrings({ localizations }) {
31
+ export function useLocalizedStrings({ localizations = {} }) {
33
32
  const languageCode = getUILanguage();
34
33
 
35
34
  // TODO: probably we can call getLocalizations here from localizationsHelper.js
36
35
  const result = useMemo(
37
36
  () =>
38
37
  localizations?.[languageCode] ||
39
- R.compose(R.head, R.filter(R.is(Object)), R.values)(localizations) ||
38
+ Object.values(localizations).find(
39
+ (value) => typeof value === "object" && value !== null
40
+ ) ||
40
41
  {},
41
42
  [languageCode, localizations]
42
43
  );
@@ -53,13 +54,7 @@ export function getIsRTL(): boolean {
53
54
  return false;
54
55
  }
55
56
 
56
- const [languageCode] = uiLanguage.split("-");
57
-
58
- const lowerCaseLanguageCode = languageCode.toLocaleLowerCase();
59
-
60
- const isRTL = R.contains(lowerCaseLanguageCode, RTL_LOCALES);
61
-
62
- return isRTL;
57
+ return RTL_LOCALES.includes(uiLanguage.split("-")[0].toLocaleLowerCase());
63
58
  }
64
59
 
65
60
  export function useIsRTL(): boolean {
@@ -251,6 +251,19 @@ const generalContent = () => ({
251
251
  key: "screen_title",
252
252
  initial_value: null,
253
253
  },
254
+ {
255
+ type: "text_input",
256
+ label: "Maximum Selection Reached - Alert Description",
257
+ key: "msg_maximum_selection_reached_message",
258
+ initial_value:
259
+ "You’ve reached the maximum number of items you can select.",
260
+ },
261
+ {
262
+ type: "text_input",
263
+ label: "Maximum Selection Reached - Alert Button",
264
+ key: "msg_maximum_selection_reached_message_ok_button",
265
+ initial_value: "Got it",
266
+ },
254
267
  ],
255
268
  },
256
269
  advertising: {
@@ -42,14 +42,6 @@ function getPlayerConfiguration({ platform }) {
42
42
  label_tooltip:
43
43
  "Enable if you want to have adaptive background gradient based on audio background image.",
44
44
  },
45
- {
46
- key: "audio_player_background_image_query",
47
- label: "Audio Player Image Query",
48
- initial_value: "",
49
- type: "text_input",
50
- label_tooltip:
51
- "Set the query params which control the size of the image e.g width, height. This will help to optimize the loading time, when magic background is enabled.",
52
- },
53
45
  {
54
46
  key: "audio_player_background_image_default_color",
55
47
  label: "Audio Player Background Image Default Color",
@@ -2555,6 +2547,12 @@ function getPlayerConfiguration({ platform }) {
2555
2547
  multiple: false,
2556
2548
  label_tooltip: "Choose the default aspect ratio for the artwork",
2557
2549
  },
2550
+ {
2551
+ key: "audio_player_artwork_border_radius",
2552
+ label: "Audio Player Artwork Corner Radius",
2553
+ type: "number_input",
2554
+ initial_value: 16,
2555
+ },
2558
2556
  ]
2559
2557
  )
2560
2558
  );
@@ -8,6 +8,7 @@ const {
8
8
 
9
9
  const { tvActionButtonsContainer } = require("./tvAction/container");
10
10
  const { tvActionButton } = require("./tvAction/button");
11
+ const { compact } = require("./_internals");
11
12
 
12
13
  const { spacingKey, absolutePositionElement } = require("./containers");
13
14
 
@@ -46,4 +47,5 @@ module.exports = {
46
47
  tvProgressBar,
47
48
  secondaryImage,
48
49
  getUpdatedSecondaryImageKeys,
50
+ compact,
49
51
  };
@@ -21,7 +21,30 @@ const ZAPPIFEST_FIELDS = {
21
21
  },
22
22
  };
23
23
 
24
- const TV_PLATFORMS = ["tvOS", "android", "LG", "samsung", "roku", "vizio"];
24
+ const TV_PLATFORMS_FOR_FONTS = [
25
+ "tvOS",
26
+ "android",
27
+ "LG",
28
+ "samsung",
29
+ "roku",
30
+ "vizio",
31
+ ];
32
+
33
+ const MOBILE_PLATFORMS = [
34
+ "ios",
35
+ "ios_for_quickbrick",
36
+ "android",
37
+ "android_for_quickbrick",
38
+ ];
39
+
40
+ const TV_PLATFORMS = [
41
+ "android_tv_for_quickbrick",
42
+ "amazon_fire_tv_for_quickbrick",
43
+ "tvos_for_quickbrick",
44
+ "samsung_tv",
45
+ "lg_tv",
46
+ "vizio",
47
+ ];
25
48
 
26
49
  const FontPropsForTVPlatform = (platform) => ({
27
50
  [`${R.toLower(platform)}FontFamily`]: {
@@ -92,7 +115,7 @@ const TV_FONT_KEY_DATA = {
92
115
  name: "focused font color",
93
116
  type: ZAPPIFEST_FIELDS.color_picker,
94
117
  },
95
- ...R.reduce(addTVFontsForPlatform, {}, TV_PLATFORMS),
118
+ ...R.reduce(addTVFontsForPlatform, {}, TV_PLATFORMS_FOR_FONTS),
96
119
  textAlignment: {
97
120
  name: "text alignment",
98
121
  type: ZAPPIFEST_FIELDS.select,
@@ -2083,4 +2106,6 @@ module.exports = {
2083
2106
  TV_CELL_BADGE_FIELDS,
2084
2107
  progressBarFields,
2085
2108
  secondaryImageFields,
2109
+ TV_PLATFORMS,
2110
+ MOBILE_PLATFORMS,
2086
2111
  };
@@ -0,0 +1,51 @@
1
+ import { modalStore } from "../";
2
+
3
+ describe("Modal State", () => {
4
+ it("should have initial state", () => {
5
+ const state = modalStore.getState();
6
+
7
+ expect(state).toMatchObject({
8
+ modalState: {
9
+ visible: false,
10
+ screen: null,
11
+ options: {},
12
+ props: {},
13
+ },
14
+ });
15
+
16
+ expect(state.openModal).toBeDefined();
17
+ expect(state.dismissModal).toBeDefined();
18
+ });
19
+
20
+ describe("opening and dismissing modal", () => {
21
+ it("should open modal", () => {
22
+ const item = { id: "test", name: "Test Modal" };
23
+ const options = { animated: true, animationType: "slide" };
24
+ const props = { customProp: "value" };
25
+
26
+ modalStore.getState().openModal({ item, options, props });
27
+
28
+ const state = modalStore.getState();
29
+
30
+ expect(state.modalState).toMatchObject({
31
+ visible: true,
32
+ screen: item,
33
+ options,
34
+ props,
35
+ });
36
+ });
37
+
38
+ it("should dismiss modal", () => {
39
+ modalStore.getState().dismissModal();
40
+
41
+ const state = modalStore.getState();
42
+
43
+ expect(state.modalState).toMatchObject({
44
+ visible: false,
45
+ screen: null,
46
+ options: {},
47
+ props: {},
48
+ });
49
+ });
50
+ });
51
+ });
@@ -5,6 +5,7 @@ exports[`getNavigationProps returns the props otherwise 1`] = `
5
5
  "assets": {
6
6
  "appLogo": "appLogo.png",
7
7
  },
8
+ "data": undefined,
8
9
  "home": false,
9
10
  "nav_items": [
10
11
  {
@@ -111,6 +111,7 @@ export function getNavigationProps({
111
111
  assets: ZappNavBarAssets;
112
112
  rules: ZappNavBarRules;
113
113
  nav_items: NavBarItem[];
114
+ data: MenuItemDataProperties;
114
115
  } | null {
115
116
  const { activeRiver } = navigator;
116
117
  const { navigations, id: selected, home } = activeRiver; // use useRiver hook instead
@@ -124,7 +125,7 @@ export function getNavigationProps({
124
125
  return null;
125
126
  }
126
127
 
127
- const { styles, assets, nav_items, rules } = navigation;
128
+ const { styles, assets, nav_items, rules, data } = navigation;
128
129
 
129
130
  return {
130
131
  selected,
@@ -134,6 +135,7 @@ export function getNavigationProps({
134
135
  assets: assets as ZappNavBarAssets,
135
136
  nav_items: nav_items as any as NavBarItem[],
136
137
  rules: rules as any as ZappNavBarRules,
138
+ data: data as MenuItemDataProperties,
137
139
  };
138
140
  }
139
141
 
@@ -1,10 +1,10 @@
1
1
  import { toPositiveNumberWithDefault } from "..";
2
2
 
3
- describe("toNumber", () => {
3
+ describe("toPositiveNumberWithDefault", () => {
4
4
  const DEFAULT = 5;
5
5
 
6
6
  it("return number if input is positive number", () => {
7
- const inputs = [0, 1, 2, 100, 200.12, Infinity];
7
+ const inputs = [1, 2, 100, 200.12, Infinity];
8
8
  expect.assertions(inputs.length);
9
9
 
10
10
  inputs.forEach((input) => {
@@ -14,7 +14,7 @@ describe("toNumber", () => {
14
14
  });
15
15
 
16
16
  it("return number if input is positive number as string", () => {
17
- const inputs = ["0", "1", "2", "100", "200.12"];
17
+ const inputs = ["1", "2", "100", "200.12"];
18
18
  expect.assertions(inputs.length);
19
19
 
20
20
  inputs.forEach((input) => {
@@ -63,4 +63,24 @@ describe("toNumber", () => {
63
63
  expect(output).toBe(DEFAULT);
64
64
  });
65
65
  });
66
+
67
+ it("return default if input is zero number", () => {
68
+ const inputs = [0, -0];
69
+ expect.assertions(inputs.length);
70
+
71
+ inputs.forEach((input) => {
72
+ const output = toPositiveNumberWithDefault(DEFAULT, input);
73
+ expect(output).toBe(DEFAULT);
74
+ });
75
+ });
76
+
77
+ it("return default if input is zero string", () => {
78
+ const inputs = ["0", "-0"];
79
+ expect.assertions(inputs.length);
80
+
81
+ inputs.forEach((input) => {
82
+ const output = toPositiveNumberWithDefault(DEFAULT, input);
83
+ expect(output).toBe(DEFAULT);
84
+ });
85
+ });
66
86
  });
@@ -83,6 +83,10 @@ export const toPositiveNumberWithDefault = (
83
83
  return defaultValue;
84
84
  }
85
85
 
86
+ if (isZero(possibleNumber)) {
87
+ return defaultValue;
88
+ }
89
+
86
90
  return possibleNumber;
87
91
  };
88
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "13.0.0-alpha.6400875052",
3
+ "version": "13.0.0-alpha.6444233049",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "13.0.0-alpha.6400875052",
30
+ "@applicaster/applicaster-types": "13.0.0-alpha.6444233049",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -39,22 +39,6 @@ function getPlayerConfiguration({ platform }) {
39
39
  label_tooltip:
40
40
  "Disable if you don't want the content to have a right orientation",
41
41
  },
42
- {
43
- key: "magic_background",
44
- label: "Enable Magic Background",
45
- initial_value: false,
46
- type: "switch",
47
- label_tooltip:
48
- "Enable if you want to have adaptive background gradient based on audio background image.",
49
- },
50
- {
51
- key: "audio_player_background_image_query",
52
- label: "Audio Player Image Query",
53
- initial_value: "",
54
- type: "text_input",
55
- label_tooltip:
56
- "Set the query params which control the size of the image e.g width, height. This will help to optimize the loading time, when magic background is enabled.",
57
- },
58
42
  {
59
43
  key: "audio_player_background_image_default_color",
60
44
  label: "Audio Player Background Image Default Color",
@@ -2557,6 +2541,12 @@ function getPlayerConfiguration({ platform }) {
2557
2541
  multiple: false,
2558
2542
  label_tooltip: "Choose the default aspect ratio for the artwork",
2559
2543
  },
2544
+ {
2545
+ key: "audio_player_artwork_border_radius",
2546
+ label: "Audio Player Artwork Corner Radius",
2547
+ type: "number_input",
2548
+ initial_value: 16,
2549
+ },
2560
2550
  ]
2561
2551
  )
2562
2552
  );
@@ -1,7 +1,7 @@
1
- import { isNil, complement, compose, map, min, prop, take, uniq } from "ramda";
1
+ import { complement, compose, isNil, map, min, prop, take, uniq } from "ramda";
2
2
  import { useDispatch } from "react-redux";
3
3
  import * as React from "react";
4
- import { useZappPipesFeeds } from "@applicaster/zapp-react-native-redux/hooks/useZappPipesFeeds";
4
+ import { useZappPipesFeeds } from "@applicaster/zapp-react-native-redux/hooks";
5
5
  import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
6
6
  import { isNilOrEmpty } from "../../reactUtils/helpers";
7
7
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
@@ -9,6 +9,7 @@ import {
9
9
  getInflatedDataSourceUrl,
10
10
  getSearchContext,
11
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
+ import { isGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
12
13
  import { useScreenContext } from "../screen/useScreenContext";
13
14
 
14
15
  type Options = {
@@ -46,9 +47,7 @@ const filterEmptyData = (data) => {
46
47
  };
47
48
 
48
49
  const getData = (rawData) =>
49
- rawData.component_type === "gallery-qb"
50
- ? rawData.ui_components[0].data
51
- : rawData.data;
50
+ isGallery(rawData) ? rawData.ui_components[0].data : rawData.data;
52
51
 
53
52
  const extractData = compose(uniq, map(getData));
54
53
 
@@ -70,13 +69,12 @@ export const useBatchLoading = (
70
69
  const [hasEverBeenReady, setHasEverBeenReady] = React.useState(false);
71
70
 
72
71
  // if first component is gallery-qb, take only one component for initial load
73
- const takeSize =
74
- componentsToRender?.[0]?.component_type === "gallery-qb"
75
- ? 1
76
- : min(
77
- options.initialBatchSize ?? DEFAULT_BATCH_SIZE,
78
- componentsToRender.length
79
- );
72
+ const takeSize = isGallery(componentsToRender?.[0])
73
+ ? 1
74
+ : min(
75
+ options.initialBatchSize ?? DEFAULT_BATCH_SIZE,
76
+ componentsToRender.length
77
+ );
80
78
 
81
79
  const takeBatchSize = React.useCallback(take(takeSize), [takeSize]);
82
80
 
@@ -20,6 +20,7 @@ type Props = {
20
20
  silentRefresh?: boolean;
21
21
  method?: "get" | "post";
22
22
  bodyParams?: Record<string, unknown>;
23
+ skipLoading?: boolean;
23
24
  };
24
25
  };
25
26
 
@@ -95,7 +96,7 @@ export const useFeedLoader = ({
95
96
  if (
96
97
  shouldDispatchData(callableFeedUrl, currentFeed, pipesOptions.clearCache)
97
98
  ) {
98
- if (callableFeedUrl) {
99
+ if (callableFeedUrl && !pipesOptions.skipLoading) {
99
100
  dispatch(
100
101
  loadPipesData(callableFeedUrl, {
101
102
  ...pipesOptions,
@@ -103,26 +104,33 @@ export const useFeedLoader = ({
103
104
  riverId,
104
105
  })
105
106
  );
106
- } else {
107
+ } else if (!callableFeedUrl) {
107
108
  logger.info({
108
109
  message:
109
110
  "Feed is not defined or not inflated, skipping loading. \nMake sure you have correct feedUrl and mapping.",
110
111
  jsOnly: true,
111
112
  });
113
+ } else {
114
+ logger.info({
115
+ message:
116
+ "Loading skipped as per pipesOptions.skipLoading configuration.",
117
+ data: { url: callableFeedUrl },
118
+ jsOnly: true,
119
+ });
112
120
  }
113
121
  } else {
114
122
  logger.info({
115
123
  message:
116
- "Feed already exist, skipping loading. \nCall reloadData() if you want to refresh data.",
124
+ "Feed already exists, skipping loading. \nCall reloadData() if you want to refresh data.",
117
125
  data: { url: callableFeedUrl },
118
126
  jsOnly: true,
119
127
  });
120
128
  }
121
129
  }, []);
122
130
 
123
- // Reload feed when feedUrl changes
131
+ // Reload feed when feedUrl changes, unless skipLoading is true
124
132
  useEffect(() => {
125
- if (!isInitialRender && callableFeedUrl) {
133
+ if (!isInitialRender && callableFeedUrl && !pipesOptions.skipLoading) {
126
134
  dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
127
135
  }
128
136
  }, [callableFeedUrl]);
@@ -158,7 +166,6 @@ export const useFeedLoader = ({
158
166
  currentFeed?.data,
159
167
  currentFeed?.error,
160
168
  currentFeed?.loading,
161
-
162
169
  reloadData,
163
170
  loadNext,
164
171
  ]);
@@ -3,7 +3,7 @@ import { platformSelect } from "../../reactUtils";
3
3
  const TAB_BAR_HEIGHT_IOS = 49;
4
4
  const TAB_BAR_HEIGHT_ANDROID = 56;
5
5
 
6
- export const useGetTabBarHeight = () =>
6
+ export const getTabBarHeight = () =>
7
7
  platformSelect({
8
8
  ios: TAB_BAR_HEIGHT_IOS,
9
9
  android: TAB_BAR_HEIGHT_ANDROID,
@@ -1,12 +1,19 @@
1
1
  import { useGetNavBarTopBorderWidth } from "./useGetNavBarTopBorderWidth";
2
- import { useGetTabBarHeight } from "./useGetTabBarHeight";
2
+ import { getTabBarHeight } from "./getTabBarHeight";
3
+ import { useNavigation } from "./useNavigation";
3
4
  import { MenuTypes, useNavigationType } from "./useNavigationType";
5
+ import { useNavigationPluginData } from "./useNavigationPluginData";
4
6
 
5
7
  export const useGetBottomTabBarHeight = (): number => {
8
+ const { activeRiver } = useNavigation();
9
+
10
+ const navigationPluginData = useNavigationPluginData(activeRiver);
11
+ const navigationType = useNavigationType(navigationPluginData);
12
+
6
13
  const topBorderWidth = useGetNavBarTopBorderWidth();
7
- const tabBarHeight = useGetTabBarHeight();
14
+ const tabBarHeight = getTabBarHeight();
8
15
 
9
- const isBottomBarNavigation = useNavigationType() === MenuTypes.bottomTabBar;
16
+ const isBottomBarNavigation = navigationType === MenuTypes.bottomTabBar;
10
17
 
11
18
  return !isBottomBarNavigation ? 0 : tabBarHeight + topBorderWidth;
12
19
  };