@applicaster/zapp-react-native-utils 13.0.0-rc.85 → 13.0.0-rc.87

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.
@@ -58,6 +58,22 @@ type Props = {
58
58
  children: React.ReactNode;
59
59
  };
60
60
 
61
+ function findParentComponent(
62
+ childId: string,
63
+ parent: ZappRiver | ZappUIComponent
64
+ ): ZappRiver | ZappUIComponent | null {
65
+ for (const child of parent.ui_components) {
66
+ if (child.id === childId) return parent;
67
+
68
+ if (child.ui_components) {
69
+ const found = findParentComponent(childId, child);
70
+ if (found) return found;
71
+ }
72
+ }
73
+
74
+ return null;
75
+ }
76
+
61
77
  const prepareDefaultActions = (actionExecutor) => {
62
78
  actionExecutor.registerAction("localStorageSet", async (action) => {
63
79
  const namespaces = action.options.content;
@@ -72,11 +88,13 @@ const prepareDefaultActions = (actionExecutor) => {
72
88
  async (_action, context) => {
73
89
  const dispatch = appStore.getDispatch();
74
90
 
75
- log_info("handleAction: refreshComponent event");
91
+ const dataSource =
92
+ context?.component?.data?.source ||
93
+ findParentComponent(context?.component.id, context?.screenData)?.data
94
+ ?.source;
76
95
 
77
- const dataSource = context?.component?.data?.source;
96
+ log_info(`handleAction: refreshComponent for dataSource:${dataSource}`);
78
97
 
79
- // TODO: Later we can pass component ids to do refresh instead of current one
80
98
  // TODO: In theory we should wait callback to complete, before completing the action, but now it's not needed
81
99
  // TODO: handle focused item removal
82
100
  dispatch(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "13.0.0-rc.85",
3
+ "version": "13.0.0-rc.87",
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-rc.85",
30
+ "@applicaster/applicaster-types": "13.0.0-rc.87",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",