@shopify/flash-list 1.1.0 → 1.2.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutShadow.kt +5 -0
  3. package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt +78 -7
  4. package/dist/FlashList.d.ts +2 -1
  5. package/dist/FlashList.d.ts.map +1 -1
  6. package/dist/FlashList.js +38 -17
  7. package/dist/FlashList.js.map +1 -1
  8. package/dist/__tests__/FlashList.test.js +62 -2
  9. package/dist/__tests__/FlashList.test.js.map +1 -1
  10. package/dist/__tests__/PlatformHelper.web.test.js +9 -1
  11. package/dist/__tests__/PlatformHelper.web.test.js.map +1 -1
  12. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +4 -0
  13. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +1 -0
  14. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +6 -0
  15. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +1 -0
  16. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +2 -1
  17. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -1
  18. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +4 -0
  19. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +1 -0
  20. package/dist/native/auto-layout/{AutoLayoutViewNativeComponent.web.js → AutoLayoutViewNativeComponent.ios.js} +2 -2
  21. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +1 -0
  22. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +1 -1
  23. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +1 -1
  24. package/dist/native/cell-container/CellContainer.android.d.ts +6 -0
  25. package/dist/native/cell-container/CellContainer.android.d.ts.map +1 -0
  26. package/dist/native/cell-container/CellContainer.android.js +9 -0
  27. package/dist/native/cell-container/CellContainer.android.js.map +1 -0
  28. package/dist/native/cell-container/CellContainer.d.ts +6 -4
  29. package/dist/native/cell-container/CellContainer.d.ts.map +1 -1
  30. package/dist/native/cell-container/CellContainer.ios.d.ts +6 -0
  31. package/dist/native/cell-container/CellContainer.ios.d.ts.map +1 -0
  32. package/dist/native/cell-container/CellContainer.ios.js +9 -0
  33. package/dist/native/cell-container/CellContainer.ios.js.map +1 -0
  34. package/dist/native/cell-container/CellContainer.js +6 -4
  35. package/dist/native/cell-container/CellContainer.js.map +1 -1
  36. package/dist/native/config/PlatformHelper.android.d.ts +16 -0
  37. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -0
  38. package/dist/native/config/PlatformHelper.android.js +20 -0
  39. package/dist/native/config/PlatformHelper.android.js.map +1 -0
  40. package/dist/{utils → native/config}/PlatformHelper.d.ts +3 -1
  41. package/dist/native/config/PlatformHelper.d.ts.map +1 -0
  42. package/dist/{utils/PlatformHelper.web.d.ts → native/config/PlatformHelper.ios.d.ts} +4 -2
  43. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -0
  44. package/dist/{utils/PlatformHelper.js → native/config/PlatformHelper.ios.js} +6 -2
  45. package/dist/native/config/PlatformHelper.ios.js.map +1 -0
  46. package/dist/native/config/PlatformHelper.js +21 -0
  47. package/dist/native/config/PlatformHelper.js.map +1 -0
  48. package/dist/native/config/PlatformHelper.web.d.ts +17 -0
  49. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -0
  50. package/dist/{utils → native/config}/PlatformHelper.web.js +7 -2
  51. package/dist/native/config/PlatformHelper.web.js.map +1 -0
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/ios/Sources/AutoLayoutView.swift +61 -8
  54. package/package.json +2 -2
  55. package/src/FlashList.tsx +53 -14
  56. package/src/__tests__/FlashList.test.tsx +65 -2
  57. package/src/__tests__/PlatformHelper.web.test.ts +17 -1
  58. package/src/native/auto-layout/{AutoLayoutViewNativeComponent.web.ts → AutoLayoutViewNativeComponent.android.ts} +2 -3
  59. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +7 -0
  60. package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +2 -2
  61. package/src/native/cell-container/{CellContainer.ts → CellContainer.android.ts} +0 -0
  62. package/src/native/cell-container/CellContainer.ios.ts +7 -0
  63. package/src/native/cell-container/CellContainer.tsx +14 -0
  64. package/src/{utils/PlatformHelper.ts → native/config/PlatformHelper.android.ts} +12 -2
  65. package/src/native/config/PlatformHelper.ios.ts +26 -0
  66. package/src/native/config/PlatformHelper.ts +27 -0
  67. package/src/{utils → native/config}/PlatformHelper.web.ts +15 -3
  68. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.web.d.ts +0 -5
  69. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.web.d.ts.map +0 -1
  70. package/dist/native/auto-layout/AutoLayoutViewNativeComponent.web.js.map +0 -1
  71. package/dist/utils/PlatformHelper.d.ts.map +0 -1
  72. package/dist/utils/PlatformHelper.js.map +0 -1
  73. package/dist/utils/PlatformHelper.web.d.ts.map +0 -1
  74. package/dist/utils/PlatformHelper.web.js.map +0 -1
@@ -1,8 +1,7 @@
1
- import React from "react";
2
- import { View } from "react-native";
1
+ import { requireNativeComponent } from "react-native";
3
2
 
4
3
  import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
5
4
 
6
5
  const AutoLayoutViewNativeComponent =
7
- View as any as React.Component<AutoLayoutViewNativeComponentProps>;
6
+ requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
8
7
  export default AutoLayoutViewNativeComponent;
@@ -0,0 +1,7 @@
1
+ import { requireNativeComponent } from "react-native";
2
+
3
+ import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
4
+
5
+ const AutoLayoutViewNativeComponent =
6
+ requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
7
+ export default AutoLayoutViewNativeComponent;
@@ -1,7 +1,7 @@
1
- import { requireNativeComponent } from "react-native";
1
+ import { HostComponent, View } from "react-native";
2
2
 
3
3
  import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
4
4
 
5
5
  const AutoLayoutViewNativeComponent =
6
- requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
6
+ View as any as HostComponent<AutoLayoutViewNativeComponentProps>;
7
7
  export default AutoLayoutViewNativeComponent;
@@ -0,0 +1,7 @@
1
+ import { requireNativeComponent } from "react-native";
2
+
3
+ /**
4
+ * Behaves as a regular `View` with an extra `index` prop that is saved in the native layer.
5
+ */
6
+ const CellContainer = requireNativeComponent("CellContainer");
7
+ export default CellContainer;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { View, ViewProps } from "react-native";
3
+
4
+ export interface CellContainerProps extends ViewProps {
5
+ index: number;
6
+ }
7
+
8
+ const CellContainer = React.forwardRef(
9
+ (props: CellContainerProps, ref: any) => {
10
+ return <View ref={ref} {...props} />;
11
+ }
12
+ );
13
+ CellContainer.displayName = "CellContainer";
14
+ export default CellContainer;
@@ -5,7 +5,7 @@ const PlatformConfig = {
5
5
  };
6
6
  const getCellContainerPlatformStyles = (
7
7
  inverted: boolean,
8
- parentProps: { x: number; y: number }
8
+ parentProps: { x: number; y: number; isHorizontal?: boolean }
9
9
  ): { transform: string; WebkitTransform: string } | undefined => {
10
10
  return undefined;
11
11
  };
@@ -13,4 +13,14 @@ const getCellContainerPlatformStyles = (
13
13
  const getItemAnimator = (): BaseItemAnimator | undefined => {
14
14
  return undefined;
15
15
  };
16
- export { PlatformConfig, getCellContainerPlatformStyles, getItemAnimator };
16
+
17
+ const getFooterContainer = (): React.ComponentClass | undefined => {
18
+ return undefined;
19
+ };
20
+
21
+ export {
22
+ PlatformConfig,
23
+ getCellContainerPlatformStyles,
24
+ getItemAnimator,
25
+ getFooterContainer,
26
+ };
@@ -0,0 +1,26 @@
1
+ import { BaseItemAnimator } from "recyclerlistview";
2
+
3
+ const PlatformConfig = {
4
+ defaultDrawDistance: 250,
5
+ };
6
+ const getCellContainerPlatformStyles = (
7
+ inverted: boolean,
8
+ parentProps: { x: number; y: number; isHorizontal?: boolean }
9
+ ): { transform: string; WebkitTransform: string } | undefined => {
10
+ return undefined;
11
+ };
12
+
13
+ const getItemAnimator = (): BaseItemAnimator | undefined => {
14
+ return undefined;
15
+ };
16
+
17
+ const getFooterContainer = (): React.ComponentClass | undefined => {
18
+ return undefined;
19
+ };
20
+
21
+ export {
22
+ PlatformConfig,
23
+ getCellContainerPlatformStyles,
24
+ getItemAnimator,
25
+ getFooterContainer,
26
+ };
@@ -0,0 +1,27 @@
1
+ import { BaseItemAnimator } from "recyclerlistview";
2
+ import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platform/reactnative/itemanimators/defaultjsanimator/DefaultJSItemAnimator";
3
+
4
+ const PlatformConfig = {
5
+ defaultDrawDistance: 250,
6
+ };
7
+ const getCellContainerPlatformStyles = (
8
+ inverted: boolean,
9
+ parentProps: { x: number; y: number; isHorizontal?: boolean }
10
+ ): { transform: string; WebkitTransform: string } | undefined => {
11
+ return undefined;
12
+ };
13
+
14
+ const getItemAnimator = (): BaseItemAnimator | undefined => {
15
+ return new DefaultJSItemAnimator();
16
+ };
17
+
18
+ const getFooterContainer = (): React.ComponentClass | undefined => {
19
+ return undefined;
20
+ };
21
+
22
+ export {
23
+ PlatformConfig,
24
+ getCellContainerPlatformStyles,
25
+ getItemAnimator,
26
+ getFooterContainer,
27
+ };
@@ -1,3 +1,5 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
1
3
  import { BaseItemAnimator } from "recyclerlistview";
2
4
  import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platform/reactnative/itemanimators/defaultjsanimator/DefaultJSItemAnimator";
3
5
 
@@ -6,10 +8,10 @@ const PlatformConfig = {
6
8
  };
7
9
  const getCellContainerPlatformStyles = (
8
10
  inverted: boolean,
9
- parentProps: { x: number; y: number }
11
+ parentProps: { x: number; y: number; isHorizontal?: boolean }
10
12
  ): { transform: string; WebkitTransform: string } | undefined => {
11
13
  const transformValue = `translate(${parentProps.x}px,${parentProps.y}px)${
12
- inverted ? ` scaleY(-1)` : ``
14
+ inverted ? ` ${parentProps.isHorizontal ? `scaleX` : `scaleY`}(-1)` : ``
13
15
  }`;
14
16
  return { transform: transformValue, WebkitTransform: transformValue };
15
17
  };
@@ -17,4 +19,14 @@ const getCellContainerPlatformStyles = (
17
19
  const getItemAnimator = (): BaseItemAnimator | undefined => {
18
20
  return new DefaultJSItemAnimator();
19
21
  };
20
- export { PlatformConfig, getCellContainerPlatformStyles, getItemAnimator };
22
+
23
+ const getFooterContainer = (): React.ComponentClass | undefined => {
24
+ return View;
25
+ };
26
+
27
+ export {
28
+ PlatformConfig,
29
+ getCellContainerPlatformStyles,
30
+ getItemAnimator,
31
+ getFooterContainer,
32
+ };
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
3
- declare const AutoLayoutViewNativeComponent: React.Component<AutoLayoutViewNativeComponentProps, {}, any>;
4
- export default AutoLayoutViewNativeComponent;
5
- //# sourceMappingURL=AutoLayoutViewNativeComponent.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoLayoutViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../src/native/auto-layout/AutoLayoutViewNativeComponent.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE1F,QAAA,MAAM,6BAA6B,8DACiC,CAAC;AACrE,eAAe,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoLayoutViewNativeComponent.web.js","sourceRoot":"","sources":["../../../src/native/auto-layout/AutoLayoutViewNativeComponent.web.ts"],"names":[],"mappings":";;AACA,6CAAoC;AAIpC,IAAM,6BAA6B,GACjC,mBAAkE,CAAC;AACrE,kBAAe,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformHelper.d.ts","sourceRoot":"","sources":["../../src/utils/PlatformHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,QAAA,MAAM,cAAc;;CAEnB,CAAC;AACF,QAAA,MAAM,8BAA8B,aACxB,OAAO,eACJ;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KACpC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,SAEnD,CAAC;AAEF,QAAA,MAAM,eAAe,QAAO,gBAAgB,GAAG,SAE9C,CAAC;AACF,OAAO,EAAE,cAAc,EAAE,8BAA8B,EAAE,eAAe,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformHelper.js","sourceRoot":"","sources":["../../src/utils/PlatformHelper.ts"],"names":[],"mappings":";;;AAEA,IAAM,cAAc,GAAG;IACrB,mBAAmB,EAAE,GAAG;CACzB,CAAC;AAWO,wCAAc;AAVvB,IAAM,8BAA8B,GAAG,UACrC,QAAiB,EACjB,WAAqC;IAErC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAKuB,wEAA8B;AAHvD,IAAM,eAAe,GAAG;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACuD,0CAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformHelper.web.d.ts","sourceRoot":"","sources":["../../src/utils/PlatformHelper.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,QAAA,MAAM,cAAc;;CAEnB,CAAC;AACF,QAAA,MAAM,8BAA8B,aACxB,OAAO,eACJ;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KACpC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,SAKnD,CAAC;AAEF,QAAA,MAAM,eAAe,QAAO,gBAAgB,GAAG,SAE9C,CAAC;AACF,OAAO,EAAE,cAAc,EAAE,8BAA8B,EAAE,eAAe,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformHelper.web.js","sourceRoot":"","sources":["../../src/utils/PlatformHelper.web.ts"],"names":[],"mappings":";;;AACA,sJAAqJ;AAErJ,IAAM,cAAc,GAAG;IACrB,mBAAmB,EAAE,IAAI;CAC1B,CAAC;AAcO,wCAAc;AAbvB,IAAM,8BAA8B,GAAG,UACrC,QAAiB,EACjB,WAAqC;IAErC,IAAM,cAAc,GAAG,oBAAa,WAAW,CAAC,CAAC,gBAAM,WAAW,CAAC,CAAC,gBAClE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAC7B,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AACxE,CAAC,CAAC;AAKuB,wEAA8B;AAHvD,IAAM,eAAe,GAAG;IACtB,OAAO,IAAI,6CAAqB,EAAE,CAAC;AACrC,CAAC,CAAC;AACuD,0CAAe"}