@applicaster/zapp-react-native-utils 12.0.0-rc.19 → 12.0.0-rc.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.0-rc.19",
3
+ "version": "12.0.0-rc.20",
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.19",
31
+ "@applicaster/applicaster-types": "12.0.0-rc.20",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { cleanup, renderHook } from "@testing-library/react-hooks";
3
3
  import { CellTapContext } from "@applicaster/zapp-react-native-ui-components/Contexts/CellTapContext";
4
- import { waitFor } from "@testing-library/react-native";
5
4
 
6
5
  const navigator = {
7
6
  getPathname: () => "pathnameMock",
@@ -65,16 +64,12 @@ describe("useCellClick", () => {
65
64
  cleanup();
66
65
  });
67
66
 
68
- it("runs onCellTap", async () => {
67
+ it("runs onCellTap", () => {
69
68
  const { result } = renderHook(() => useCellClick(mockProps), { wrapper });
70
69
  const useCellClickHook = result.current;
71
70
 
72
71
  useCellClickHook();
73
72
 
74
- await waitFor(() => {
75
- expect(onCellTap).toHaveBeenCalled();
76
- });
77
-
78
73
  expect(onCellTap).toHaveBeenCalled();
79
74
  cleanup();
80
75
  });
@@ -53,7 +53,7 @@ export const useCellClick = (props: Props) => {
53
53
  );
54
54
 
55
55
  const onPress = React.useCallback(
56
- async (_item?: ZappEntry | any, _index?: number) => {
56
+ (_item?: ZappEntry | any, _index?: number) => {
57
57
  // Making sure we are not getting GestureResponderEvent in here.
58
58
  const isZappEntry = _item?.id && _item?.type;
59
59
  const selectedItem = isZappEntry ? _item : props.item;
@@ -70,7 +70,7 @@ export const useCellClick = (props: Props) => {
70
70
  logOnPress(selectedItem, pathname, component, onCellTap);
71
71
 
72
72
  if (selectedItem) {
73
- await actionExecutor?.handleEntryActions(selectedItem);
73
+ actionExecutor?.handleEntryActions(selectedItem);
74
74
  }
75
75
 
76
76
  if (selectedItem?.type?.value === "action") {
@@ -79,31 +79,21 @@ export const useCellClick = (props: Props) => {
79
79
  url: selectedItem.link.href,
80
80
  });
81
81
  }
82
-
83
- return;
84
- }
85
-
86
- if (typeof onCellTap === "function") {
87
- onCellTap(selectedItem, _index);
88
-
89
- return;
90
- }
91
-
92
- const targetScreen = component?.data?.target;
93
-
94
- if (!targetScreen) {
95
- return;
96
- }
97
-
98
- const isCellOnCurrentScreen = currentRoute === pathname;
99
-
100
- if (isCellOnCurrentScreen || pathname === "videoModal") {
101
- push(
102
- R.when(
103
- () => targetScreen,
104
- R.mergeLeft({ screen_type: targetScreen }),
105
- )(selectedItem),
106
- );
82
+ } else {
83
+ if (typeof onCellTap === "function") {
84
+ onCellTap(selectedItem, _index);
85
+ } else {
86
+ if (currentRoute === pathname || pathname === "videoModal") {
87
+ const targetScreen = component?.data?.target;
88
+
89
+ push(
90
+ R.when(
91
+ () => targetScreen,
92
+ R.mergeLeft({ screen_type: targetScreen })
93
+ )(selectedItem)
94
+ );
95
+ }
96
+ }
107
97
  }
108
98
  },
109
99
  [