@shopify/flash-list 2.0.0 → 2.0.2-rc.1
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.
- package/README.md +97 -27
- package/RNFlashList.podspec +37 -0
- package/android/build.gradle +89 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutShadow.kt +105 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt +158 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutViewManager.kt +70 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/BlankAreaEvent.kt +29 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainer.java +16 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainerImpl.kt +16 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/CellContainerManager.kt +34 -0
- package/android/src/main/kotlin/com/shopify/reactnative/flash_list/FlashListPackage.kt +19 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/AutoLayoutViewManagerDelegate.java +47 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/AutoLayoutViewManagerInterface.java +21 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/CellContainerManagerDelegate.java +32 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/CellContainerManagerInterface.java +16 -0
- package/android/src/test/java/com/shopify/reactnative/flash_list/AutoLayoutShadowTest.kt +147 -0
- package/android/src/test/java/com/shopify/reactnative/flash_list/models/Rect.kt +61 -0
- package/android/src/test/java/com/shopify/reactnative/flash_list/models/TestCollection.kt +6 -0
- package/android/src/test/java/com/shopify/reactnative/flash_list/models/TestDataModel.kt +8 -0
- package/android/src/test/resources/LayoutTestData.json +788 -0
- package/dist/AnimatedFlashList.js +2 -2
- package/dist/AnimatedFlashList.js.map +1 -1
- package/dist/FlashList.d.ts +167 -1
- package/dist/FlashList.d.ts.map +1 -1
- package/dist/FlashList.js +595 -3
- package/dist/FlashList.js.map +1 -1
- package/dist/FlashListProps.d.ts +63 -2
- package/dist/FlashListProps.d.ts.map +1 -1
- package/dist/FlashListProps.js.map +1 -1
- package/dist/GridLayoutProviderWithProps.d.ts +42 -0
- package/dist/GridLayoutProviderWithProps.d.ts.map +1 -0
- package/dist/GridLayoutProviderWithProps.js +114 -0
- package/dist/GridLayoutProviderWithProps.js.map +1 -0
- package/dist/MasonryFlashList.d.ts +51 -0
- package/dist/MasonryFlashList.d.ts.map +1 -0
- package/dist/MasonryFlashList.js +252 -0
- package/dist/MasonryFlashList.js.map +1 -0
- package/dist/PureComponentWrapper.d.ts +22 -0
- package/dist/PureComponentWrapper.d.ts.map +1 -0
- package/dist/PureComponentWrapper.js +37 -0
- package/dist/PureComponentWrapper.js.map +1 -0
- package/dist/__tests__/ContentContainerUtils.test.d.ts +2 -0
- package/dist/__tests__/ContentContainerUtils.test.d.ts.map +1 -0
- package/dist/__tests__/ContentContainerUtils.test.js +85 -0
- package/dist/__tests__/ContentContainerUtils.test.js.map +1 -0
- package/dist/__tests__/FlashList.test.d.ts +2 -0
- package/dist/__tests__/FlashList.test.d.ts.map +1 -0
- package/dist/__tests__/FlashList.test.js +902 -0
- package/dist/__tests__/FlashList.test.js.map +1 -0
- package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts +2 -0
- package/dist/__tests__/GridLayoutProviderWithProps.test.d.ts.map +1 -0
- package/dist/__tests__/GridLayoutProviderWithProps.test.js +143 -0
- package/dist/__tests__/GridLayoutProviderWithProps.test.js.map +1 -0
- package/dist/__tests__/MasonryFlashList.test.d.ts +2 -0
- package/dist/__tests__/MasonryFlashList.test.d.ts.map +1 -0
- package/dist/__tests__/MasonryFlashList.test.js +254 -0
- package/dist/__tests__/MasonryFlashList.test.js.map +1 -0
- package/dist/__tests__/PlatformHelper.web.test.d.ts +2 -0
- package/dist/__tests__/PlatformHelper.web.test.d.ts.map +1 -0
- package/dist/__tests__/PlatformHelper.web.test.js +33 -0
- package/dist/__tests__/PlatformHelper.web.test.js.map +1 -0
- package/dist/__tests__/ViewabilityHelper.test.js +4 -3
- package/dist/__tests__/ViewabilityHelper.test.js.map +1 -1
- package/dist/__tests__/helpers/mountFlashList.d.ts +19 -0
- package/dist/__tests__/helpers/mountFlashList.d.ts.map +1 -0
- package/dist/__tests__/helpers/mountFlashList.js +44 -0
- package/dist/__tests__/helpers/mountFlashList.js.map +1 -0
- package/dist/__tests__/helpers/mountMasonryFlashList.d.ts +18 -0
- package/dist/__tests__/helpers/mountMasonryFlashList.d.ts.map +1 -0
- package/dist/__tests__/helpers/mountMasonryFlashList.js +49 -0
- package/dist/__tests__/helpers/mountMasonryFlashList.js.map +1 -0
- package/dist/__tests__/useBlankAreaTracker.test.d.ts +2 -0
- package/dist/__tests__/useBlankAreaTracker.test.d.ts.map +1 -0
- package/dist/__tests__/useBlankAreaTracker.test.js +179 -0
- package/dist/__tests__/useBlankAreaTracker.test.js.map +1 -0
- package/dist/benchmark/JSFPSMonitor.d.ts.map +1 -1
- package/dist/benchmark/JSFPSMonitor.js +1 -2
- package/dist/benchmark/JSFPSMonitor.js.map +1 -1
- package/dist/benchmark/useBenchmark.d.ts +4 -2
- package/dist/benchmark/useBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useBenchmark.js +24 -12
- package/dist/benchmark/useBenchmark.js.map +1 -1
- package/dist/benchmark/useBlankAreaTracker.d.ts +34 -0
- package/dist/benchmark/useBlankAreaTracker.d.ts.map +1 -0
- package/dist/benchmark/useBlankAreaTracker.js +66 -0
- package/dist/benchmark/useBlankAreaTracker.js.map +1 -0
- package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -1
- package/dist/benchmark/useFlatListBenchmark.js +1 -2
- package/dist/benchmark/useFlatListBenchmark.js.map +1 -1
- package/dist/enableNewCore.d.ts +3 -0
- package/dist/enableNewCore.d.ts.map +1 -0
- package/dist/enableNewCore.js +25 -0
- package/dist/enableNewCore.js.map +1 -0
- package/dist/errors/CustomError.d.ts +8 -0
- package/dist/errors/CustomError.d.ts.map +1 -0
- package/dist/errors/CustomError.js +14 -0
- package/dist/errors/CustomError.js.map +1 -0
- package/dist/errors/ExceptionList.d.ts +24 -0
- package/dist/errors/ExceptionList.d.ts.map +1 -0
- package/dist/errors/ExceptionList.js +26 -0
- package/dist/errors/ExceptionList.js.map +1 -0
- package/dist/errors/Warnings.d.ts +9 -0
- package/dist/errors/Warnings.d.ts.map +1 -0
- package/dist/errors/Warnings.js +13 -0
- package/dist/errors/Warnings.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/native/auto-layout/AutoLayoutView.d.ts +22 -0
- package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutView.js +48 -0
- package/dist/native/auto-layout/AutoLayoutView.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +4 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +6 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +5 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +4 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +6 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +6 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +16 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +3 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js.map +1 -0
- package/dist/native/cell-container/CellContainer.android.d.ts +6 -0
- package/dist/native/cell-container/CellContainer.android.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.android.js +9 -0
- package/dist/native/cell-container/CellContainer.android.js.map +1 -0
- package/dist/native/cell-container/CellContainer.d.ts +8 -0
- package/dist/native/cell-container/CellContainer.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.ios.d.ts +6 -0
- package/dist/native/cell-container/CellContainer.ios.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.ios.js +9 -0
- package/dist/native/cell-container/CellContainer.ios.js.map +1 -0
- package/dist/native/cell-container/CellContainer.js +11 -0
- package/dist/native/cell-container/CellContainer.js.map +1 -0
- package/dist/native/cell-container/CellContainer.web.d.ts +7 -0
- package/dist/native/cell-container/CellContainer.web.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.web.js +13 -0
- package/dist/native/cell-container/CellContainer.web.js.map +1 -0
- package/dist/native/config/PlatformHelper.android.d.ts +22 -1
- package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.android.js +16 -1
- package/dist/native/config/PlatformHelper.android.js.map +1 -1
- package/dist/native/config/PlatformHelper.d.ts +22 -1
- package/dist/native/config/PlatformHelper.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.d.ts +22 -1
- package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.ios.js +15 -1
- package/dist/native/config/PlatformHelper.ios.js.map +1 -1
- package/dist/native/config/PlatformHelper.js +16 -1
- package/dist/native/config/PlatformHelper.js.map +1 -1
- package/dist/native/config/PlatformHelper.web.d.ts +23 -1
- package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
- package/dist/native/config/PlatformHelper.web.js +18 -1
- package/dist/native/config/PlatformHelper.web.js.map +1 -1
- package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
- package/dist/recyclerview/RecyclerView.js +6 -6
- package/dist/recyclerview/RecyclerView.js.map +1 -1
- package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
- package/dist/recyclerview/RecyclerViewManager.js +8 -9
- package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
- package/dist/recyclerview/RecyclerViewProps.d.ts +8 -1
- package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -1
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +3 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -1
- package/dist/recyclerview/helpers/RenderTimeTracker.js +7 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.js.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewController.js +0 -4
- package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -1
- package/dist/recyclerview/layout-managers/LayoutManager.js +1 -2
- package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -1
- package/dist/specs/AutoLayoutNativeComponent.d.ts +18 -0
- package/dist/specs/AutoLayoutNativeComponent.d.ts.map +1 -0
- package/dist/specs/AutoLayoutNativeComponent.js +6 -0
- package/dist/specs/AutoLayoutNativeComponent.js.map +1 -0
- package/dist/specs/CellContainerNativeComponent.d.ts +8 -0
- package/dist/specs/CellContainerNativeComponent.d.ts.map +1 -0
- package/dist/specs/CellContainerNativeComponent.js +6 -0
- package/dist/specs/CellContainerNativeComponent.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/ContentContainerUtils.d.ts +27 -0
- package/dist/utils/ContentContainerUtils.d.ts.map +1 -0
- package/dist/utils/ContentContainerUtils.js +48 -0
- package/dist/utils/ContentContainerUtils.js.map +1 -0
- package/dist/viewability/ViewToken.d.ts.map +1 -0
- package/dist/viewability/ViewToken.js.map +1 -0
- package/dist/{recyclerview/viewability → viewability}/ViewabilityHelper.d.ts +2 -2
- package/dist/viewability/ViewabilityHelper.d.ts.map +1 -0
- package/dist/{recyclerview/viewability → viewability}/ViewabilityHelper.js +4 -2
- package/dist/{recyclerview/viewability → viewability}/ViewabilityHelper.js.map +1 -1
- package/dist/{recyclerview/viewability → viewability}/ViewabilityManager.d.ts +3 -3
- package/dist/viewability/ViewabilityManager.d.ts.map +1 -0
- package/dist/{recyclerview/viewability → viewability}/ViewabilityManager.js +16 -16
- package/dist/viewability/ViewabilityManager.js.map +1 -0
- package/ios/RNFlashList.xcodeproj/project.pbxproj +3 -0
- package/ios/RNFlashList.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/Sources/AutoLayoutView.swift +294 -0
- package/ios/Sources/AutoLayoutViewComponentView.h +16 -0
- package/ios/Sources/AutoLayoutViewComponentView.mm +90 -0
- package/ios/Sources/AutoLayoutViewManager.mm +14 -0
- package/ios/Sources/AutoLayoutViewManager.swift +12 -0
- package/ios/Sources/CellContainerComponentView.h +18 -0
- package/ios/Sources/CellContainerComponentView.mm +62 -0
- package/ios/Sources/CellContainerManager.mm +8 -0
- package/ios/Sources/CellContainerManager.swift +12 -0
- package/ios/Sources/FlatListPro-Bridging-Header.h +11 -0
- package/ios/Tests/AutoLayoutViewTests.swift +113 -0
- package/package.json +14 -3
- package/src/AnimatedFlashList.ts +2 -2
- package/src/FlashList.tsx +953 -0
- package/src/FlashListProps.ts +79 -3
- package/src/GridLayoutProviderWithProps.ts +180 -0
- package/src/MasonryFlashList.tsx +476 -0
- package/src/PureComponentWrapper.tsx +42 -0
- package/src/__tests__/ContentContainerUtils.test.ts +130 -0
- package/src/__tests__/FlashList.test.tsx +1001 -0
- package/src/__tests__/GridLayoutProviderWithProps.test.ts +179 -0
- package/src/__tests__/MasonryFlashList.test.ts +292 -0
- package/src/__tests__/PlatformHelper.web.test.ts +45 -0
- package/src/__tests__/ViewabilityHelper.test.ts +14 -13
- package/src/__tests__/helpers/mountFlashList.tsx +62 -0
- package/src/__tests__/helpers/mountMasonryFlashList.tsx +70 -0
- package/src/__tests__/useBlankAreaTracker.test.tsx +206 -0
- package/src/benchmark/JSFPSMonitor.ts +3 -3
- package/src/benchmark/useBenchmark.ts +40 -12
- package/src/benchmark/useBlankAreaTracker.ts +117 -0
- package/src/benchmark/useFlatListBenchmark.ts +1 -3
- package/src/enableNewCore.ts +24 -0
- package/src/errors/CustomError.ts +10 -0
- package/src/errors/ExceptionList.ts +28 -0
- package/src/errors/Warnings.ts +15 -0
- package/src/index.ts +43 -7
- package/src/native/auto-layout/AutoLayoutView.tsx +73 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +7 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +7 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +7 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +17 -0
- package/src/native/cell-container/CellContainer.android.ts +7 -0
- package/src/native/cell-container/CellContainer.ios.ts +7 -0
- package/src/native/cell-container/CellContainer.tsx +14 -0
- package/src/native/cell-container/CellContainer.web.tsx +9 -0
- package/src/native/config/PlatformHelper.android.ts +25 -1
- package/src/native/config/PlatformHelper.ios.ts +24 -1
- package/src/native/config/PlatformHelper.ts +25 -1
- package/src/native/config/PlatformHelper.web.ts +30 -1
- package/src/recyclerview/RecyclerView.tsx +11 -6
- package/src/recyclerview/RecyclerViewManager.ts +18 -9
- package/src/recyclerview/RecyclerViewProps.ts +11 -1
- package/src/recyclerview/helpers/RenderTimeTracker.ts +8 -0
- package/src/recyclerview/hooks/useRecyclerViewController.tsx +0 -4
- package/src/recyclerview/layout-managers/LayoutManager.ts +1 -2
- package/src/specs/AutoLayoutNativeComponent.ts +24 -0
- package/src/specs/CellContainerNativeComponent.ts +9 -0
- package/src/utils/ContentContainerUtils.ts +92 -0
- package/src/{recyclerview/viewability → viewability}/ViewabilityHelper.ts +9 -8
- package/src/{recyclerview/viewability → viewability}/ViewabilityManager.ts +20 -18
- package/dist/errors/ErrorMessages.d.ts +0 -16
- package/dist/errors/ErrorMessages.d.ts.map +0 -1
- package/dist/errors/ErrorMessages.js +0 -19
- package/dist/errors/ErrorMessages.js.map +0 -1
- package/dist/errors/WarningMessages.d.ts +0 -4
- package/dist/errors/WarningMessages.d.ts.map +0 -1
- package/dist/errors/WarningMessages.js +0 -7
- package/dist/errors/WarningMessages.js.map +0 -1
- package/dist/isNewArch.d.ts +0 -2
- package/dist/isNewArch.d.ts.map +0 -1
- package/dist/isNewArch.js +0 -25
- package/dist/isNewArch.js.map +0 -1
- package/dist/recyclerview/viewability/ViewToken.d.ts.map +0 -1
- package/dist/recyclerview/viewability/ViewToken.js.map +0 -1
- package/dist/recyclerview/viewability/ViewabilityHelper.d.ts.map +0 -1
- package/dist/recyclerview/viewability/ViewabilityManager.d.ts.map +0 -1
- package/dist/recyclerview/viewability/ViewabilityManager.js.map +0 -1
- package/src/FlashList.ts +0 -1
- package/src/errors/ErrorMessages.ts +0 -26
- package/src/errors/WarningMessages.ts +0 -4
- package/src/isNewArch.ts +0 -25
- /package/dist/{recyclerview/viewability → viewability}/ViewToken.d.ts +0 -0
- /package/dist/{recyclerview/viewability → viewability}/ViewToken.js +0 -0
- /package/src/{recyclerview/viewability → viewability}/ViewToken.ts +0 -0
package/src/index.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
// eslint-disable-next-line import/no-named-default
|
|
2
|
+
import { default as OriginalFlashList } from "./FlashList";
|
|
3
|
+
import { isNewCoreEnabled } from "./enableNewCore";
|
|
4
|
+
import { RecyclerView } from "./recyclerview/RecyclerView";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Keep this unmodified for TS type checking
|
|
7
|
+
export { default as FlashList } from "./FlashList";
|
|
6
8
|
export { FlashListRef } from "./FlashListRef";
|
|
7
9
|
export {
|
|
8
10
|
FlashListProps,
|
|
11
|
+
ContentStyle,
|
|
9
12
|
ListRenderItem,
|
|
10
13
|
ListRenderItemInfo,
|
|
11
14
|
RenderTarget,
|
|
12
15
|
RenderTargetOptions,
|
|
13
16
|
} from "./FlashListProps";
|
|
14
17
|
export { default as AnimatedFlashList } from "./AnimatedFlashList";
|
|
18
|
+
export {
|
|
19
|
+
useOnNativeBlankAreaEvents,
|
|
20
|
+
BlankAreaEventHandler,
|
|
21
|
+
BlankAreaEvent,
|
|
22
|
+
} from "./native/auto-layout/AutoLayoutView";
|
|
15
23
|
export {
|
|
16
24
|
useBenchmark,
|
|
17
25
|
BenchmarkParams,
|
|
@@ -22,18 +30,46 @@ export {
|
|
|
22
30
|
useFlatListBenchmark,
|
|
23
31
|
FlatListBenchmarkParams,
|
|
24
32
|
} from "./benchmark/useFlatListBenchmark";
|
|
33
|
+
export {
|
|
34
|
+
useBlankAreaTracker,
|
|
35
|
+
BlankAreaTrackerResult,
|
|
36
|
+
BlankAreaTrackerConfig,
|
|
37
|
+
} from "./benchmark/useBlankAreaTracker";
|
|
38
|
+
export {
|
|
39
|
+
MasonryFlashList,
|
|
40
|
+
MasonryFlashListProps,
|
|
41
|
+
MasonryFlashListScrollEvent,
|
|
42
|
+
MasonryFlashListRef,
|
|
43
|
+
MasonryListItem,
|
|
44
|
+
MasonryListRenderItem,
|
|
45
|
+
MasonryListRenderItemInfo,
|
|
46
|
+
} from "./MasonryFlashList";
|
|
25
47
|
export { useLayoutState } from "./recyclerview/hooks/useLayoutState";
|
|
26
48
|
export { useRecyclingState } from "./recyclerview/hooks/useRecyclingState";
|
|
27
49
|
export { useMappingHelper } from "./recyclerview/hooks/useMappingHelper";
|
|
28
50
|
export { JSFPSMonitor, JSFPSResult } from "./benchmark/JSFPSMonitor";
|
|
29
51
|
export { autoScroll, Cancellable } from "./benchmark/AutoScrollHelper";
|
|
30
|
-
export { default as ViewToken } from "./
|
|
52
|
+
export { default as ViewToken } from "./viewability/ViewToken";
|
|
53
|
+
export { default as CellContainer } from "./native/cell-container/CellContainer";
|
|
54
|
+
export { RecyclerView } from "./recyclerview/RecyclerView";
|
|
55
|
+
export { RecyclerViewProps } from "./recyclerview/RecyclerViewProps";
|
|
31
56
|
export { useFlashListContext } from "./recyclerview/RecyclerViewContextProvider";
|
|
32
57
|
export {
|
|
33
58
|
LayoutCommitObserver,
|
|
34
59
|
LayoutCommitObserverProps,
|
|
35
60
|
} from "./recyclerview/LayoutCommitObserver";
|
|
36
61
|
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
// @ts-ignore - This is ignored by TypeScript but will be present in the compiled JS
|
|
63
|
+
// In the compiled JS, this will override the previous FlashList export with a conditional one
|
|
64
|
+
if (
|
|
65
|
+
typeof module !== "undefined" &&
|
|
66
|
+
module.exports &&
|
|
67
|
+
process?.env?.NODE_ENV !== "test"
|
|
68
|
+
) {
|
|
69
|
+
Object.defineProperty(module.exports, "FlashList", {
|
|
70
|
+
get() {
|
|
71
|
+
return isNewCoreEnabled() ? RecyclerView : OriginalFlashList;
|
|
72
|
+
},
|
|
73
|
+
configurable: true,
|
|
74
|
+
});
|
|
39
75
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useEffect, ReactNode } from "react";
|
|
2
|
+
import { LayoutChangeEvent } from "react-native";
|
|
3
|
+
|
|
4
|
+
import AutoLayoutViewNativeComponent from "./AutoLayoutViewNativeComponent";
|
|
5
|
+
import { OnBlankAreaEvent } from "./AutoLayoutViewNativeComponentProps";
|
|
6
|
+
|
|
7
|
+
export type BlankAreaEventHandler = (blankAreaEvent: BlankAreaEvent) => void;
|
|
8
|
+
const listeners: BlankAreaEventHandler[] = [];
|
|
9
|
+
|
|
10
|
+
export const useOnNativeBlankAreaEvents = (
|
|
11
|
+
onBlankAreaEvent: (blankAreaEvent: BlankAreaEvent) => void
|
|
12
|
+
) => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
listeners.push(onBlankAreaEvent);
|
|
15
|
+
return () => {
|
|
16
|
+
listeners.filter((callback) => callback !== onBlankAreaEvent);
|
|
17
|
+
};
|
|
18
|
+
}, [onBlankAreaEvent]);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface BlankAreaEvent {
|
|
22
|
+
offsetStart: number;
|
|
23
|
+
offsetEnd: number;
|
|
24
|
+
blankArea: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AutoLayoutViewProps {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
onBlankAreaEvent?: BlankAreaEventHandler;
|
|
30
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
31
|
+
disableAutoLayout?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class AutoLayoutView extends React.Component<AutoLayoutViewProps> {
|
|
35
|
+
private onBlankAreaEventCallback = ({
|
|
36
|
+
nativeEvent,
|
|
37
|
+
}: OnBlankAreaEvent): void => {
|
|
38
|
+
const blankArea = Math.max(nativeEvent.offsetStart, nativeEvent.offsetEnd);
|
|
39
|
+
const blankEventValue = {
|
|
40
|
+
blankArea,
|
|
41
|
+
offsetStart: nativeEvent.offsetStart,
|
|
42
|
+
offsetEnd: nativeEvent.offsetEnd,
|
|
43
|
+
};
|
|
44
|
+
this.broadcastBlankEvent(blankEventValue);
|
|
45
|
+
if (this.props.onBlankAreaEvent) {
|
|
46
|
+
this.props.onBlankAreaEvent(blankEventValue);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
private broadcastBlankEvent(value: BlankAreaEvent) {
|
|
51
|
+
const len = listeners.length;
|
|
52
|
+
for (let i = 0; i < len; i++) {
|
|
53
|
+
listeners[i](value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
render() {
|
|
58
|
+
return (
|
|
59
|
+
<AutoLayoutViewNativeComponent
|
|
60
|
+
{...this.props}
|
|
61
|
+
onBlankAreaEvent={this.onBlankAreaEventCallback}
|
|
62
|
+
enableInstrumentation={
|
|
63
|
+
listeners.length !== 0 || Boolean(this.props.onBlankAreaEvent)
|
|
64
|
+
}
|
|
65
|
+
disableAutoLayout={this.props.disableAutoLayout}
|
|
66
|
+
>
|
|
67
|
+
{this.props.children}
|
|
68
|
+
</AutoLayoutViewNativeComponent>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default AutoLayoutView;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HostComponent, View } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
|
|
4
|
+
|
|
5
|
+
const AutoLayoutViewNativeComponent =
|
|
6
|
+
View as any as HostComponent<AutoLayoutViewNativeComponentProps>;
|
|
7
|
+
export default AutoLayoutViewNativeComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface OnBlankAreaEvent {
|
|
4
|
+
nativeEvent: {
|
|
5
|
+
offsetStart: number;
|
|
6
|
+
offsetEnd: number;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type OnBlankAreaEventHandler = (event: OnBlankAreaEvent) => void;
|
|
11
|
+
|
|
12
|
+
export interface AutoLayoutViewNativeComponentProps {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
onBlankAreaEvent: OnBlankAreaEventHandler;
|
|
15
|
+
enableInstrumentation: boolean;
|
|
16
|
+
disableAutoLayout?: boolean;
|
|
17
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* On web we use a view instead of cell container till we build native web implementations
|
|
4
|
+
*/
|
|
5
|
+
const CellContainer = React.forwardRef((props: any, ref) => {
|
|
6
|
+
return <div ref={ref} {...props} />;
|
|
7
|
+
});
|
|
8
|
+
CellContainer.displayName = "CellContainer";
|
|
9
|
+
export default CellContainer;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
import { BaseItemAnimator } from "recyclerlistview";
|
|
2
|
+
|
|
1
3
|
const PlatformConfig = {
|
|
2
4
|
defaultDrawDistance: 250,
|
|
3
5
|
supportsOffsetCorrection: true,
|
|
4
6
|
trackAverageRenderTimeForOffsetProjection: true,
|
|
7
|
+
// Using rotate instead of scaleY on Android to avoid performance issues. Issue: https://github.com/Shopify/flash-list/issues/751
|
|
8
|
+
invertedTransformStyle: { transform: [{ rotate: "180deg" }] },
|
|
9
|
+
invertedTransformStyleHorizontal: { transform: [{ rotate: "180deg" }] },
|
|
10
|
+
};
|
|
11
|
+
const getCellContainerPlatformStyles = (
|
|
12
|
+
inverted: boolean,
|
|
13
|
+
parentProps: { x: number; y: number; isHorizontal?: boolean }
|
|
14
|
+
): { transform: string; WebkitTransform: string } | undefined => {
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getItemAnimator = (): BaseItemAnimator | undefined => {
|
|
19
|
+
return undefined;
|
|
5
20
|
};
|
|
6
21
|
|
|
7
|
-
|
|
22
|
+
const getFooterContainer = (): React.ComponentClass | undefined => {
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
PlatformConfig,
|
|
28
|
+
getCellContainerPlatformStyles,
|
|
29
|
+
getItemAnimator,
|
|
30
|
+
getFooterContainer,
|
|
31
|
+
};
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { BaseItemAnimator } from "recyclerlistview";
|
|
2
|
+
|
|
1
3
|
const PlatformConfig = {
|
|
2
4
|
defaultDrawDistance: 250,
|
|
3
5
|
supportsOffsetCorrection: true,
|
|
4
6
|
trackAverageRenderTimeForOffsetProjection: false,
|
|
7
|
+
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
|
|
8
|
+
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
|
|
9
|
+
};
|
|
10
|
+
const getCellContainerPlatformStyles = (
|
|
11
|
+
inverted: boolean,
|
|
12
|
+
parentProps: { x: number; y: number; isHorizontal?: boolean }
|
|
13
|
+
): { transform: string; WebkitTransform: string } | undefined => {
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getItemAnimator = (): BaseItemAnimator | undefined => {
|
|
18
|
+
return undefined;
|
|
5
19
|
};
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
const getFooterContainer = (): React.ComponentClass | undefined => {
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
PlatformConfig,
|
|
27
|
+
getCellContainerPlatformStyles,
|
|
28
|
+
getItemAnimator,
|
|
29
|
+
getFooterContainer,
|
|
30
|
+
};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
import { BaseItemAnimator } from "recyclerlistview";
|
|
2
|
+
import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platform/reactnative/itemanimators/defaultjsanimator/DefaultJSItemAnimator";
|
|
3
|
+
|
|
1
4
|
const PlatformConfig = {
|
|
2
5
|
defaultDrawDistance: 250,
|
|
3
6
|
supportsOffsetCorrection: false,
|
|
4
7
|
trackAverageRenderTimeForOffsetProjection: false,
|
|
8
|
+
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
|
|
9
|
+
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
|
|
10
|
+
};
|
|
11
|
+
const getCellContainerPlatformStyles = (
|
|
12
|
+
inverted: boolean,
|
|
13
|
+
parentProps: { x: number; y: number; isHorizontal?: boolean }
|
|
14
|
+
): { transform: string; WebkitTransform: string } | undefined => {
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getItemAnimator = (): BaseItemAnimator | undefined => {
|
|
19
|
+
return new DefaultJSItemAnimator();
|
|
5
20
|
};
|
|
6
21
|
|
|
7
|
-
|
|
22
|
+
const getFooterContainer = (): React.ComponentClass | undefined => {
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
PlatformConfig,
|
|
28
|
+
getCellContainerPlatformStyles,
|
|
29
|
+
getItemAnimator,
|
|
30
|
+
getFooterContainer,
|
|
31
|
+
};
|
|
@@ -1,7 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { BaseItemAnimator } from "recyclerlistview";
|
|
4
|
+
import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platform/reactnative/itemanimators/defaultjsanimator/DefaultJSItemAnimator";
|
|
5
|
+
|
|
1
6
|
const PlatformConfig = {
|
|
2
7
|
defaultDrawDistance: 500,
|
|
3
8
|
supportsOffsetCorrection: false,
|
|
4
9
|
trackAverageRenderTimeForOffsetProjection: false,
|
|
10
|
+
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
|
|
11
|
+
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
|
|
12
|
+
};
|
|
13
|
+
const getCellContainerPlatformStyles = (
|
|
14
|
+
inverted: boolean,
|
|
15
|
+
parentProps: { x: number; y: number; isHorizontal?: boolean }
|
|
16
|
+
): { transform: string; WebkitTransform: string } | undefined => {
|
|
17
|
+
const transformValue = `translate(${parentProps.x}px,${parentProps.y}px)${
|
|
18
|
+
inverted ? ` ${parentProps.isHorizontal ? `scaleX` : `scaleY`}(-1)` : ``
|
|
19
|
+
}`;
|
|
20
|
+
return { transform: transformValue, WebkitTransform: transformValue };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const getItemAnimator = (): BaseItemAnimator | undefined => {
|
|
24
|
+
return new DefaultJSItemAnimator();
|
|
5
25
|
};
|
|
6
26
|
|
|
7
|
-
|
|
27
|
+
const getFooterContainer = (): React.ComponentClass | undefined => {
|
|
28
|
+
return View;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
PlatformConfig,
|
|
33
|
+
getCellContainerPlatformStyles,
|
|
34
|
+
getItemAnimator,
|
|
35
|
+
getFooterContainer,
|
|
36
|
+
};
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
} from "react-native";
|
|
21
21
|
|
|
22
22
|
import { FlashListRef } from "../FlashListRef";
|
|
23
|
-
import { ErrorMessages } from "../errors/ErrorMessages";
|
|
24
23
|
|
|
25
24
|
import { RVDimension } from "./layout-managers/LayoutManager";
|
|
26
25
|
import {
|
|
@@ -209,8 +208,18 @@ const RecyclerViewComponent = <T,>(
|
|
|
209
208
|
return { index, dimensions: layout };
|
|
210
209
|
});
|
|
211
210
|
|
|
211
|
+
const hasExceededMaxRendersWithoutCommit =
|
|
212
|
+
renderTimeTracker.hasExceededMaxRendersWithoutCommit();
|
|
213
|
+
|
|
214
|
+
if (hasExceededMaxRendersWithoutCommit) {
|
|
215
|
+
console.warn(
|
|
216
|
+
"FlashList: Exceeded max renders without commit, check for duplicate keys or parent being a ScrollView"
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
212
220
|
if (
|
|
213
|
-
recyclerViewManager.modifyChildrenLayout(layoutInfo, data?.length ?? 0)
|
|
221
|
+
recyclerViewManager.modifyChildrenLayout(layoutInfo, data?.length ?? 0) &&
|
|
222
|
+
!hasExceededMaxRendersWithoutCommit
|
|
214
223
|
) {
|
|
215
224
|
// Trigger re-render if layout modifications were made
|
|
216
225
|
setRenderId((prev) => prev + 1);
|
|
@@ -385,9 +394,6 @@ const RecyclerViewComponent = <T,>(
|
|
|
385
394
|
stickyHeaderIndices &&
|
|
386
395
|
stickyHeaderIndices.length > 0
|
|
387
396
|
) {
|
|
388
|
-
if (horizontal) {
|
|
389
|
-
throw new Error(ErrorMessages.stickyHeadersNotSupportedForHorizontal);
|
|
390
|
-
}
|
|
391
397
|
return (
|
|
392
398
|
<StickyHeaders
|
|
393
399
|
stickyHeaderIndices={stickyHeaderIndices}
|
|
@@ -406,7 +412,6 @@ const RecyclerViewComponent = <T,>(
|
|
|
406
412
|
stickyHeaderIndices,
|
|
407
413
|
renderItem,
|
|
408
414
|
scrollY,
|
|
409
|
-
horizontal,
|
|
410
415
|
recyclerViewManager,
|
|
411
416
|
extraData,
|
|
412
417
|
]);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ViewabilityManager from "../viewability/ViewabilityManager";
|
|
2
2
|
|
|
3
|
-
import ViewabilityManager from "./viewability/ViewabilityManager";
|
|
4
3
|
import { ConsecutiveNumbers } from "./helpers/ConsecutiveNumbers";
|
|
5
4
|
import { RVGridLayoutManagerImpl } from "./layout-managers/GridLayoutManager";
|
|
6
5
|
import {
|
|
@@ -132,7 +131,9 @@ export class RecyclerViewManager<T> {
|
|
|
132
131
|
|
|
133
132
|
getLayout(index: number) {
|
|
134
133
|
if (!this.layoutManager) {
|
|
135
|
-
throw new Error(
|
|
134
|
+
throw new Error(
|
|
135
|
+
"LayoutManager is not initialized, layout info is unavailable"
|
|
136
|
+
);
|
|
136
137
|
}
|
|
137
138
|
return this.layoutManager.getLayout(index);
|
|
138
139
|
}
|
|
@@ -151,7 +152,9 @@ export class RecyclerViewManager<T> {
|
|
|
151
152
|
// Doesn't include header / foot etc
|
|
152
153
|
getChildContainerDimensions() {
|
|
153
154
|
if (!this.layoutManager) {
|
|
154
|
-
throw new Error(
|
|
155
|
+
throw new Error(
|
|
156
|
+
"LayoutManager is not initialized, child container layout is unavailable"
|
|
157
|
+
);
|
|
155
158
|
}
|
|
156
159
|
return this.layoutManager.getLayoutSize();
|
|
157
160
|
}
|
|
@@ -162,7 +165,9 @@ export class RecyclerViewManager<T> {
|
|
|
162
165
|
|
|
163
166
|
getWindowSize() {
|
|
164
167
|
if (!this.layoutManager) {
|
|
165
|
-
throw new Error(
|
|
168
|
+
throw new Error(
|
|
169
|
+
"LayoutManager is not initialized, window size is unavailable"
|
|
170
|
+
);
|
|
166
171
|
}
|
|
167
172
|
return this.layoutManager.getWindowsSize();
|
|
168
173
|
}
|
|
@@ -206,7 +211,9 @@ export class RecyclerViewManager<T> {
|
|
|
206
211
|
Boolean(this.layoutManager?.isHorizontal()) !==
|
|
207
212
|
Boolean(this.propsRef.horizontal)
|
|
208
213
|
) {
|
|
209
|
-
throw new Error(
|
|
214
|
+
throw new Error(
|
|
215
|
+
"Horizontal prop cannot be toggled, you can use a key on FlashList to recreate it."
|
|
216
|
+
);
|
|
210
217
|
}
|
|
211
218
|
if (this._isLayoutManagerDirty) {
|
|
212
219
|
this.layoutManager = undefined;
|
|
@@ -238,7 +245,9 @@ export class RecyclerViewManager<T> {
|
|
|
238
245
|
|
|
239
246
|
computeVisibleIndices() {
|
|
240
247
|
if (!this.layoutManager) {
|
|
241
|
-
throw new Error(
|
|
248
|
+
throw new Error(
|
|
249
|
+
"LayoutManager is not initialized, visible indices are not unavailable"
|
|
250
|
+
);
|
|
242
251
|
}
|
|
243
252
|
return this.engagedIndicesTracker.computeVisibleIndices(this.layoutManager);
|
|
244
253
|
}
|
|
@@ -351,10 +360,10 @@ export class RecyclerViewManager<T> {
|
|
|
351
360
|
private getLayoutManagerClass() {
|
|
352
361
|
// throw errors for incompatible props
|
|
353
362
|
if (this.propsRef.masonry && this.propsRef.horizontal) {
|
|
354
|
-
throw new Error(
|
|
363
|
+
throw new Error("Masonry and horizontal props are incompatible");
|
|
355
364
|
}
|
|
356
365
|
if (this.numColumns > 1 && this.propsRef.horizontal) {
|
|
357
|
-
throw new Error(
|
|
366
|
+
throw new Error("numColumns and horizontal props are incompatible");
|
|
358
367
|
}
|
|
359
368
|
return this.propsRef.masonry
|
|
360
369
|
? RVMasonryLayoutManagerImpl
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ScrollViewProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { FlashListProps } from "../FlashListProps";
|
|
4
|
+
|
|
5
|
+
export interface RecyclerViewProps<TItem>
|
|
6
|
+
extends Omit<FlashListProps<TItem>, "contentContainerStyle"> {
|
|
7
|
+
/**
|
|
8
|
+
* Style for the RecyclerView's parent container.
|
|
9
|
+
*/
|
|
10
|
+
contentContainerStyle?: ScrollViewProps["contentContainerStyle"];
|
|
11
|
+
}
|
|
@@ -6,8 +6,11 @@ export class RenderTimeTracker {
|
|
|
6
6
|
private lastTimerStartedAt = -1;
|
|
7
7
|
private maxRenderTime = 32; // TODO: Improve this even more
|
|
8
8
|
private defaultRenderTime = 16;
|
|
9
|
+
private rendersWithoutCommit = 0;
|
|
10
|
+
private maxRendersWithoutCommit = 40;
|
|
9
11
|
|
|
10
12
|
startTracking() {
|
|
13
|
+
this.rendersWithoutCommit++;
|
|
11
14
|
if (!PlatformConfig.trackAverageRenderTimeForOffsetProjection) {
|
|
12
15
|
return;
|
|
13
16
|
}
|
|
@@ -17,6 +20,7 @@ export class RenderTimeTracker {
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
markRenderComplete() {
|
|
23
|
+
this.rendersWithoutCommit = 0;
|
|
20
24
|
if (!PlatformConfig.trackAverageRenderTimeForOffsetProjection) {
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
@@ -26,6 +30,10 @@ export class RenderTimeTracker {
|
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
hasExceededMaxRendersWithoutCommit() {
|
|
34
|
+
return this.rendersWithoutCommit >= this.maxRendersWithoutCommit;
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
getRawValue() {
|
|
30
38
|
return this.renderTimeAvgWindow.currentValue;
|
|
31
39
|
}
|
|
@@ -21,7 +21,6 @@ import { adjustOffsetForRTL } from "../utils/adjustOffsetForRTL";
|
|
|
21
21
|
import { RVLayout } from "../layout-managers/LayoutManager";
|
|
22
22
|
import { ScrollAnchorRef } from "../components/ScrollAnchor";
|
|
23
23
|
import { PlatformConfig } from "../../native/config/PlatformHelper";
|
|
24
|
-
import { WarningMessages } from "../../errors/WarningMessages";
|
|
25
24
|
|
|
26
25
|
import { useUnmountFlag } from "./useUnmountFlag";
|
|
27
26
|
import { useUnmountAwareTimeout } from "./useUnmountAwareCallbacks";
|
|
@@ -549,9 +548,6 @@ export function useRecyclerViewController<T>(
|
|
|
549
548
|
* Disables item recycling in preparation for layout animations.
|
|
550
549
|
*/
|
|
551
550
|
prepareForLayoutAnimationRender: () => {
|
|
552
|
-
if (!recyclerViewManager.props.keyExtractor) {
|
|
553
|
-
console.warn(WarningMessages.keyExtractorNotDefinedForAnimation);
|
|
554
|
-
}
|
|
555
551
|
recyclerViewManager.animationOptimizationsEnabled = true;
|
|
556
552
|
},
|
|
557
553
|
};
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
findLastVisibleIndex,
|
|
8
8
|
} from "../utils/findVisibleIndex";
|
|
9
9
|
import { areDimensionsNotEqual } from "../utils/measureLayout";
|
|
10
|
-
import { ErrorMessages } from "../../errors/ErrorMessages";
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Base abstract class for layout managers in the recycler view system.
|
|
@@ -225,7 +224,7 @@ export abstract class RVLayoutManager {
|
|
|
225
224
|
*/
|
|
226
225
|
getLayout(index: number): RVLayout {
|
|
227
226
|
if (index >= this.layouts.length) {
|
|
228
|
-
throw new Error(
|
|
227
|
+
throw new Error("index out of bounds, not enough layouts");
|
|
229
228
|
}
|
|
230
229
|
let layout = this.layouts[index];
|
|
231
230
|
if (!layout) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
import type {
|
|
4
|
+
Int32,
|
|
5
|
+
Double,
|
|
6
|
+
DirectEventHandler,
|
|
7
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
8
|
+
|
|
9
|
+
type BlankAreaEvent = Readonly<{
|
|
10
|
+
offsetStart: Int32;
|
|
11
|
+
offsetEnd: Int32;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
interface NativeProps extends ViewProps {
|
|
15
|
+
horizontal?: boolean;
|
|
16
|
+
scrollOffset?: Double;
|
|
17
|
+
windowSize?: Double;
|
|
18
|
+
renderAheadOffset?: Double;
|
|
19
|
+
enableInstrumentation?: boolean;
|
|
20
|
+
disableAutoLayout?: boolean;
|
|
21
|
+
onBlankAreaEvent?: DirectEventHandler<BlankAreaEvent>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default codegenNativeComponent<NativeProps>("AutoLayoutView");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
import type { ViewProps } from "react-native";
|
|
4
|
+
|
|
5
|
+
interface NativeProps extends ViewProps {
|
|
6
|
+
index?: Int32;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default codegenNativeComponent<NativeProps>("CellContainer");
|