@applicaster/zapp-react-native-ui-components 13.0.0-rc.74 → 13.0.0-rc.76

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.
@@ -40,7 +40,7 @@ export function CellWithFocusable(props: Props) {
40
40
  const [isFocused, setIsFocused] = React.useState(false);
41
41
 
42
42
  const state = useCellState({
43
- id: item.id,
43
+ item,
44
44
  behavior,
45
45
  focused: isFocused || toBooleanWithDefaultFalse(focused),
46
46
  });
@@ -23,7 +23,7 @@ export function FocusableCell(props: Props) {
23
23
  behavior,
24
24
  } = props;
25
25
 
26
- const state = useCellState({ id: item.id, behavior, focused });
26
+ const state = useCellState({ item, behavior, focused });
27
27
 
28
28
  React.useEffect(() => {
29
29
  if (focused && scrollTo && !isAndroid) {
@@ -6,6 +6,7 @@ import React, { useEffect } from "react";
6
6
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
7
7
  import { BehaviorSubject } from "rxjs";
8
8
  import { masterCellLogger } from "../logger";
9
+ import get from "lodash/get";
9
10
 
10
11
  const parseContextKey = (key: string): string | null => {
11
12
  if (!key?.startsWith("@{ctx/")) return null;
@@ -72,11 +73,13 @@ export const useBehaviorUpdate = (behavior: Behavior) => {
72
73
  // We cant use async in this function (its inside render),
73
74
  // so we rely on useBehaviorUpdate to update current value and trigger re-render
74
75
  export const isCellSelected = (
75
- id: string | number,
76
+ item: ZappEntry,
76
77
  behavior?: Behavior
77
78
  ): boolean => {
78
79
  if (!behavior) return false;
79
80
 
81
+ const id = behavior.selector ? get(item, behavior.selector) : item.id;
82
+
80
83
  if (behavior.selection_source === "now_playing") {
81
84
  const player = playerManager.getActivePlayer();
82
85
 
@@ -190,24 +190,24 @@ export const getFocusedButtonId = (focusable) => {
190
190
  });
191
191
  };
192
192
 
193
- export const isSelected = (id: string | number, behavior?: Behavior) => {
194
- return isCellSelected(id, behavior);
193
+ export const isSelected = (item: ZappEntry, behavior?: Behavior) => {
194
+ return isCellSelected(item, behavior);
195
195
  };
196
196
 
197
197
  export const useCellState = ({
198
- id,
198
+ item,
199
199
  behavior,
200
200
  focused,
201
201
  }: {
202
- id: string | number;
202
+ item: ZappEntry;
203
203
  behavior: Behavior;
204
204
  focused: boolean;
205
205
  }): CellState => {
206
206
  const lastUpdate = useBehaviorUpdate(behavior);
207
207
 
208
208
  const _isSelected = useMemo(
209
- () => isSelected(id, behavior),
210
- [behavior, id, lastUpdate]
209
+ () => isSelected(item, behavior),
210
+ [behavior, item, lastUpdate]
211
211
  );
212
212
 
213
213
  return getCellState({ focused, selected: _isSelected });
@@ -230,7 +230,8 @@ export function zappPipesDataConnector(
230
230
  const entryContext =
231
231
  (shouldUseNestedContext && screenContextData?.nested?.entry
232
232
  ? screenContextData?.nested?.entry
233
- : screenContextData?.entry) || {};
233
+ : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
234
+ {};
234
235
 
235
236
  const screenContext =
236
237
  (shouldUseNestedContext && screenContextData?.nested?.screen
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-rc.74",
3
+ "version": "13.0.0-rc.76",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -32,10 +32,10 @@
32
32
  "redux-mock-store": "^1.5.3"
33
33
  },
34
34
  "dependencies": {
35
- "@applicaster/applicaster-types": "13.0.0-rc.74",
36
- "@applicaster/zapp-react-native-bridge": "13.0.0-rc.74",
37
- "@applicaster/zapp-react-native-redux": "13.0.0-rc.74",
38
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.74",
35
+ "@applicaster/applicaster-types": "13.0.0-rc.76",
36
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.76",
37
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.76",
38
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.76",
39
39
  "promise": "^8.3.0",
40
40
  "react-router-native": "^5.1.2",
41
41
  "url": "^0.11.0",