@react-native-ohos/flash-list 1.8.3-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/LICENSE +7 -0
- package/README.OpenSource +11 -0
- package/README.md +9 -0
- package/dist/AnimatedFlashList.d.ts +29 -0
- package/dist/AnimatedFlashList.d.ts.map +1 -0
- package/dist/AnimatedFlashList.js +31 -0
- package/dist/AnimatedFlashList.js.map +1 -0
- package/dist/FlashList.d.ts +182 -0
- package/dist/FlashList.d.ts.map +1 -0
- package/dist/FlashList.js +602 -0
- package/dist/FlashList.js.map +1 -0
- package/dist/FlashListProps.d.ts +279 -0
- package/dist/FlashListProps.d.ts.map +1 -0
- package/dist/FlashListProps.js +32 -0
- package/dist/FlashListProps.js.map +1 -0
- package/dist/GridLayoutProviderWithProps.d.ts +65 -0
- package/dist/GridLayoutProviderWithProps.d.ts.map +1 -0
- package/dist/GridLayoutProviderWithProps.js +138 -0
- package/dist/GridLayoutProviderWithProps.js.map +1 -0
- package/dist/MasonryFlashList.d.ts +74 -0
- package/dist/MasonryFlashList.d.ts.map +1 -0
- package/dist/MasonryFlashList.js +275 -0
- package/dist/MasonryFlashList.js.map +1 -0
- package/dist/PureComponentWrapper.d.ts +45 -0
- package/dist/PureComponentWrapper.d.ts.map +1 -0
- package/dist/PureComponentWrapper.js +60 -0
- package/dist/PureComponentWrapper.js.map +1 -0
- package/dist/benchmark/AutoScrollHelper.d.ts +41 -0
- package/dist/benchmark/AutoScrollHelper.d.ts.map +1 -0
- package/dist/benchmark/AutoScrollHelper.js +91 -0
- package/dist/benchmark/AutoScrollHelper.js.map +1 -0
- package/dist/benchmark/JSFPSMonitor.d.ts +46 -0
- package/dist/benchmark/JSFPSMonitor.d.ts.map +1 -0
- package/dist/benchmark/JSFPSMonitor.js +88 -0
- package/dist/benchmark/JSFPSMonitor.js.map +1 -0
- package/dist/benchmark/roundToDecimalPlaces.d.ts +25 -0
- package/dist/benchmark/roundToDecimalPlaces.d.ts.map +1 -0
- package/dist/benchmark/roundToDecimalPlaces.js +32 -0
- package/dist/benchmark/roundToDecimalPlaces.js.map +1 -0
- package/dist/benchmark/useBenchmark.d.ts +58 -0
- package/dist/benchmark/useBenchmark.d.ts.map +1 -0
- package/dist/benchmark/useBenchmark.js +190 -0
- package/dist/benchmark/useBenchmark.js.map +1 -0
- package/dist/benchmark/useBlankAreaTracker.d.ts +57 -0
- package/dist/benchmark/useBlankAreaTracker.d.ts.map +1 -0
- package/dist/benchmark/useBlankAreaTracker.js +90 -0
- package/dist/benchmark/useBlankAreaTracker.js.map +1 -0
- package/dist/benchmark/useDataMultiplier.d.ts +32 -0
- package/dist/benchmark/useDataMultiplier.d.ts.map +1 -0
- package/dist/benchmark/useDataMultiplier.js +48 -0
- package/dist/benchmark/useDataMultiplier.js.map +1 -0
- package/dist/benchmark/useFlatListBenchmark.d.ts +36 -0
- package/dist/benchmark/useFlatListBenchmark.d.ts.map +1 -0
- package/dist/benchmark/useFlatListBenchmark.js +123 -0
- package/dist/benchmark/useFlatListBenchmark.js.map +1 -0
- package/dist/errors/CustomError.d.ts +31 -0
- package/dist/errors/CustomError.d.ts.map +1 -0
- package/dist/errors/CustomError.js +37 -0
- package/dist/errors/CustomError.js.map +1 -0
- package/dist/errors/ExceptionList.d.ts +47 -0
- package/dist/errors/ExceptionList.d.ts.map +1 -0
- package/dist/errors/ExceptionList.js +49 -0
- package/dist/errors/ExceptionList.js.map +1 -0
- package/dist/errors/Warnings.d.ts +32 -0
- package/dist/errors/Warnings.d.ts.map +1 -0
- package/dist/errors/Warnings.js +36 -0
- package/dist/errors/Warnings.js.map +1 -0
- package/dist/fabric/AutoLayoutNativeComponent.d.ts +42 -0
- package/dist/fabric/AutoLayoutNativeComponent.d.ts.map +1 -0
- package/dist/fabric/AutoLayoutNativeComponent.js +29 -0
- package/dist/fabric/AutoLayoutNativeComponent.js.map +1 -0
- package/dist/fabric/CellContainerNativeComponent.d.ts +31 -0
- package/dist/fabric/CellContainerNativeComponent.d.ts.map +1 -0
- package/dist/fabric/CellContainerNativeComponent.js +29 -0
- package/dist/fabric/CellContainerNativeComponent.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutView.d.ts +45 -0
- package/dist/native/auto-layout/AutoLayoutView.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutView.js +71 -0
- package/dist/native/auto-layout/AutoLayoutView.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts +27 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js +29 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.android.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts +28 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts +27 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js +29 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.harmony.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts +27 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js +29 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.ios.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js +29 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponent.js.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts +39 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.d.ts.map +1 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js +26 -0
- package/dist/native/auto-layout/AutoLayoutViewNativeComponentProps.js.map +1 -0
- package/dist/native/cell-container/CellContainer.android.d.ts +29 -0
- package/dist/native/cell-container/CellContainer.android.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.android.js +32 -0
- package/dist/native/cell-container/CellContainer.android.js.map +1 -0
- package/dist/native/cell-container/CellContainer.d.ts +31 -0
- package/dist/native/cell-container/CellContainer.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.harmony.d.ts +29 -0
- package/dist/native/cell-container/CellContainer.harmony.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.harmony.js +32 -0
- package/dist/native/cell-container/CellContainer.harmony.js.map +1 -0
- package/dist/native/cell-container/CellContainer.ios.d.ts +29 -0
- package/dist/native/cell-container/CellContainer.ios.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.ios.js +32 -0
- package/dist/native/cell-container/CellContainer.ios.js.map +1 -0
- package/dist/native/cell-container/CellContainer.js +34 -0
- package/dist/native/cell-container/CellContainer.js.map +1 -0
- package/dist/native/cell-container/CellContainer.web.d.ts +30 -0
- package/dist/native/cell-container/CellContainer.web.d.ts.map +1 -0
- package/dist/native/cell-container/CellContainer.web.js +36 -0
- package/dist/native/cell-container/CellContainer.web.js.map +1 -0
- package/dist/native/config/PlatformHelper.android.d.ts +49 -0
- package/dist/native/config/PlatformHelper.android.d.ts.map +1 -0
- package/dist/native/config/PlatformHelper.android.js +46 -0
- package/dist/native/config/PlatformHelper.android.js.map +1 -0
- package/dist/native/config/PlatformHelper.d.ts +49 -0
- package/dist/native/config/PlatformHelper.d.ts.map +1 -0
- package/dist/native/config/PlatformHelper.harmony.d.ts +49 -0
- package/dist/native/config/PlatformHelper.harmony.d.ts.map +1 -0
- package/dist/native/config/PlatformHelper.harmony.js +45 -0
- package/dist/native/config/PlatformHelper.harmony.js.map +1 -0
- package/dist/native/config/PlatformHelper.ios.d.ts +49 -0
- package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -0
- package/dist/native/config/PlatformHelper.ios.js +45 -0
- package/dist/native/config/PlatformHelper.ios.js.map +1 -0
- package/dist/native/config/PlatformHelper.js +46 -0
- package/dist/native/config/PlatformHelper.js.map +1 -0
- package/dist/native/config/PlatformHelper.web.d.ts +50 -0
- package/dist/native/config/PlatformHelper.web.d.ts.map +1 -0
- package/dist/native/config/PlatformHelper.web.js +48 -0
- package/dist/native/config/PlatformHelper.web.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/AverageWindow.d.ts +44 -0
- package/dist/utils/AverageWindow.d.ts.map +1 -0
- package/dist/utils/AverageWindow.js +72 -0
- package/dist/utils/AverageWindow.js.map +1 -0
- package/dist/utils/ContentContainerUtils.d.ts +50 -0
- package/dist/utils/ContentContainerUtils.d.ts.map +1 -0
- package/dist/utils/ContentContainerUtils.js +71 -0
- package/dist/utils/ContentContainerUtils.js.map +1 -0
- package/dist/viewability/ViewToken.d.ts +31 -0
- package/dist/viewability/ViewToken.d.ts.map +1 -0
- package/dist/viewability/ViewToken.js +26 -0
- package/dist/viewability/ViewToken.js.map +1 -0
- package/dist/viewability/ViewabilityHelper.d.ts +49 -0
- package/dist/viewability/ViewabilityHelper.d.ts.map +1 -0
- package/dist/viewability/ViewabilityHelper.js +130 -0
- package/dist/viewability/ViewabilityHelper.js.map +1 -0
- package/dist/viewability/ViewabilityManager.d.ts +48 -0
- package/dist/viewability/ViewabilityManager.d.ts.map +1 -0
- package/dist/viewability/ViewabilityManager.js +131 -0
- package/dist/viewability/ViewabilityManager.js.map +1 -0
- package/harmony/flash_list/BuildProfile.ets +17 -0
- package/harmony/flash_list/LICENSE +7 -0
- package/harmony/flash_list/build-profile.json5 +8 -0
- package/harmony/flash_list/hvigorfile.ts +1 -0
- package/harmony/flash_list/index.ets +27 -0
- package/harmony/flash_list/obfuscation-rules.txt +18 -0
- package/harmony/flash_list/oh-package.json5 +24 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.cpp +63 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutNode.h +54 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.cpp +133 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutShadow.h +66 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.cpp +208 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewComponentInstance.h +78 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewEventEmitRequestHandler.h +53 -0
- package/harmony/flash_list/src/main/cpp/AutoLayoutViewJSIBinder.h +50 -0
- package/harmony/flash_list/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.cpp +80 -0
- package/harmony/flash_list/src/main/cpp/CellContainerComponentInstance.h +64 -0
- package/harmony/flash_list/src/main/cpp/CellContainerJSIBinder.h +39 -0
- package/harmony/flash_list/src/main/cpp/ComponentDescriptors.h +40 -0
- package/harmony/flash_list/src/main/cpp/EventEmitters.cpp +40 -0
- package/harmony/flash_list/src/main/cpp/EventEmitters.h +48 -0
- package/harmony/flash_list/src/main/cpp/FlashListPackage.h +77 -0
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.cpp +87 -0
- package/harmony/flash_list/src/main/cpp/FlashListStackNode.h +57 -0
- package/harmony/flash_list/src/main/cpp/Props.cpp +52 -0
- package/harmony/flash_list/src/main/cpp/Props.h +64 -0
- package/harmony/flash_list/src/main/cpp/ShadowNodes.cpp +34 -0
- package/harmony/flash_list/src/main/cpp/ShadowNodes.h +48 -0
- package/harmony/flash_list/src/main/ets/Logger.ets +64 -0
- package/harmony/flash_list/src/main/ets/RNAutoLayoutShadow.ets +154 -0
- package/harmony/flash_list/src/main/ets/RNAutoLayoutView.ets +277 -0
- package/harmony/flash_list/src/main/ets/RNCellContainer.ets +113 -0
- package/harmony/flash_list/src/main/module.json5 +9 -0
- package/harmony/flash_list/src/main/resources/base/element/color.json +8 -0
- package/harmony/flash_list/src/main/resources/base/element/string.json +16 -0
- package/harmony/flash_list/src/main/resources/base/media/icon.png +0 -0
- package/harmony/flash_list/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/flash_list/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/flash_list/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/flash_list.har +0 -0
- package/jestSetup.js +41 -0
- package/package.json +82 -0
- package/src/AnimatedFlashList.ts +35 -0
- package/src/FlashList.tsx +955 -0
- package/src/FlashListProps.ts +359 -0
- package/src/GridLayoutProviderWithProps.ts +204 -0
- package/src/MasonryFlashList.tsx +499 -0
- package/src/PureComponentWrapper.tsx +65 -0
- package/src/benchmark/AutoScrollHelper.ts +94 -0
- package/src/benchmark/JSFPSMonitor.ts +98 -0
- package/src/benchmark/roundToDecimalPlaces.ts +28 -0
- package/src/benchmark/useBenchmark.ts +264 -0
- package/src/benchmark/useBlankAreaTracker.ts +141 -0
- package/src/benchmark/useDataMultiplier.ts +43 -0
- package/src/benchmark/useFlatListBenchmark.ts +131 -0
- package/src/errors/CustomError.ts +34 -0
- package/src/errors/ExceptionList.ts +52 -0
- package/src/errors/Warnings.ts +39 -0
- package/src/fabric/AutoLayoutNativeComponent.ts +52 -0
- package/src/fabric/CellContainerNativeComponent.ts +35 -0
- package/src/index.ts +67 -0
- package/src/native/auto-layout/AutoLayoutView.tsx +97 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.android.ts +31 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.harmony.ts +31 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ios.ts +31 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponent.ts +31 -0
- package/src/native/auto-layout/AutoLayoutViewNativeComponentProps.ts +41 -0
- package/src/native/cell-container/CellContainer.android.ts +31 -0
- package/src/native/cell-container/CellContainer.harmony.ts +31 -0
- package/src/native/cell-container/CellContainer.ios.ts +31 -0
- package/src/native/cell-container/CellContainer.tsx +38 -0
- package/src/native/cell-container/CellContainer.web.tsx +33 -0
- package/src/native/config/PlatformHelper.android.ts +53 -0
- package/src/native/config/PlatformHelper.harmony.ts +52 -0
- package/src/native/config/PlatformHelper.ios.ts +52 -0
- package/src/native/config/PlatformHelper.ts +53 -0
- package/src/native/config/PlatformHelper.web.ts +58 -0
- package/src/utils/AverageWindow.ts +73 -0
- package/src/utils/ContentContainerUtils.ts +116 -0
- package/src/viewability/ViewToken.ts +31 -0
- package/src/viewability/ViewabilityHelper.ts +190 -0
- package/src/viewability/ViewabilityManager.ts +169 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { useEffect } from "react";
|
|
26
|
+
import { FlatList } from "react-native";
|
|
27
|
+
|
|
28
|
+
import { autoScroll, Cancellable } from "./AutoScrollHelper";
|
|
29
|
+
import { JSFPSMonitor } from "./JSFPSMonitor";
|
|
30
|
+
import {
|
|
31
|
+
BenchmarkParams,
|
|
32
|
+
BenchmarkResult,
|
|
33
|
+
getFormattedString,
|
|
34
|
+
} from "./useBenchmark";
|
|
35
|
+
|
|
36
|
+
export interface FlatListBenchmarkParams extends BenchmarkParams {
|
|
37
|
+
targetOffset: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Runs the benchmark on FlatList and calls the callback method with the result.
|
|
42
|
+
* Target offset is mandatory in params.
|
|
43
|
+
* It's recommended to remove pagination while running the benchmark. Removing the onEndReached callback is the easiest way to do that.
|
|
44
|
+
*/
|
|
45
|
+
export function useFlatListBenchmark(
|
|
46
|
+
flatListRef: React.RefObject<FlatList<any>>,
|
|
47
|
+
callback: (benchmarkResult: BenchmarkResult) => void,
|
|
48
|
+
params: FlatListBenchmarkParams
|
|
49
|
+
) {
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const cancellable = new Cancellable();
|
|
52
|
+
if (flatListRef.current) {
|
|
53
|
+
if (!(Number(flatListRef.current.props.data?.length) > 0)) {
|
|
54
|
+
throw new Error("Data is empty, cannot run benchmark");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const cancelTimeout = setTimeout(async () => {
|
|
58
|
+
const jsFPSMonitor = new JSFPSMonitor();
|
|
59
|
+
jsFPSMonitor.startTracking();
|
|
60
|
+
for (let i = 0; i < (params.repeatCount || 1); i++) {
|
|
61
|
+
await runScrollBenchmark(
|
|
62
|
+
flatListRef,
|
|
63
|
+
params.targetOffset,
|
|
64
|
+
cancellable,
|
|
65
|
+
params.speedMultiplier || 1
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const jsProfilerResponse = jsFPSMonitor.stopAndGetData();
|
|
69
|
+
const result: BenchmarkResult = {
|
|
70
|
+
js: jsProfilerResponse,
|
|
71
|
+
suggestions: [],
|
|
72
|
+
interrupted: cancellable.isCancelled(),
|
|
73
|
+
};
|
|
74
|
+
if (!cancellable.isCancelled()) {
|
|
75
|
+
result.formattedString = getFormattedString(result);
|
|
76
|
+
}
|
|
77
|
+
callback(result);
|
|
78
|
+
}, params.startDelayInMs || 3000);
|
|
79
|
+
return () => {
|
|
80
|
+
clearTimeout(cancelTimeout);
|
|
81
|
+
cancellable.cancel();
|
|
82
|
+
};
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, []);
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Scrolls to the target offset and then back to 0
|
|
90
|
+
*/
|
|
91
|
+
async function runScrollBenchmark(
|
|
92
|
+
flatListRef: React.RefObject<FlatList<any> | null | undefined>,
|
|
93
|
+
targetOffset: number,
|
|
94
|
+
cancellable: Cancellable,
|
|
95
|
+
scrollSpeedMultiplier: number
|
|
96
|
+
): Promise<void> {
|
|
97
|
+
if (flatListRef.current) {
|
|
98
|
+
const horizontal = flatListRef.current.props.horizontal;
|
|
99
|
+
|
|
100
|
+
const fromX = 0;
|
|
101
|
+
const fromY = 0;
|
|
102
|
+
const toX = horizontal ? targetOffset : 0;
|
|
103
|
+
const toY = horizontal ? 0 : targetOffset;
|
|
104
|
+
|
|
105
|
+
const scrollNow = (x: number, y: number) => {
|
|
106
|
+
flatListRef.current?.scrollToOffset({
|
|
107
|
+
offset: horizontal ? x : y,
|
|
108
|
+
animated: false,
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
await autoScroll(
|
|
113
|
+
scrollNow,
|
|
114
|
+
fromX,
|
|
115
|
+
fromY,
|
|
116
|
+
toX,
|
|
117
|
+
toY,
|
|
118
|
+
scrollSpeedMultiplier,
|
|
119
|
+
cancellable
|
|
120
|
+
);
|
|
121
|
+
await autoScroll(
|
|
122
|
+
scrollNow,
|
|
123
|
+
toX,
|
|
124
|
+
toY,
|
|
125
|
+
fromX,
|
|
126
|
+
fromY,
|
|
127
|
+
scrollSpeedMultiplier,
|
|
128
|
+
cancellable
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export default class CustomError extends Error {
|
|
26
|
+
constructor(exception: Exception) {
|
|
27
|
+
super(`${exception.type}: ${exception.message}`);
|
|
28
|
+
this.name = exception.type;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export interface Exception {
|
|
32
|
+
type: string;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const ExceptionList = {
|
|
26
|
+
refreshBooleanMissing: {
|
|
27
|
+
message:
|
|
28
|
+
"`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `undefined`.",
|
|
29
|
+
type: "InvariantViolation",
|
|
30
|
+
},
|
|
31
|
+
stickyWhileHorizontalNotSupported: {
|
|
32
|
+
message:
|
|
33
|
+
"sticky headers are not supported when list is in horizontal mode. Remove `stickyHeaderIndices` prop.",
|
|
34
|
+
type: "NotSupportedException",
|
|
35
|
+
},
|
|
36
|
+
columnsWhileHorizontalNotSupported: {
|
|
37
|
+
message:
|
|
38
|
+
"numColumns is not supported when list is in horizontal mode. Please remove or set numColumns to 1.",
|
|
39
|
+
type: "NotSupportedException",
|
|
40
|
+
},
|
|
41
|
+
multipleViewabilityThresholdTypesNotSupported: {
|
|
42
|
+
message:
|
|
43
|
+
"You can set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold. Specifying both is not supported.",
|
|
44
|
+
type: "MultipleViewabilityThresholdTypesException",
|
|
45
|
+
},
|
|
46
|
+
overrideItemLayoutRequiredForMasonryOptimization: {
|
|
47
|
+
message:
|
|
48
|
+
"optimizeItemArrangement has been enabled on `MasonryFlashList` but overrideItemLayout is not set.",
|
|
49
|
+
type: "InvariantViolation",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export default ExceptionList;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const WarningList = {
|
|
26
|
+
styleUnsupported:
|
|
27
|
+
"You have passed a style to FlashList. This list doesn't support styling, use contentContainerStyle or wrap the list in a parent and apply style to it instead.",
|
|
28
|
+
styleContentContainerUnsupported:
|
|
29
|
+
"FlashList only supports padding related props and backgroundColor in contentContainerStyle. Please remove other values as they're not used.",
|
|
30
|
+
unusableRenderedSize:
|
|
31
|
+
"FlashList's rendered size is not usable. Either the height or width is too small (<2px). " +
|
|
32
|
+
"Please make sure that the parent view of the list has a valid size. FlashList will match the size of the parent.",
|
|
33
|
+
missingKeyExtractor:
|
|
34
|
+
"FlashList requires a keyExtractor prop to be defined when animating elements. Without it, the animations will not run as expected.",
|
|
35
|
+
estimatedItemSizeMissingWarning:
|
|
36
|
+
"estimatedItemSize FlashList prop is not defined - based on current configuration you can set it to @size to optimize list performance. " +
|
|
37
|
+
"Refer to FlashList documentation for more details.",
|
|
38
|
+
};
|
|
39
|
+
export default WarningList;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
26
|
+
import type { ViewProps, HostComponent } from "react-native";
|
|
27
|
+
import type {
|
|
28
|
+
Int32,
|
|
29
|
+
Double,
|
|
30
|
+
DirectEventHandler,
|
|
31
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
32
|
+
|
|
33
|
+
export type BlankAreaEvent = Readonly<{
|
|
34
|
+
offsetStart: Int32;
|
|
35
|
+
offsetEnd: Int32;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
38
|
+
export type onBlankAreaEvent = DirectEventHandler<BlankAreaEvent>;
|
|
39
|
+
|
|
40
|
+
interface NativeProps extends ViewProps {
|
|
41
|
+
horizontal?: boolean;
|
|
42
|
+
scrollOffset?: Double;
|
|
43
|
+
windowSize?: Double;
|
|
44
|
+
renderAheadOffset?: Double;
|
|
45
|
+
enableInstrumentation?: boolean;
|
|
46
|
+
disableAutoLayout?: boolean;
|
|
47
|
+
onBlankAreaEvent?: DirectEventHandler<BlankAreaEvent>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default codegenNativeComponent<NativeProps>(
|
|
51
|
+
"AutoLayoutView"
|
|
52
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
26
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
27
|
+
import type { ViewProps, HostComponent } from "react-native";
|
|
28
|
+
|
|
29
|
+
interface NativeProps extends ViewProps {
|
|
30
|
+
index?: Int32;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default codegenNativeComponent<NativeProps>(
|
|
34
|
+
"CellContainer"
|
|
35
|
+
) as HostComponent<NativeProps>;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { default as FlashList } from "./FlashList";
|
|
26
|
+
export {
|
|
27
|
+
FlashListProps,
|
|
28
|
+
ContentStyle,
|
|
29
|
+
ListRenderItem,
|
|
30
|
+
ListRenderItemInfo,
|
|
31
|
+
RenderTarget,
|
|
32
|
+
RenderTargetOptions,
|
|
33
|
+
} from "./FlashListProps";
|
|
34
|
+
export { default as AnimatedFlashList } from "./AnimatedFlashList";
|
|
35
|
+
export {
|
|
36
|
+
useOnNativeBlankAreaEvents,
|
|
37
|
+
BlankAreaEventHandler,
|
|
38
|
+
BlankAreaEvent,
|
|
39
|
+
} from "./native/auto-layout/AutoLayoutView";
|
|
40
|
+
export {
|
|
41
|
+
useBenchmark,
|
|
42
|
+
BenchmarkParams,
|
|
43
|
+
BenchmarkResult,
|
|
44
|
+
} from "./benchmark/useBenchmark";
|
|
45
|
+
export { useDataMultiplier } from "./benchmark/useDataMultiplier";
|
|
46
|
+
export {
|
|
47
|
+
useFlatListBenchmark,
|
|
48
|
+
FlatListBenchmarkParams,
|
|
49
|
+
} from "./benchmark/useFlatListBenchmark";
|
|
50
|
+
export {
|
|
51
|
+
useBlankAreaTracker,
|
|
52
|
+
BlankAreaTrackerResult,
|
|
53
|
+
BlankAreaTrackerConfig,
|
|
54
|
+
} from "./benchmark/useBlankAreaTracker";
|
|
55
|
+
export {
|
|
56
|
+
MasonryFlashList,
|
|
57
|
+
MasonryFlashListProps,
|
|
58
|
+
MasonryFlashListScrollEvent,
|
|
59
|
+
MasonryFlashListRef,
|
|
60
|
+
MasonryListItem,
|
|
61
|
+
MasonryListRenderItem,
|
|
62
|
+
MasonryListRenderItemInfo,
|
|
63
|
+
} from "./MasonryFlashList";
|
|
64
|
+
export { JSFPSMonitor, JSFPSResult } from "./benchmark/JSFPSMonitor";
|
|
65
|
+
export { autoScroll, Cancellable } from "./benchmark/AutoScrollHelper";
|
|
66
|
+
export { default as ViewToken } from "./viewability/ViewToken";
|
|
67
|
+
export { default as CellContainer } from "./native/cell-container/CellContainer";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React, { useEffect, ReactNode } from "react";
|
|
26
|
+
import { LayoutChangeEvent } from "react-native";
|
|
27
|
+
|
|
28
|
+
import AutoLayoutViewNativeComponent from "./AutoLayoutViewNativeComponent";
|
|
29
|
+
import { OnBlankAreaEvent } from "./AutoLayoutViewNativeComponentProps";
|
|
30
|
+
|
|
31
|
+
export type BlankAreaEventHandler = (blankAreaEvent: BlankAreaEvent) => void;
|
|
32
|
+
const listeners: BlankAreaEventHandler[] = [];
|
|
33
|
+
|
|
34
|
+
export const useOnNativeBlankAreaEvents = (
|
|
35
|
+
onBlankAreaEvent: (blankAreaEvent: BlankAreaEvent) => void
|
|
36
|
+
) => {
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
listeners.push(onBlankAreaEvent);
|
|
39
|
+
return () => {
|
|
40
|
+
listeners.filter((callback) => callback !== onBlankAreaEvent);
|
|
41
|
+
};
|
|
42
|
+
}, [onBlankAreaEvent]);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export interface BlankAreaEvent {
|
|
46
|
+
offsetStart: number;
|
|
47
|
+
offsetEnd: number;
|
|
48
|
+
blankArea: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface AutoLayoutViewProps {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
onBlankAreaEvent?: BlankAreaEventHandler;
|
|
54
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
55
|
+
disableAutoLayout?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class AutoLayoutView extends React.Component<AutoLayoutViewProps> {
|
|
59
|
+
private onBlankAreaEventCallback = ({
|
|
60
|
+
nativeEvent,
|
|
61
|
+
}: OnBlankAreaEvent): void => {
|
|
62
|
+
const blankArea = Math.max(nativeEvent.offsetStart, nativeEvent.offsetEnd);
|
|
63
|
+
const blankEventValue = {
|
|
64
|
+
blankArea,
|
|
65
|
+
offsetStart: nativeEvent.offsetStart,
|
|
66
|
+
offsetEnd: nativeEvent.offsetEnd,
|
|
67
|
+
};
|
|
68
|
+
this.broadcastBlankEvent(blankEventValue);
|
|
69
|
+
if (this.props.onBlankAreaEvent) {
|
|
70
|
+
this.props.onBlankAreaEvent(blankEventValue);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
private broadcastBlankEvent(value: BlankAreaEvent) {
|
|
75
|
+
const len = listeners.length;
|
|
76
|
+
for (let i = 0; i < len; i++) {
|
|
77
|
+
listeners[i](value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
return (
|
|
83
|
+
<AutoLayoutViewNativeComponent
|
|
84
|
+
{...this.props}
|
|
85
|
+
onBlankAreaEvent={this.onBlankAreaEventCallback}
|
|
86
|
+
enableInstrumentation={
|
|
87
|
+
listeners.length !== 0 || Boolean(this.props.onBlankAreaEvent)
|
|
88
|
+
}
|
|
89
|
+
disableAutoLayout={this.props.disableAutoLayout}
|
|
90
|
+
>
|
|
91
|
+
{this.props.children}
|
|
92
|
+
</AutoLayoutViewNativeComponent>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default AutoLayoutView;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { requireNativeComponent } from "react-native";
|
|
26
|
+
|
|
27
|
+
import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
|
|
28
|
+
|
|
29
|
+
const AutoLayoutViewNativeComponent =
|
|
30
|
+
requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
|
|
31
|
+
export default AutoLayoutViewNativeComponent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { requireNativeComponent } from "react-native";
|
|
26
|
+
|
|
27
|
+
import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
|
|
28
|
+
|
|
29
|
+
const AutoLayoutViewNativeComponent =
|
|
30
|
+
requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
|
|
31
|
+
export default AutoLayoutViewNativeComponent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { requireNativeComponent } from "react-native";
|
|
26
|
+
|
|
27
|
+
import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
|
|
28
|
+
|
|
29
|
+
const AutoLayoutViewNativeComponent =
|
|
30
|
+
requireNativeComponent<AutoLayoutViewNativeComponentProps>("AutoLayoutView");
|
|
31
|
+
export default AutoLayoutViewNativeComponent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { HostComponent, View } from "react-native";
|
|
26
|
+
|
|
27
|
+
import { AutoLayoutViewNativeComponentProps } from "./AutoLayoutViewNativeComponentProps";
|
|
28
|
+
|
|
29
|
+
const AutoLayoutViewNativeComponent =
|
|
30
|
+
View as any as HostComponent<AutoLayoutViewNativeComponentProps>;
|
|
31
|
+
export default AutoLayoutViewNativeComponent;
|