@impulse-ui-native/flat-list 9.1.2 → 11.0.0

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.
@@ -2,8 +2,8 @@ import 'react-native';
2
2
  import { UseFlatListInitialScrollOptions } from '../types/flat-list.types.mjs';
3
3
 
4
4
  declare function useFlatListInitialScroll<Item>(options: UseFlatListInitialScrollOptions): {
5
- initialScrollIndex: number | null | undefined;
6
- getItemLayout: (data: ArrayLike<Item> | null | undefined, index: number) => {
5
+ initialScrollIndex: number | undefined;
6
+ getItemLayout: (data: Readonly<ArrayLike<Item>> | undefined, index: number) => {
7
7
  length: number;
8
8
  offset: number;
9
9
  index: number;
@@ -14,7 +14,7 @@ function useFlatListInitialScroll(options) {
14
14
  }),
15
15
  [itemSize, separatorSize, headerSize]
16
16
  );
17
- return { initialScrollIndex, getItemLayout };
17
+ return { initialScrollIndex: initialScrollIndex ?? void 0, getItemLayout };
18
18
  }
19
19
  export {
20
20
  useFlatListInitialScroll
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-flat-list-initial-scroll.hook.ts"],"sourcesContent":["import type { FlatListProps } from \"react-native\";\nimport { useCallback } from \"react\";\n\nimport type { UseFlatListInitialScrollOptions } from \"../types\";\n\nexport function useFlatListInitialScroll<Item>(\n options: UseFlatListInitialScrollOptions,\n) {\n const {\n itemSize,\n initialScrollIndex,\n separatorSize = 0,\n headerSize = 0,\n } = options;\n\n const getItemLayout = useCallback<\n NonNullable<FlatListProps<Item>[\"getItemLayout\"]>\n >(\n (_, index) => ({\n length: itemSize,\n offset: headerSize + (itemSize + separatorSize) * index,\n index,\n }),\n [itemSize, separatorSize, headerSize],\n );\n\n return { initialScrollIndex, getItemLayout };\n}\n"],"mappings":"AACA,SAAS,mBAAmB;AAIrB,SAAS,yBACd,SACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,aAAa;AAAA,EACf,IAAI;AAEJ,QAAM,gBAAgB;AAAA,IAGpB,CAAC,GAAG,WAAW;AAAA,MACb,QAAQ;AAAA,MACR,QAAQ,cAAc,WAAW,iBAAiB;AAAA,MAClD;AAAA,IACF;AAAA,IACA,CAAC,UAAU,eAAe,UAAU;AAAA,EACtC;AAEA,SAAO,EAAE,oBAAoB,cAAc;AAC7C;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-flat-list-initial-scroll.hook.ts"],"sourcesContent":["import type { FlatListProps } from \"react-native\";\nimport { useCallback } from \"react\";\n\nimport type { UseFlatListInitialScrollOptions } from \"../types\";\n\nexport function useFlatListInitialScroll<Item>(\n options: UseFlatListInitialScrollOptions,\n) {\n const {\n itemSize,\n initialScrollIndex,\n separatorSize = 0,\n headerSize = 0,\n } = options;\n\n const getItemLayout = useCallback<\n NonNullable<FlatListProps<Item>[\"getItemLayout\"]>\n >(\n (_, index) => ({\n length: itemSize,\n offset: headerSize + (itemSize + separatorSize) * index,\n index,\n }),\n [itemSize, separatorSize, headerSize],\n );\n\n return { initialScrollIndex: initialScrollIndex ?? undefined, getItemLayout };\n}\n"],"mappings":"AACA,SAAS,mBAAmB;AAIrB,SAAS,yBACd,SACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,aAAa;AAAA,EACf,IAAI;AAEJ,QAAM,gBAAgB;AAAA,IAGpB,CAAC,GAAG,WAAW;AAAA,MACb,QAAQ;AAAA,MACR,QAAQ,cAAc,WAAW,iBAAiB;AAAA,MAClD;AAAA,IACF;AAAA,IACA,CAAC,UAAU,eAAe,UAAU;AAAA,EACtC;AAEA,SAAO,EAAE,oBAAoB,sBAAsB,QAAW,cAAc;AAC9E;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/flat-list",
3
- "version": "9.1.2",
3
+ "version": "11.0.0",
4
4
  "description": "Native FlatList and a small hook for initial positioning with known row sizes.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -27,15 +27,15 @@
27
27
  ],
28
28
  "sideEffects": false,
29
29
  "devDependencies": {
30
- "@types/react": "~19.2.14",
31
- "eslint": "^9.38.0",
32
- "prettier": "^3.6.2",
33
- "react": "19.2.3",
34
- "react-native": "0.86.2",
35
- "typescript": "~6.0.3",
36
30
  "@impulse-ui-native/eslint-config": "1.0.0",
37
31
  "@impulse-ui-native/prettier-config": "1.0.0",
38
- "@impulse-ui-native/tsconfig": "1.0.0"
32
+ "@impulse-ui-native/tsconfig": "1.0.0",
33
+ "@types/react": "~19.3.0",
34
+ "eslint": "^9.38.0",
35
+ "prettier": "^3.6.2",
36
+ "react": "19.3.0",
37
+ "react-native": "0.88.0",
38
+ "typescript": "~6.0.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18",