@applicaster/zapp-react-native-utils 14.0.38-alpha.2343523156 → 14.0.38

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.
@@ -73,17 +73,14 @@ type Props = {
73
73
  children: React.ReactNode;
74
74
  };
75
75
 
76
- function findParentComponent(
77
- childId: string,
78
- parent: ZappRiver | ZappUIComponent
79
- ): ZappRiver | ZappUIComponent | null {
80
- for (const child of parent.ui_components) {
81
- if (child.id === childId) return parent;
82
-
83
- if (child.ui_components) {
84
- const found = findParentComponent(childId, child);
85
- if (found) return found;
86
- }
76
+ /** Prefer component data.source, otherwise direct UIComponentContext parent. */
77
+ function getComponentFeedData(component) {
78
+ if (component?.data?.source) {
79
+ return component.data;
80
+ }
81
+
82
+ if (component?.parent?.data?.source) {
83
+ return component.parent.data;
87
84
  }
88
85
 
89
86
  return null;
@@ -111,16 +108,7 @@ const prepareDefaultActions = (actionExecutor) => {
111
108
  async (_action, context) => {
112
109
  const dispatch = appStore.getDispatch();
113
110
 
114
- const parentComponent = findParentComponent(
115
- context?.component?.id,
116
- context?.screenData
117
- );
118
-
119
- const componentSource = context?.component?.data?.source;
120
-
121
- const componentData = componentSource
122
- ? context.component.data
123
- : parentComponent?.data;
111
+ const componentData = getComponentFeedData(context?.component);
124
112
 
125
113
  const source = componentData?.source;
126
114
  const mapping = componentData?.mapping;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.38-alpha.2343523156",
3
+ "version": "14.0.38",
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": "14.0.38-alpha.2343523156",
30
+ "@applicaster/applicaster-types": "14.0.38",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -4,6 +4,7 @@ import * as React from "react";
4
4
  import * as R from "ramda";
5
5
  import { handleActionSchemeUrl } from "@applicaster/quick-brick-core/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useUrlSchemeHandler";
6
6
  import { CellTapContext } from "@applicaster/zapp-react-native-ui-components/Contexts/CellTapContext";
7
+ import { useUIComponentContext } from "@applicaster/zapp-react-native-ui-components/Contexts/UIComponentContext";
7
8
  import {
8
9
  useNavigation,
9
10
  useProfilerLogging,
@@ -28,7 +29,6 @@ import { useScreenStateStore } from "../navigation/useScreenStateStore";
28
29
  type Props = {
29
30
  item?: ZappEntry;
30
31
  index?: number;
31
- component?: ZappUIComponent;
32
32
  zappPipesData?: ZappPipesData;
33
33
  };
34
34
 
@@ -37,16 +37,16 @@ type onPressReturnFn =
37
37
  | (() => void);
38
38
 
39
39
  export const useCellClick = ({
40
- component,
41
40
  zappPipesData,
42
41
  item,
43
- }: Props): onPressReturnFn => {
42
+ }: Props = {}): onPressReturnFn => {
44
43
  const { push, currentRoute } = useNavigation();
45
44
  const { pathname } = useRoute();
46
45
  const screenStateStore = useScreenStateStore();
47
46
 
48
47
  const onCellTap: Option<Function> = React.useContext(CellTapContext);
49
48
  const actionExecutor = React.useContext(ActionExecutorContext);
49
+ const component = useUIComponentContext();
50
50
  const screenData = useCurrentScreenData();
51
51
  const screenState = useScreenContext()?.options;
52
52