@applicaster/zapp-react-native-utils 12.0.0-rc.21 → 12.0.0-rc.23
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.
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
2
2
|
import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
3
3
|
import { Player } from "./player";
|
|
4
|
+
import { PlayerRole } from "./conts";
|
|
4
5
|
|
|
5
6
|
type PlayerFactoryItem = {
|
|
6
7
|
Component: any;
|
|
7
8
|
controller: Player;
|
|
8
9
|
};
|
|
9
10
|
|
|
11
|
+
type PlayerFactoryProps = {
|
|
12
|
+
player: any,
|
|
13
|
+
playerId: string,
|
|
14
|
+
autoplay: boolean,
|
|
15
|
+
entry: ZappEntry,
|
|
16
|
+
muted: boolean,
|
|
17
|
+
playerPluginId: string,
|
|
18
|
+
screenConfig: Record<string, any>,
|
|
19
|
+
playerRole: PlayerRole,
|
|
20
|
+
}
|
|
21
|
+
|
|
10
22
|
interface PlayerConstructor {
|
|
11
23
|
new (params: any): Player;
|
|
12
24
|
}
|
|
13
25
|
|
|
14
|
-
export const playerFactory = (config:
|
|
26
|
+
export const playerFactory = (config: PlayerFactoryProps): PlayerFactoryItem | null => {
|
|
15
27
|
const IDENTIFIER = config?.playerPluginId;
|
|
16
28
|
|
|
17
29
|
if (!IDENTIFIER) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.23",
|
|
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.
|
|
31
|
+
"@applicaster/applicaster-types": "12.0.0-rc.23",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
|
|
5
6
|
const navigator = {
|
|
6
7
|
getPathname: () => "pathnameMock",
|
|
@@ -64,13 +65,16 @@ describe("useCellClick", () => {
|
|
|
64
65
|
cleanup();
|
|
65
66
|
});
|
|
66
67
|
|
|
67
|
-
it("runs onCellTap", () => {
|
|
68
|
+
it("runs onCellTap", async () => {
|
|
68
69
|
const { result } = renderHook(() => useCellClick(mockProps), { wrapper });
|
|
69
70
|
const useCellClickHook = result.current;
|
|
70
71
|
|
|
71
72
|
useCellClickHook();
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
await waitFor(() => {
|
|
75
|
+
expect(onCellTap).toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
|
|
74
78
|
cleanup();
|
|
75
79
|
});
|
|
76
80
|
});
|
|
@@ -53,7 +53,7 @@ export const useCellClick = (props: Props) => {
|
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
const onPress = React.useCallback(
|
|
56
|
-
(_item?: ZappEntry | any, _index?: number) => {
|
|
56
|
+
async (_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
|
-
actionExecutor?.handleEntryActions(selectedItem);
|
|
73
|
+
await actionExecutor?.handleEntryActions(selectedItem);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (selectedItem?.type?.value === "action") {
|