@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1839726411 → 13.0.0-alpha.1909212433

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.
@@ -45,6 +45,21 @@ export type Props = ScrollViewProps & {
45
45
  type State = boolean[];
46
46
  type Action = { index?: number; isFocusable: boolean; type?: string };
47
47
 
48
+ const unwrapArray = (maybeArray) =>
49
+ Array.isArray(maybeArray) ? maybeArray[0] : maybeArray;
50
+
51
+ function getEntry<T>(data: T | T[], index: unknown): T {
52
+ let entry;
53
+
54
+ if (R.isNil(index)) {
55
+ entry = unwrapArray(data);
56
+ } else if (typeof index === "number") {
57
+ entry = unwrapArray(data[index]);
58
+ }
59
+
60
+ return entry;
61
+ }
62
+
48
63
  const focusableStateReducer = (
49
64
  state: State,
50
65
  { index = null, isFocusable, type = null }: Action
@@ -132,13 +147,10 @@ function FocusableScrollViewComponent(props: Props, ref) {
132
147
 
133
148
  const getFocusableEntryId = React.useCallback(
134
149
  (_entry: ZappEntry | null, index?: number) => {
135
- const entry = R.isNil(index)
136
- ? Array.isArray(_entry)
137
- ? _entry[0]
138
- : _entry
139
- : Array.isArray(data[index])
140
- ? data[index][0]
141
- : data[index];
150
+ const entry: { id?: string } = getEntry(
151
+ R.isNil(index) ? _entry : data,
152
+ index
153
+ );
142
154
 
143
155
  return entry ? `${props.id}--${entry?.id}` : undefined;
144
156
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.1839726411",
3
+ "version": "13.0.0-alpha.1909212433",
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",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "13.0.0-alpha.1839726411",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1839726411",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1839726411",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1839726411",
37
+ "@applicaster/applicaster-types": "13.0.0-alpha.1909212433",
38
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1909212433",
39
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1909212433",
40
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1909212433",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",