@applicaster/zapp-react-native-utils 16.0.0-rc.132 → 16.0.0-rc.134

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.
@@ -451,13 +451,17 @@ class FocusManager {
451
451
  }
452
452
 
453
453
  private hasFocus = (node) => {
454
- if (node.children?.length > 0) {
455
- return node.children.some((item) => this.hasFocus(item));
456
- } else if (this.isFocused(node?.component?.current?.props.id)) {
454
+ const propsId = node?.component?.current?.props?.id;
455
+
456
+ // A focused cell keeps its buttons as children. Count that cell, not only leaves.
457
+ if (
458
+ this.isFocused(propsId) ||
459
+ (node?.id !== propsId && this.isFocused(node?.id))
460
+ ) {
457
461
  return true;
458
462
  }
459
463
 
460
- return false;
464
+ return node.children?.some((child) => this.hasFocus(child)) ?? false;
461
465
  };
462
466
 
463
467
  isAnyDescendantFocused(id: string) {
@@ -123,11 +123,11 @@ describe("FocusManager", () => {
123
123
  /* check state of focus */
124
124
  expect(focusManager.isAnyDescendantFocused("group")).toBe(false);
125
125
 
126
- /* set focus on 2nd child */
126
+ /* set focus on 2nd child, which itself has children */
127
127
  focusManager.setFocus(child2.current.props.id);
128
128
 
129
- /* check state of focus */
130
- expect(focusManager.isAnyDescendantFocused("group")).toBe(false);
129
+ /* the focused node is the child, not one of its leaves */
130
+ expect(focusManager.isAnyDescendantFocused("group")).toBe(true);
131
131
  });
132
132
 
133
133
  it("focusManager isFocusableChildOf should be defined", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.132",
3
+ "version": "16.0.0-rc.134",
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": "16.0.0-rc.132",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.134",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",