@applicaster/zapp-react-native-utils 12.0.17-rc.1 → 12.0.18-rc.0

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