@applicaster/zapp-react-native-utils 12.0.0-rc.29 → 12.0.0-rc.30

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.
@@ -26,7 +26,7 @@ export const useHookAnalytics = (props): void => {
26
26
  if (screenData?.hookPlugin?.module?.runInBackground) {
27
27
  sendScreenEvent({ analyticsScreenData });
28
28
  }
29
- }, [hookPlugin.screen_id]);
29
+ }, [sendScreenEvent, screenData, hookPlugin.screen_id]);
30
30
  };
31
31
 
32
32
  export const useScreenAnalytics = (props) => {
@@ -86,7 +86,7 @@ export const isFocusable = (component: ZappEntry | ZappUIComponent | any) =>
86
86
 
87
87
  type Props = {
88
88
  component: ZappUIComponent;
89
- zappPipesData: ZappPipesData;
89
+ zappPipesData?: ZappPipesData;
90
90
  } & Record<string, any>;
91
91
 
92
92
  export const useIsFocusable = (props: Props): void => {
@@ -64,10 +64,13 @@ export function getIsRTLFromLocalizations(localizations): boolean {
64
64
  return R.contains(localeToUse, RTL_LOCALES);
65
65
  }
66
66
 
67
+ const remoteConfigLocalizationSelector = R.path([
68
+ "remoteConfigurations",
69
+ "localizations",
70
+ ]);
71
+
67
72
  export function useIsRTL(): boolean {
68
- const localizations = useSelector(
69
- R.path(["remoteConfigurations", "localizations"])
70
- );
73
+ const localizations = useSelector(remoteConfigLocalizationSelector);
71
74
 
72
75
  return getIsRTLFromLocalizations(localizations);
73
76
  }
package/logger/index.ts CHANGED
@@ -72,7 +72,7 @@ const { quickBrickLogger, coreLogger, logger, logLevels, utilsLogger } =
72
72
  function useLogger(
73
73
  logger: XRayLoggerI,
74
74
  eventData: UseLoggerHookArgs,
75
- deps = []
75
+ deps: string[] = []
76
76
  ) {
77
77
  const {
78
78
  level = logLevels.verbose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.0-rc.29",
3
+ "version": "12.0.0-rc.30",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.0-rc.29",
31
+ "@applicaster/applicaster-types": "12.0.0-rc.30",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -5,27 +5,34 @@ type Return = (index: number) => void;
5
5
 
6
6
  type Predicate = (
7
7
  entry: ZappUIComponentProps["zappPipesData"]["data"]["entry"],
8
- index: number
8
+ index: number,
9
+ numberOfColumns: number
9
10
  ) => boolean;
10
11
 
11
12
  type Props = {
12
13
  ifNeeded: Predicate;
13
14
  loadNextData: () => void;
14
15
  entry: ZappUIComponentProps["zappPipesData"]["data"]["entry"];
16
+ numberOfColumns?: number;
15
17
  };
16
18
 
17
19
  const handleLoadNextPage =
18
20
  (
19
- ifNeeded: (entry: ZappEntry[], index: number) => boolean,
21
+ ifNeeded: (
22
+ entry: ZappEntry[],
23
+ index: number,
24
+ numberOfColumns?: number
25
+ ) => boolean,
20
26
  loadNextData: () => void,
21
- entry: ZappEntry[]
27
+ entry: ZappEntry[],
28
+ numberOfColumns
22
29
  ) =>
23
30
  (index: number) => {
24
31
  /**
25
32
  * Lazy-Loading, invoke nextLoadData if we reach the end of the List
26
33
  */
27
34
 
28
- if (ifNeeded(entry, index)) {
35
+ if (ifNeeded(entry, index, numberOfColumns)) {
29
36
  loadNextData();
30
37
  }
31
38
  };
@@ -34,10 +41,10 @@ export const useLoadNextPageIfNeeded = ({
34
41
  ifNeeded,
35
42
  loadNextData = noop,
36
43
  entry,
44
+ numberOfColumns = 0,
37
45
  }: Props): Return => {
38
- return React.useCallback(handleLoadNextPage(ifNeeded, loadNextData, entry), [
39
- ifNeeded,
40
- loadNextData,
41
- entry,
42
- ]);
46
+ return React.useCallback(
47
+ handleLoadNextPage(ifNeeded, loadNextData, entry, numberOfColumns),
48
+ [ifNeeded, loadNextData, entry, numberOfColumns]
49
+ );
43
50
  };
@@ -1,7 +1,9 @@
1
1
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
2
 
3
+ const riversSelector = ["rivers"];
4
+
3
5
  export const useRivers = () => {
4
- const { rivers } = usePickFromState(["rivers"]);
6
+ const { rivers } = usePickFromState(riversSelector as any);
5
7
 
6
8
  return rivers;
7
9
  };
@@ -1,8 +1,7 @@
1
- import {
2
- useContentTypes,
3
- usePickFromState,
4
- } from "@applicaster/zapp-react-native-redux/hooks";
1
+ import React from "react";
2
+ import { useContentTypes } from "@applicaster/zapp-react-native-redux/hooks";
5
3
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
4
+ import { useRivers } from "../../state";
6
5
 
7
6
  export const useVideoModalScreenData = ():
8
7
  | (ZappEntry & { targetScreen: any }) // TODO: fix ZappEntry type ( was ZappRiver but conflict )
@@ -12,11 +11,13 @@ export const useVideoModalScreenData = ():
12
11
  } = useNavigation();
13
12
 
14
13
  const contentTypes = useContentTypes();
15
- const { rivers } = usePickFromState(["rivers"]);
14
+ const rivers = useRivers();
16
15
 
17
- if (item?.type?.value) {
18
- const screenId = contentTypes[item?.type?.value].screen_id;
16
+ return React.useMemo(() => {
17
+ if (item?.type?.value) {
18
+ const screenId = contentTypes[item?.type?.value].screen_id;
19
19
 
20
- return { ...item, targetScreen: rivers?.[screenId] };
21
- }
20
+ return { ...item, targetScreen: rivers?.[screenId] };
21
+ }
22
+ }, [item]);
22
23
  };
@@ -3,7 +3,7 @@ import { NativeModules, StyleSheet, View } from "react-native";
3
3
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
4
4
 
5
5
  import { isApplePlatform, isWeb } from "../reactUtils";
6
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
+ import { useRivers } from "../reactHooks/state";
7
7
 
8
8
  const layoutReducer = (state, { payload }) => {
9
9
  return state.map((item, index, _state) => ({
@@ -58,7 +58,7 @@ export const ScreenLoadingMeasurements = ({
58
58
  numberOfComponents,
59
59
  riverId,
60
60
  }: Props) => {
61
- const { rivers } = usePickFromState(["rivers"]);
61
+ const rivers = useRivers();
62
62
  const screenData = rivers?.[riverId];
63
63
 
64
64
  const [itemsLayout, dispatchItemLayout] = React.useReducer(