react-native-nitro-list 0.0.1 → 0.1.2
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 +250 -16
- package/android/build.gradle +5 -4
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerView.kt +26 -0
- package/android/src/main/java/com/nitrolist/HybridNitroRecyclerViewManager.kt +29 -0
- package/android/src/main/java/com/nitrolist/NitroListPackage.kt +13 -24
- package/android/src/main/java/com/nitrolist/NitroRecyclerAdapter.kt +32 -0
- package/android/src/main/java/com/nitrolist/NitroRecyclerViewHolder.kt +8 -0
- package/ios/HybridNitroList.swift +28 -15
- package/lib/commonjs/NitroList.js +9 -0
- package/lib/commonjs/NitroList.js.map +1 -0
- package/lib/commonjs/ReusableView.js +2 -0
- package/lib/commonjs/ReusableView.js.map +1 -0
- package/lib/commonjs/cell/Cell.js +2 -0
- package/lib/{module/specs/nitro-list.nitro.js.map → commonjs/cell/Cell.js.map} +1 -1
- package/lib/commonjs/cell/CellKeyGenerator.js +21 -0
- package/lib/commonjs/cell/CellKeyGenerator.js.map +1 -0
- package/lib/commonjs/cell/CellRecycler.js +70 -0
- package/lib/commonjs/cell/CellRecycler.js.map +1 -0
- package/lib/commonjs/cell/createCell.js +21 -0
- package/lib/commonjs/cell/createCell.js.map +1 -0
- package/lib/commonjs/cell/index.js +20 -0
- package/lib/commonjs/cell/index.js.map +1 -0
- package/lib/commonjs/debug/useDebugOverlay.js +15 -0
- package/lib/commonjs/debug/useDebugOverlay.js.map +1 -0
- package/lib/commonjs/getVisibleIndices.js +38 -0
- package/lib/commonjs/getVisibleIndices.js.map +1 -0
- package/lib/commonjs/hooks/usePersistentCallback.js +36 -0
- package/lib/commonjs/hooks/usePersistentCallback.js.map +1 -0
- package/lib/commonjs/index.js +7 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/MutableLinearLayout.js +104 -0
- package/lib/commonjs/layout/MutableLinearLayout.js.map +1 -0
- package/lib/commonjs/layout/constants/layoutDefaults.js +19 -0
- package/lib/commonjs/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/commonjs/layout/index.js +2 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js.map → layout/index.js.map} +1 -1
- package/lib/commonjs/measurement/MeasureLayout.js +20 -0
- package/lib/commonjs/measurement/MeasureLayout.js.map +1 -0
- package/lib/commonjs/measurement/useItemMeasurement.js +28 -0
- package/lib/commonjs/measurement/useItemMeasurement.js.map +1 -0
- package/lib/commonjs/native/NitroLayoutEngine.js +9 -0
- package/lib/commonjs/native/NitroLayoutEngine.js.map +1 -0
- package/lib/commonjs/{specs/nitro-list.nitro.js → native/NitroList.types.js} +1 -1
- package/lib/commonjs/native/NitroList.types.js.map +1 -0
- package/lib/commonjs/native/NitroRecyclerView.js +9 -0
- package/lib/commonjs/native/NitroRecyclerView.js.map +1 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js +39 -0
- package/lib/commonjs/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/commonjs/recycler/CellPool.js +46 -0
- package/lib/commonjs/recycler/CellPool.js.map +1 -0
- package/lib/commonjs/recycler/RecyclerList.js +224 -0
- package/lib/commonjs/recycler/RecyclerList.js.map +1 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js +6 -0
- package/lib/commonjs/specs/nitro-layout-engine.nitro.js.map +1 -0
- package/lib/commonjs/types/Axis.js +2 -0
- package/lib/commonjs/types/Axis.js.map +1 -0
- package/lib/commonjs/types/CellKey.js +2 -0
- package/lib/commonjs/types/CellKey.js.map +1 -0
- package/lib/commonjs/types/CellType.js +2 -0
- package/lib/commonjs/types/CellType.js.map +1 -0
- package/lib/commonjs/types/VisibleRange.js +2 -0
- package/lib/commonjs/types/VisibleRange.js.map +1 -0
- package/lib/commonjs/types/VisibleRangeInput.js +6 -0
- package/lib/commonjs/types/VisibleRangeInput.js.map +1 -0
- package/lib/commonjs/types/index.js +13 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/layout/LayoutRect.js +2 -0
- package/lib/commonjs/types/layout/LayoutRect.js.map +1 -0
- package/lib/commonjs/types/layout/LinearLayoutInput.js +6 -0
- package/lib/commonjs/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js +26 -0
- package/lib/commonjs/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/commonjs/types/layout/index.js +2 -0
- package/lib/commonjs/types/layout/index.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerCellInstance.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerCellInstance.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/commonjs/types/recycler/RecyclerListProps.js +6 -0
- package/lib/commonjs/types/recycler/RecyclerListProps.js.map +1 -0
- package/lib/commonjs/types/recycler/index.js +2 -0
- package/lib/commonjs/types/recycler/index.js.map +1 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js +6 -0
- package/lib/commonjs/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/types/scroll/index.js +2 -0
- package/lib/commonjs/types/scroll/index.js.map +1 -0
- package/lib/commonjs/utils/arrayEqual.js +15 -0
- package/lib/commonjs/utils/arrayEqual.js.map +1 -0
- package/lib/commonjs/utils/assertNever.js +10 -0
- package/lib/commonjs/utils/assertNever.js.map +1 -0
- package/lib/commonjs/utils/clamp.js +10 -0
- package/lib/commonjs/utils/clamp.js.map +1 -0
- package/lib/commonjs/utils/devAssert.js +12 -0
- package/lib/commonjs/utils/devAssert.js.map +1 -0
- package/lib/commonjs/utils/invariant.js +12 -0
- package/lib/commonjs/utils/invariant.js.map +1 -0
- package/lib/commonjs/utils/isDefined.js +10 -0
- package/lib/commonjs/utils/isDefined.js.map +1 -0
- package/lib/commonjs/utils/isNumber.js +10 -0
- package/lib/commonjs/utils/isNumber.js.map +1 -0
- package/lib/commonjs/utils/noop.js +10 -0
- package/lib/commonjs/utils/noop.js.map +1 -0
- package/lib/commonjs/utils/shallowEqual.js +22 -0
- package/lib/commonjs/utils/shallowEqual.js.map +1 -0
- package/lib/commonjs/utils/throttle.js +17 -0
- package/lib/commonjs/utils/throttle.js.map +1 -0
- package/lib/commonjs/windowing/ScrollMetrics.js +2 -0
- package/lib/commonjs/windowing/ScrollMetrics.js.map +1 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js +71 -0
- package/lib/commonjs/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/commonjs/windowing/index.js +20 -0
- package/lib/commonjs/windowing/index.js.map +1 -0
- package/lib/commonjs/windowing/useScrollMetrics.js +39 -0
- package/lib/commonjs/windowing/useScrollMetrics.js.map +1 -0
- package/lib/module/NitroList.js +5 -0
- package/lib/module/NitroList.js.map +1 -0
- package/lib/module/ReusableView.js +2 -0
- package/lib/module/ReusableView.js.map +1 -0
- package/lib/module/cell/Cell.js +2 -0
- package/lib/module/cell/Cell.js.map +1 -0
- package/lib/module/cell/CellKeyGenerator.js +16 -0
- package/lib/module/cell/CellKeyGenerator.js.map +1 -0
- package/lib/module/cell/CellRecycler.js +66 -0
- package/lib/module/cell/CellRecycler.js.map +1 -0
- package/lib/module/cell/createCell.js +17 -0
- package/lib/module/cell/createCell.js.map +1 -0
- package/lib/module/cell/index.js +7 -0
- package/lib/module/cell/index.js.map +1 -0
- package/lib/module/debug/useDebugOverlay.js +11 -0
- package/lib/module/debug/useDebugOverlay.js.map +1 -0
- package/lib/module/getVisibleIndices.js +34 -0
- package/lib/module/getVisibleIndices.js.map +1 -0
- package/lib/module/hooks/usePersistentCallback.js +33 -0
- package/lib/module/hooks/usePersistentCallback.js.map +1 -0
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/MutableLinearLayout.js +100 -0
- package/lib/module/layout/MutableLinearLayout.js.map +1 -0
- package/lib/module/layout/constants/layoutDefaults.js +15 -0
- package/lib/module/layout/constants/layoutDefaults.js.map +1 -0
- package/lib/module/layout/index.js +2 -0
- package/lib/module/layout/index.js.map +1 -0
- package/lib/module/measurement/MeasureLayout.js +16 -0
- package/lib/module/measurement/MeasureLayout.js.map +1 -0
- package/lib/module/measurement/useItemMeasurement.js +24 -0
- package/lib/module/measurement/useItemMeasurement.js.map +1 -0
- package/lib/module/native/NitroLayoutEngine.js +5 -0
- package/lib/module/native/NitroLayoutEngine.js.map +1 -0
- package/lib/module/native/NitroList.types.js +4 -0
- package/lib/module/native/NitroList.types.js.map +1 -0
- package/lib/module/native/NitroRecyclerView.js +5 -0
- package/lib/module/native/NitroRecyclerView.js.map +1 -0
- package/lib/module/prefetch/PrefetchHelper.js +34 -0
- package/lib/module/prefetch/PrefetchHelper.js.map +1 -0
- package/lib/module/recycler/CellPool.js +41 -0
- package/lib/module/recycler/CellPool.js.map +1 -0
- package/lib/module/recycler/RecyclerList.js +221 -0
- package/lib/module/recycler/RecyclerList.js.map +1 -0
- package/lib/module/specs/nitro-layout-engine.nitro.js +4 -0
- package/lib/module/specs/nitro-layout-engine.nitro.js.map +1 -0
- package/lib/module/types/Axis.js +2 -0
- package/lib/module/types/Axis.js.map +1 -0
- package/lib/module/types/CellKey.js +2 -0
- package/lib/module/types/CellKey.js.map +1 -0
- package/lib/module/types/CellType.js +2 -0
- package/lib/module/types/CellType.js.map +1 -0
- package/lib/module/types/VisibleRange.js +2 -0
- package/lib/module/types/VisibleRange.js.map +1 -0
- package/lib/module/types/VisibleRangeInput.js +4 -0
- package/lib/module/types/VisibleRangeInput.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/layout/LayoutRect.js +2 -0
- package/lib/module/types/layout/LayoutRect.js.map +1 -0
- package/lib/module/types/layout/LinearLayoutInput.js +4 -0
- package/lib/module/types/layout/LinearLayoutInput.js.map +1 -0
- package/lib/module/types/layout/MainAxisPadding.js +22 -0
- package/lib/module/types/layout/MainAxisPadding.js.map +1 -0
- package/lib/module/types/layout/index.js +2 -0
- package/lib/module/types/layout/index.js.map +1 -0
- package/lib/module/types/recycler/RecyclerCellInstance.js +4 -0
- package/lib/module/types/recycler/RecyclerCellInstance.js.map +1 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js +4 -0
- package/lib/module/types/recycler/RecyclerItemRenderer.js.map +1 -0
- package/lib/module/types/recycler/RecyclerListProps.js +4 -0
- package/lib/module/types/recycler/RecyclerListProps.js.map +1 -0
- package/lib/module/types/recycler/index.js +2 -0
- package/lib/module/types/recycler/index.js.map +1 -0
- package/lib/module/types/scroll/ScrollMetrics.js +4 -0
- package/lib/module/types/scroll/ScrollMetrics.js.map +1 -0
- package/lib/module/types/scroll/index.js +2 -0
- package/lib/module/types/scroll/index.js.map +1 -0
- package/lib/module/utils/arrayEqual.js +11 -0
- package/lib/module/utils/arrayEqual.js.map +1 -0
- package/lib/module/utils/assertNever.js +6 -0
- package/lib/module/utils/assertNever.js.map +1 -0
- package/lib/module/utils/clamp.js +6 -0
- package/lib/module/utils/clamp.js.map +1 -0
- package/lib/module/utils/devAssert.js +8 -0
- package/lib/module/utils/devAssert.js.map +1 -0
- package/lib/module/utils/invariant.js +8 -0
- package/lib/module/utils/invariant.js.map +1 -0
- package/lib/module/utils/isDefined.js +6 -0
- package/lib/module/utils/isDefined.js.map +1 -0
- package/lib/module/utils/isNumber.js +6 -0
- package/lib/module/utils/isNumber.js.map +1 -0
- package/lib/module/utils/noop.js +6 -0
- package/lib/module/utils/noop.js.map +1 -0
- package/lib/module/utils/shallowEqual.js +18 -0
- package/lib/module/utils/shallowEqual.js.map +1 -0
- package/lib/module/utils/throttle.js +13 -0
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/windowing/ScrollMetrics.js +2 -0
- package/lib/module/windowing/ScrollMetrics.js.map +1 -0
- package/lib/module/windowing/computeVisibleItemRange.js +67 -0
- package/lib/module/windowing/computeVisibleItemRange.js.map +1 -0
- package/lib/module/windowing/index.js +5 -0
- package/lib/module/windowing/index.js.map +1 -0
- package/lib/module/windowing/useScrollMetrics.js +35 -0
- package/lib/module/windowing/useScrollMetrics.js.map +1 -0
- package/lib/typescript/src/NitroList.d.ts +5 -0
- package/lib/typescript/src/NitroList.d.ts.map +1 -0
- package/lib/typescript/src/ReusableView.d.ts +9 -0
- package/lib/typescript/src/ReusableView.d.ts.map +1 -0
- package/lib/typescript/src/cell/Cell.d.ts +22 -0
- package/lib/typescript/src/cell/Cell.d.ts.map +1 -0
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts +11 -0
- package/lib/typescript/src/cell/CellKeyGenerator.d.ts.map +1 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts +27 -0
- package/lib/typescript/src/cell/CellRecycler.d.ts.map +1 -0
- package/lib/typescript/src/cell/createCell.d.ts +7 -0
- package/lib/typescript/src/cell/createCell.d.ts.map +1 -0
- package/lib/typescript/src/cell/index.d.ts +4 -0
- package/lib/typescript/src/cell/index.d.ts.map +1 -0
- package/lib/typescript/src/debug/useDebugOverlay.d.ts +2 -0
- package/lib/typescript/src/debug/useDebugOverlay.d.ts.map +1 -0
- package/lib/typescript/src/getVisibleIndices.d.ts +8 -0
- package/lib/typescript/src/getVisibleIndices.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts +16 -0
- package/lib/typescript/src/hooks/usePersistentCallback.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts +54 -0
- package/lib/typescript/src/layout/MutableLinearLayout.d.ts.map +1 -0
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts +13 -0
- package/lib/typescript/src/layout/constants/layoutDefaults.d.ts.map +1 -0
- package/lib/typescript/src/layout/index.d.ts +2 -0
- package/lib/typescript/src/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts +10 -0
- package/lib/typescript/src/measurement/MeasureLayout.d.ts.map +1 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts +11 -0
- package/lib/typescript/src/measurement/useItemMeasurement.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts +3 -0
- package/lib/typescript/src/native/NitroLayoutEngine.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroList.types.d.ts +9 -0
- package/lib/typescript/src/native/NitroList.types.d.ts.map +1 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts +5 -0
- package/lib/typescript/src/native/NitroRecyclerView.d.ts.map +1 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts +17 -0
- package/lib/typescript/src/prefetch/PrefetchHelper.d.ts.map +1 -0
- package/lib/typescript/src/recycler/CellPool.d.ts +14 -0
- package/lib/typescript/src/recycler/CellPool.d.ts.map +1 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts +4 -0
- package/lib/typescript/src/recycler/RecyclerList.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts +14 -0
- package/lib/typescript/src/specs/nitro-layout-engine.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types/Axis.d.ts +11 -0
- package/lib/typescript/src/types/Axis.d.ts.map +1 -0
- package/lib/typescript/src/types/CellKey.d.ts +10 -0
- package/lib/typescript/src/types/CellKey.d.ts.map +1 -0
- package/lib/typescript/src/types/CellType.d.ts +11 -0
- package/lib/typescript/src/types/CellType.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRange.d.ts +10 -0
- package/lib/typescript/src/types/VisibleRange.d.ts.map +1 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts +35 -0
- package/lib/typescript/src/types/VisibleRangeInput.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +8 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts +15 -0
- package/lib/typescript/src/types/layout/LayoutRect.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts +10 -0
- package/lib/typescript/src/types/layout/LinearLayoutInput.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts +20 -0
- package/lib/typescript/src/types/layout/MainAxisPadding.d.ts.map +1 -0
- package/lib/typescript/src/types/layout/index.d.ts +4 -0
- package/lib/typescript/src/types/layout/index.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerCellInstance.d.ts +37 -0
- package/lib/typescript/src/types/recycler/RecyclerCellInstance.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts +8 -0
- package/lib/typescript/src/types/recycler/RecyclerItemRenderer.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.d.ts +66 -0
- package/lib/typescript/src/types/recycler/RecyclerListProps.d.ts.map +1 -0
- package/lib/typescript/src/types/recycler/index.d.ts +4 -0
- package/lib/typescript/src/types/recycler/index.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts +15 -0
- package/lib/typescript/src/types/scroll/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/types/scroll/index.d.ts +2 -0
- package/lib/typescript/src/types/scroll/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/arrayEqual.d.ts +2 -0
- package/lib/typescript/src/utils/arrayEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/assertNever.d.ts +2 -0
- package/lib/typescript/src/utils/assertNever.d.ts.map +1 -0
- package/lib/typescript/src/utils/clamp.d.ts +2 -0
- package/lib/typescript/src/utils/clamp.d.ts.map +1 -0
- package/lib/typescript/src/utils/devAssert.d.ts +2 -0
- package/lib/typescript/src/utils/devAssert.d.ts.map +1 -0
- package/lib/typescript/src/utils/invariant.d.ts +2 -0
- package/lib/typescript/src/utils/invariant.d.ts.map +1 -0
- package/lib/typescript/src/utils/isDefined.d.ts +2 -0
- package/lib/typescript/src/utils/isDefined.d.ts.map +1 -0
- package/lib/typescript/src/utils/isNumber.d.ts +2 -0
- package/lib/typescript/src/utils/isNumber.d.ts.map +1 -0
- package/lib/typescript/src/utils/noop.d.ts +2 -0
- package/lib/typescript/src/utils/noop.d.ts.map +1 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts +2 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts +11 -0
- package/lib/typescript/src/windowing/ScrollMetrics.d.ts.map +1 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts +15 -0
- package/lib/typescript/src/windowing/computeVisibleItemRange.d.ts.map +1 -0
- package/lib/typescript/src/windowing/index.d.ts +4 -0
- package/lib/typescript/src/windowing/index.d.ts.map +1 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts +14 -0
- package/lib/typescript/src/windowing/useScrollMetrics.d.ts.map +1 -0
- package/nitro.json +20 -13
- package/nitrogen/generated/android/NitroList+autolinking.cmake +2 -4
- package/nitrogen/generated/android/NitroListOnLoad.cpp +3 -13
- package/nitrogen/generated/android/c++/JHybridNitroLayoutEngineSpec.cpp +69 -0
- package/nitrogen/generated/android/c++/{JHybridNitroListSpec.hpp → JHybridNitroLayoutEngineSpec.hpp} +12 -13
- package/nitrogen/generated/android/c++/JLayoutRect.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/{HybridNitroListSpec.kt → HybridNitroLayoutEngineSpec.kt} +11 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/LayoutRect.kt +47 -0
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.cpp +9 -9
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Bridge.hpp +50 -13
- package/nitrogen/generated/ios/NitroList-Swift-Cxx-Umbrella.hpp +11 -5
- package/nitrogen/generated/ios/c++/{HybridNitroListSpecSwift.cpp → HybridNitroLayoutEngineSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/HybridNitroLayoutEngineSpecSwift.hpp +78 -0
- package/nitrogen/generated/ios/swift/HybridNitroLayoutEngineSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridNitroListSpec_cxx.swift → HybridNitroLayoutEngineSpec_cxx.swift} +35 -38
- package/nitrogen/generated/ios/swift/LayoutRect.swift +45 -0
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.cpp → HybridNitroLayoutEngineSpec.cpp} +4 -5
- package/nitrogen/generated/shared/c++/{HybridNitroListSpec.hpp → HybridNitroLayoutEngineSpec.hpp} +15 -14
- package/nitrogen/generated/shared/c++/LayoutRect.hpp +95 -0
- package/package.json +12 -4
- package/src/NitroList.ts +8 -0
- package/src/ReusableView.ts +12 -0
- package/src/cell/Cell.ts +23 -0
- package/src/cell/CellKeyGenerator.ts +17 -0
- package/src/cell/CellRecycler.ts +76 -0
- package/src/cell/createCell.ts +15 -0
- package/src/cell/index.ts +5 -0
- package/src/debug/useDebugOverlay.ts +14 -0
- package/src/getVisibleIndices.ts +55 -0
- package/src/hooks/usePersistentCallback.ts +37 -0
- package/src/index.ts +1 -14
- package/src/layout/MutableLinearLayout.ts +112 -0
- package/src/layout/constants/layoutDefaults.ts +12 -0
- package/src/layout/index.ts +1 -0
- package/src/measurement/MeasureLayout.ts +20 -0
- package/src/measurement/useItemMeasurement.ts +32 -0
- package/src/native/NitroLayoutEngine.ts +7 -0
- package/src/native/NitroList.types.ts +13 -0
- package/src/native/NitroRecyclerView.ts +8 -0
- package/src/prefetch/PrefetchHelper.ts +47 -0
- package/src/recycler/CellPool.ts +47 -0
- package/src/recycler/RecyclerList.tsx +304 -0
- package/src/specs/nitro-layout-engine.nitro.ts +17 -0
- package/src/types/Axis.ts +10 -0
- package/src/types/CellKey.ts +9 -0
- package/src/types/CellType.ts +10 -0
- package/src/types/VisibleRange.ts +9 -0
- package/src/types/VisibleRangeInput.ts +39 -0
- package/src/types/index.ts +15 -0
- package/src/types/layout/LayoutRect.ts +14 -0
- package/src/types/layout/LinearLayoutInput.ts +12 -0
- package/src/types/layout/MainAxisPadding.ts +23 -0
- package/src/types/layout/index.ts +3 -0
- package/src/types/recycler/RecyclerCellInstance.ts +40 -0
- package/src/types/recycler/RecyclerItemRenderer.ts +8 -0
- package/src/types/recycler/RecyclerListProps.ts +74 -0
- package/src/types/recycler/index.ts +3 -0
- package/src/types/scroll/ScrollMetrics.ts +18 -0
- package/src/types/scroll/index.ts +1 -0
- package/src/utils/arrayEqual.ts +13 -0
- package/src/utils/assertNever.ts +3 -0
- package/src/utils/clamp.ts +7 -0
- package/src/utils/devAssert.ts +8 -0
- package/src/utils/invariant.ts +8 -0
- package/src/utils/isDefined.ts +5 -0
- package/src/utils/isNumber.ts +3 -0
- package/src/utils/noop.ts +3 -0
- package/src/utils/shallowEqual.ts +34 -0
- package/src/utils/throttle.ts +13 -0
- package/src/windowing/ScrollMetrics.ts +11 -0
- package/src/windowing/computeVisibleItemRange.ts +78 -0
- package/src/windowing/index.ts +3 -0
- package/src/windowing/useScrollMetrics.ts +56 -0
- package/android/src/main/java/com/nitrolist/HybridNitroList.kt +0 -27
- package/lib/module/specs/nitro-list.nitro.js +0 -4
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts +0 -11
- package/lib/typescript/src/specs/nitro-list.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridNitroListSpec.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.cpp +0 -56
- package/nitrogen/generated/android/c++/views/JHybridNitroListStateUpdater.hpp +0 -49
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListManager.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrolist/views/HybridNitroListStateUpdater.kt +0 -23
- package/nitrogen/generated/ios/NitroListAutolinking.mm +0 -33
- package/nitrogen/generated/ios/NitroListAutolinking.swift +0 -25
- package/nitrogen/generated/ios/c++/HybridNitroListSpecSwift.hpp +0 -74
- package/nitrogen/generated/ios/c++/views/HybridNitroListComponent.mm +0 -96
- package/nitrogen/generated/ios/swift/HybridNitroListSpec.swift +0 -56
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.cpp +0 -88
- package/nitrogen/generated/shared/c++/views/HybridNitroListComponent.hpp +0 -107
- package/nitrogen/generated/shared/json/NitroListConfig.json +0 -10
- package/src/specs/nitro-list.nitro.ts +0 -13
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.computeVisibleItemRange = computeVisibleItemRange;
|
|
7
|
+
/**
|
|
8
|
+
* Computes the visible item index range using binary search.
|
|
9
|
+
*
|
|
10
|
+
* Responsibilities:
|
|
11
|
+
* - Determine which items intersect the visible window
|
|
12
|
+
* - Stay independent of rendering and recycling
|
|
13
|
+
*
|
|
14
|
+
* Performance:
|
|
15
|
+
* - O(log n) to locate the first visible item
|
|
16
|
+
* - O(k) to expand to the last visible item (k = visible count)
|
|
17
|
+
*/
|
|
18
|
+
function computeVisibleItemRange(input) {
|
|
19
|
+
const {
|
|
20
|
+
layouts,
|
|
21
|
+
offset,
|
|
22
|
+
viewportSize,
|
|
23
|
+
buffer,
|
|
24
|
+
isVertical
|
|
25
|
+
} = input;
|
|
26
|
+
const itemCount = layouts.length;
|
|
27
|
+
if (itemCount === 0) return null;
|
|
28
|
+
const windowStart = Math.max(0, offset - buffer);
|
|
29
|
+
const windowEnd = offset + viewportSize + buffer;
|
|
30
|
+
|
|
31
|
+
// --------------------------------------------------
|
|
32
|
+
// Binary search:
|
|
33
|
+
// First item whose END >= windowStart
|
|
34
|
+
// --------------------------------------------------
|
|
35
|
+
let low = 0;
|
|
36
|
+
let high = itemCount - 1;
|
|
37
|
+
let firstVisibleIndex = itemCount;
|
|
38
|
+
while (low <= high) {
|
|
39
|
+
const mid = low + high >>> 1;
|
|
40
|
+
const rect = layouts[mid];
|
|
41
|
+
const start = isVertical ? rect.y : rect.x;
|
|
42
|
+
const size = isVertical ? rect.height : rect.width;
|
|
43
|
+
const end = start + size;
|
|
44
|
+
if (end >= windowStart) {
|
|
45
|
+
firstVisibleIndex = mid;
|
|
46
|
+
high = mid - 1;
|
|
47
|
+
} else {
|
|
48
|
+
low = mid + 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (firstVisibleIndex === itemCount) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// --------------------------------------------------
|
|
56
|
+
// Linear scan forward:
|
|
57
|
+
// Last item whose START <= windowEnd
|
|
58
|
+
// --------------------------------------------------
|
|
59
|
+
let lastVisibleIndex = firstVisibleIndex;
|
|
60
|
+
for (let i = firstVisibleIndex + 1; i < itemCount; i++) {
|
|
61
|
+
const rect = layouts[i];
|
|
62
|
+
const start = isVertical ? rect.y : rect.x;
|
|
63
|
+
if (start > windowEnd) break;
|
|
64
|
+
lastVisibleIndex = i;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
startIndex: firstVisibleIndex,
|
|
68
|
+
endIndex: lastVisibleIndex
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=computeVisibleItemRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computeVisibleItemRange","input","layouts","offset","viewportSize","buffer","isVertical","itemCount","length","windowStart","Math","max","windowEnd","low","high","firstVisibleIndex","mid","rect","start","y","x","size","height","width","end","lastVisibleIndex","i","startIndex","endIndex"],"sourceRoot":"../../../src","sources":["windowing/computeVisibleItemRange.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,uBAAuBA,CACrCC,KAAwB,EACH;EACrB,MAAM;IACJC,OAAO;IACPC,MAAM;IACNC,YAAY;IACZC,MAAM;IACNC;EACF,CAAC,GAAGL,KAAK;EAET,MAAMM,SAAS,GAAGL,OAAO,CAACM,MAAM;EAChC,IAAID,SAAS,KAAK,CAAC,EAAE,OAAO,IAAI;EAEhC,MAAME,WAAW,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAER,MAAM,GAAGE,MAAM,CAAC;EAChD,MAAMO,SAAS,GAAGT,MAAM,GAAGC,YAAY,GAAGC,MAAM;;EAEhD;EACA;EACA;EACA;EACA,IAAIQ,GAAG,GAAG,CAAC;EACX,IAAIC,IAAI,GAAGP,SAAS,GAAG,CAAC;EACxB,IAAIQ,iBAAiB,GAAGR,SAAS;EAEjC,OAAOM,GAAG,IAAIC,IAAI,EAAE;IAClB,MAAME,GAAG,GAAIH,GAAG,GAAGC,IAAI,KAAM,CAAC;IAC9B,MAAMG,IAAI,GAAGf,OAAO,CAACc,GAAG,CAAE;IAE1B,MAAME,KAAK,GAAGZ,UAAU,GAAGW,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACG,CAAC;IAC1C,MAAMC,IAAI,GAAGf,UAAU,GAAGW,IAAI,CAACK,MAAM,GAAGL,IAAI,CAACM,KAAK;IAClD,MAAMC,GAAG,GAAGN,KAAK,GAAGG,IAAI;IAExB,IAAIG,GAAG,IAAIf,WAAW,EAAE;MACtBM,iBAAiB,GAAGC,GAAG;MACvBF,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM;MACLH,GAAG,GAAGG,GAAG,GAAG,CAAC;IACf;EACF;EAEA,IAAID,iBAAiB,KAAKR,SAAS,EAAE;IACnC,OAAO,IAAI;EACb;;EAEA;EACA;EACA;EACA;EACA,IAAIkB,gBAAgB,GAAGV,iBAAiB;EAExC,KAAK,IAAIW,CAAC,GAAGX,iBAAiB,GAAG,CAAC,EAAEW,CAAC,GAAGnB,SAAS,EAAEmB,CAAC,EAAE,EAAE;IACtD,MAAMT,IAAI,GAAGf,OAAO,CAACwB,CAAC,CAAE;IACxB,MAAMR,KAAK,GAAGZ,UAAU,GAAGW,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACG,CAAC;IAE1C,IAAIF,KAAK,GAAGN,SAAS,EAAE;IACvBa,gBAAgB,GAAGC,CAAC;EACtB;EAEA,OAAO;IACLC,UAAU,EAAEZ,iBAAiB;IAC7Ba,QAAQ,EAAEH;EACZ,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "computeVisibleItemRange", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _computeVisibleItemRange.computeVisibleItemRange;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useScrollMetrics", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useScrollMetrics.useScrollMetrics;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _useScrollMetrics = require("./useScrollMetrics");
|
|
19
|
+
var _computeVisibleItemRange = require("./computeVisibleItemRange");
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_useScrollMetrics","require","_computeVisibleItemRange"],"sourceRoot":"../../../src","sources":["windowing/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useScrollMetrics = useScrollMetrics;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Scroll metrics hook.
|
|
10
|
+
* Provides stable scroll snapshot + handlers.
|
|
11
|
+
*
|
|
12
|
+
* FlashList equivalent: useScrollMetrics
|
|
13
|
+
*/
|
|
14
|
+
function useScrollMetrics() {
|
|
15
|
+
const [metrics, setMetrics] = (0, _react.useState)({
|
|
16
|
+
offsetY: 0,
|
|
17
|
+
height: 0
|
|
18
|
+
});
|
|
19
|
+
const onScroll = (0, _react.useCallback)(e => {
|
|
20
|
+
const offsetY = e.nativeEvent.contentOffset.y;
|
|
21
|
+
setMetrics(prev => prev.offsetY === offsetY ? prev : {
|
|
22
|
+
...prev,
|
|
23
|
+
offsetY
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
const onLayout = (0, _react.useCallback)(e => {
|
|
27
|
+
const height = e.nativeEvent.layout.height;
|
|
28
|
+
setMetrics(prev => prev.height === height ? prev : {
|
|
29
|
+
...prev,
|
|
30
|
+
height
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
return {
|
|
34
|
+
metrics,
|
|
35
|
+
onScroll,
|
|
36
|
+
onLayout
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=useScrollMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","useScrollMetrics","metrics","setMetrics","useState","offsetY","height","onScroll","useCallback","e","nativeEvent","contentOffset","y","prev","onLayout","layout"],"sourceRoot":"../../../src","sources":["windowing/useScrollMetrics.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAI9B;EACA,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAgB;IACpDC,OAAO,EAAE,CAAC;IACVC,MAAM,EAAE;EACV,CAAC,CAAC;EAEF,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EACzBC,CAA0C,IAAK;IAC9C,MAAMJ,OAAO,GAAGI,CAAC,CAACC,WAAW,CAACC,aAAa,CAACC,CAAC;IAE7CT,UAAU,CAACU,IAAI,IACbA,IAAI,CAACR,OAAO,KAAKA,OAAO,GACpBQ,IAAI,GACJ;MAAE,GAAGA,IAAI;MAAER;IAAQ,CACzB,CAAC;EACH,CAAC,EACD,EACF,CAAC;EAED,MAAMS,QAAQ,GAAG,IAAAN,kBAAW,EACzBC,CAAoB,IAAK;IACxB,MAAMH,MAAM,GAAGG,CAAC,CAACC,WAAW,CAACK,MAAM,CAACT,MAAM;IAE1CH,UAAU,CAACU,IAAI,IACbA,IAAI,CAACP,MAAM,KAAKA,MAAM,GAClBO,IAAI,GACJ;MAAE,GAAGA,IAAI;MAAEP;IAAO,CACxB,CAAC;EACH,CAAC,EACD,EACF,CAAC;EAED,OAAO;IACLJ,OAAO;IACPK,QAAQ;IACRO;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","NitroRecyclerView"],"sourceRoot":"../../src","sources":["NitroList.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAc;AAMrD,OAAO,MAAMC,iBAAiB,GAC5BD,sBAAsB,CAAyB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["ReusableView.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["cell/Cell.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Monotonic key generator for physical cell instances.
|
|
5
|
+
* Guarantees stable keys across the lifetime of the list.
|
|
6
|
+
*/
|
|
7
|
+
export class CellKeyGenerator {
|
|
8
|
+
nextId = 0;
|
|
9
|
+
next() {
|
|
10
|
+
return this.nextId++;
|
|
11
|
+
}
|
|
12
|
+
reset() {
|
|
13
|
+
this.nextId = 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CellKeyGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellKeyGenerator","nextId","next","reset"],"sourceRoot":"../../../src","sources":["cell/CellKeyGenerator.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EACpBC,MAAM,GAAG,CAAC;EAElBC,IAAIA,CAAA,EAAY;IACd,OAAO,IAAI,CAACD,MAAM,EAAE;EACtB;EAEAE,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACF,MAAM,GAAG,CAAC;EACjB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createCell } from './createCell';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Manages physical cell reuse.
|
|
7
|
+
* Imperative and stateful by design.
|
|
8
|
+
* This is NOT React code.
|
|
9
|
+
*/
|
|
10
|
+
export class CellRecycler {
|
|
11
|
+
/**
|
|
12
|
+
* Active cells mapped by logical index.
|
|
13
|
+
*/
|
|
14
|
+
indexToCell = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pool of detached reusable cells.
|
|
18
|
+
*/
|
|
19
|
+
recycledCells = [];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reconcile a contiguous visible index range
|
|
23
|
+
* into a stable list of physical cells.
|
|
24
|
+
*
|
|
25
|
+
* HOT PATH:
|
|
26
|
+
* - No index arrays
|
|
27
|
+
* - Minimal allocations
|
|
28
|
+
* - Deterministic
|
|
29
|
+
*/
|
|
30
|
+
reconcileRange(startIndex, endIndex, resolveCellType) {
|
|
31
|
+
const nextActive = [];
|
|
32
|
+
|
|
33
|
+
// Track which current indices are no longer visible
|
|
34
|
+
const unusedIndices = new Set(this.indexToCell.keys());
|
|
35
|
+
for (let index = startIndex; index <= endIndex; index++) {
|
|
36
|
+
unusedIndices.delete(index);
|
|
37
|
+
let cell = this.indexToCell.get(index);
|
|
38
|
+
if (cell) {
|
|
39
|
+
// Existing assignment — reuse
|
|
40
|
+
nextActive.push(cell);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const type = resolveCellType(index);
|
|
44
|
+
|
|
45
|
+
// Try to reuse a recycled cell of same type
|
|
46
|
+
const recycledIdx = this.recycledCells.findIndex(c => c.type === type);
|
|
47
|
+
if (recycledIdx !== -1) {
|
|
48
|
+
cell = this.recycledCells.splice(recycledIdx, 1)[0];
|
|
49
|
+
} else {
|
|
50
|
+
cell = createCell(type);
|
|
51
|
+
}
|
|
52
|
+
cell.index = index;
|
|
53
|
+
this.indexToCell.set(index, cell);
|
|
54
|
+
nextActive.push(cell);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Recycle cells that left the visible window
|
|
58
|
+
for (const index of unusedIndices) {
|
|
59
|
+
const cell = this.indexToCell.get(index);
|
|
60
|
+
this.indexToCell.delete(index);
|
|
61
|
+
this.recycledCells.push(cell);
|
|
62
|
+
}
|
|
63
|
+
return nextActive;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=CellRecycler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createCell","CellRecycler","indexToCell","Map","recycledCells","reconcileRange","startIndex","endIndex","resolveCellType","nextActive","unusedIndices","Set","keys","index","delete","cell","get","push","type","recycledIdx","findIndex","c","splice","set"],"sourceRoot":"../../../src","sources":["cell/CellRecycler.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EACxB;AACF;AACA;EACmBC,WAAW,GAAG,IAAIC,GAAG,CAAe,CAAC;;EAEtD;AACF;AACA;EACmBC,aAAa,GAAW,EAAE;;EAE3C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,cAAcA,CACZC,UAAkB,EAClBC,QAAgB,EAChBC,eAA0C,EACzB;IACjB,MAAMC,UAAkB,GAAG,EAAE;;IAE7B;IACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAC,IAAI,CAACT,WAAW,CAACU,IAAI,CAAC,CAAC,CAAC;IAEtD,KAAK,IAAIC,KAAK,GAAGP,UAAU,EAAEO,KAAK,IAAIN,QAAQ,EAAEM,KAAK,EAAE,EAAE;MACvDH,aAAa,CAACI,MAAM,CAACD,KAAK,CAAC;MAE3B,IAAIE,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAC;MACtC,IAAIE,IAAI,EAAE;QACR;QACAN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;QACrB;MACF;MAEA,MAAMG,IAAI,GAAGV,eAAe,CAACK,KAAK,CAAC;;MAEnC;MACA,MAAMM,WAAW,GAAG,IAAI,CAACf,aAAa,CAACgB,SAAS,CAC9CC,CAAC,IAAIA,CAAC,CAACH,IAAI,KAAKA,IAClB,CAAC;MAED,IAAIC,WAAW,KAAK,CAAC,CAAC,EAAE;QACtBJ,IAAI,GAAG,IAAI,CAACX,aAAa,CAACkB,MAAM,CAACH,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE;MACtD,CAAC,MAAM;QACLJ,IAAI,GAAGf,UAAU,CAACkB,IAAI,CAAC;MACzB;MAEAH,IAAI,CAACF,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACX,WAAW,CAACqB,GAAG,CAACV,KAAK,EAAEE,IAAI,CAAC;MACjCN,UAAU,CAACQ,IAAI,CAACF,IAAI,CAAC;IACvB;;IAEA;IACA,KAAK,MAAMF,KAAK,IAAIH,aAAa,EAAE;MACjC,MAAMK,IAAI,GAAG,IAAI,CAACb,WAAW,CAACc,GAAG,CAACH,KAAK,CAAE;MACzC,IAAI,CAACX,WAAW,CAACY,MAAM,CAACD,KAAK,CAAC;MAC9B,IAAI,CAACT,aAAa,CAACa,IAAI,CAACF,IAAI,CAAC;IAC/B;IAEA,OAAON,UAAU;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
let nextCellId = 0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new physical cell with a stable identity.
|
|
7
|
+
* The key is generated ONCE and never changes.
|
|
8
|
+
*/
|
|
9
|
+
export function createCell(type) {
|
|
10
|
+
return {
|
|
11
|
+
key: `cell-${nextCellId++}`,
|
|
12
|
+
// stable physical identity
|
|
13
|
+
type,
|
|
14
|
+
index: -1 // assigned by recycler
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=createCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["nextCellId","createCell","type","key","index"],"sourceRoot":"../../../src","sources":["cell/createCell.ts"],"mappings":";;AAEA,IAAIA,UAAU,GAAG,CAAC;;AAElB;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,IAAY,EAAQ;EAC7C,OAAO;IACLC,GAAG,EAAE,QAAQH,UAAU,EAAE,EAAE;IAAE;IAC7BE,IAAI;IACJE,KAAK,EAAE,CAAC,CAAC,CAAmB;EAC9B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CellRecycler","createCell"],"sourceRoot":"../../../src","sources":["cell/index.ts"],"mappings":";;AAAA;;AAGA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,UAAU,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
export function useDebugOverlay(enabled, visibleCount) {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (__DEV__ && enabled) {
|
|
7
|
+
console.log(`[RecyclerList] visible items: ${visibleCount}`);
|
|
8
|
+
}
|
|
9
|
+
}, [enabled, visibleCount]);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=useDebugOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useDebugOverlay","enabled","visibleCount","__DEV__","console","log"],"sourceRoot":"../../../src","sources":["debug/useDebugOverlay.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,OAAO,SAASC,eAAeA,CAC7BC,OAAgB,EAChBC,YAAoB,EACd;EACNH,SAAS,CAAC,MAAM;IACd,IAAII,OAAO,IAAIF,OAAO,EAAE;MACtBG,OAAO,CAACC,GAAG,CACT,iCAAiCH,YAAY,EAC/C,CAAC;IACH;EACF,CAAC,EAAE,CAACD,OAAO,EAAEC,YAAY,CAAC,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Binary-search based windowing.
|
|
5
|
+
* Returns indices intersecting viewport ± buffer.
|
|
6
|
+
*/
|
|
7
|
+
export function getVisibleRange(layouts, metrics, bufferPx) {
|
|
8
|
+
if (layouts.length === 0 || metrics.height <= 0) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const startY = Math.max(0, metrics.offsetY - bufferPx);
|
|
12
|
+
const endY = metrics.offsetY + metrics.height + bufferPx;
|
|
13
|
+
let low = 0;
|
|
14
|
+
let high = layouts.length - 1;
|
|
15
|
+
let first = layouts.length;
|
|
16
|
+
while (low <= high) {
|
|
17
|
+
const mid = low + high >> 1;
|
|
18
|
+
const rect = layouts[mid];
|
|
19
|
+
if (rect.y + rect.height >= startY) {
|
|
20
|
+
first = mid;
|
|
21
|
+
high = mid - 1;
|
|
22
|
+
} else {
|
|
23
|
+
low = mid + 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const visible = [];
|
|
27
|
+
for (let i = first; i < layouts.length; i++) {
|
|
28
|
+
const rect = layouts[i];
|
|
29
|
+
if (rect.y > endY) break;
|
|
30
|
+
visible.push(i);
|
|
31
|
+
}
|
|
32
|
+
return visible;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=getVisibleIndices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getVisibleRange","layouts","metrics","bufferPx","length","height","startY","Math","max","offsetY","endY","low","high","first","mid","rect","y","visible","i","push"],"sourceRoot":"../../src","sources":["getVisibleIndices.ts"],"mappings":";;AAKA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAC7BC,OAA8B,EAC9BC,OAAsB,EACtBC,QAAgB,EACG;EACnB,IACEF,OAAO,CAACG,MAAM,KAAK,CAAC,IACpBF,OAAO,CAACG,MAAM,IAAI,CAAC,EACnB;IACA,OAAO,EAAE;EACX;EAEA,MAAMC,MAAM,GAAGC,IAAI,CAACC,GAAG,CACrB,CAAC,EACDN,OAAO,CAACO,OAAO,GAAGN,QACpB,CAAC;EAED,MAAMO,IAAI,GACRR,OAAO,CAACO,OAAO,GAAGP,OAAO,CAACG,MAAM,GAAGF,QAAQ;EAE7C,IAAIQ,GAAG,GAAG,CAAC;EACX,IAAIC,IAAI,GAAGX,OAAO,CAACG,MAAM,GAAG,CAAC;EAC7B,IAAIS,KAAK,GAAGZ,OAAO,CAACG,MAAM;EAE1B,OAAOO,GAAG,IAAIC,IAAI,EAAE;IAClB,MAAME,GAAG,GAAIH,GAAG,GAAGC,IAAI,IAAK,CAAC;IAC7B,MAAMG,IAAI,GAAGd,OAAO,CAACa,GAAG,CAAE;IAE1B,IAAIC,IAAI,CAACC,CAAC,GAAGD,IAAI,CAACV,MAAM,IAAIC,MAAM,EAAE;MAClCO,KAAK,GAAGC,GAAG;MACXF,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM;MACLH,GAAG,GAAGG,GAAG,GAAG,CAAC;IACf;EACF;EAEA,MAAMG,OAAiB,GAAG,EAAE;EAE5B,KAAK,IAAIC,CAAC,GAAGL,KAAK,EAAEK,CAAC,GAAGjB,OAAO,CAACG,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC3C,MAAMH,IAAI,GAAGd,OAAO,CAACiB,CAAC,CAAE;IACxB,IAAIH,IAAI,CAACC,CAAC,GAAGN,IAAI,EAAE;IACnBO,OAAO,CAACE,IAAI,CAACD,CAAC,CAAC;EACjB;EAEA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a function whose identity is stable across renders,
|
|
7
|
+
* but always invokes the latest provided implementation.
|
|
8
|
+
*
|
|
9
|
+
* Invariants:
|
|
10
|
+
* - Function reference NEVER changes
|
|
11
|
+
* - Logic is ALWAYS up to date
|
|
12
|
+
*
|
|
13
|
+
* This is critical for long-lived systems such as:
|
|
14
|
+
* - Recyclers
|
|
15
|
+
* - Effects
|
|
16
|
+
* - Native bridges
|
|
17
|
+
* - Event pipelines
|
|
18
|
+
*/
|
|
19
|
+
export function usePersistentCallback(fn) {
|
|
20
|
+
/**
|
|
21
|
+
* Holds the latest implementation.
|
|
22
|
+
* Updating this does NOT trigger re-renders.
|
|
23
|
+
*/
|
|
24
|
+
const fnRef = useRef(fn);
|
|
25
|
+
fnRef.current = fn;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Stable wrapper that forwards calls
|
|
29
|
+
* to the latest implementation.
|
|
30
|
+
*/
|
|
31
|
+
return useCallback((...args) => fnRef.current(...args), []);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=usePersistentCallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useCallback","usePersistentCallback","fn","fnRef","current","args"],"sourceRoot":"../../../src","sources":["hooks/usePersistentCallback.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,WAAW,QAAQ,OAAO;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAEnCC,EAAK,EAAK;EAEV;AACF;AACA;AACA;EACE,MAAMC,KAAK,GAAGJ,MAAM,CAACG,EAAE,CAAC;EACxBC,KAAK,CAACC,OAAO,GAAGF,EAAE;;EAElB;AACF;AACA;AACA;EACE,OAAOF,WAAW,CACf,CAAC,GAAGK,IAAa,KAChBF,KAAK,CAACC,OAAO,CAAC,GAAGC,IAAI,CAAC,EACxB,EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import NitroListConfig from '../nitrogen/generated/shared/json/NitroListConfig.json';
|
|
5
|
-
export const NitroList = getHostComponent('NitroList', () => NitroListConfig);
|
|
3
|
+
export { RecyclerList } from './recycler/RecyclerList';
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["RecyclerList"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DEFAULT_ITEM_SPACING } from './constants/layoutDefaults';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mutable, deterministic linear layout engine.
|
|
7
|
+
*
|
|
8
|
+
* Responsibilities:
|
|
9
|
+
* - Compute absolute item geometry
|
|
10
|
+
* - Own layout truth (no React, no scroll state)
|
|
11
|
+
* - Guarantee monotonic ordering along the main axis
|
|
12
|
+
*
|
|
13
|
+
* Cross-platform equivalents:
|
|
14
|
+
* - Flutter: RenderSliver / SliverList
|
|
15
|
+
* - Android: LinearLayoutManager
|
|
16
|
+
* - iOS: UICollectionViewFlowLayout (linear)
|
|
17
|
+
*/
|
|
18
|
+
export class MutableLinearLayout {
|
|
19
|
+
/** Absolute item layouts in index order */
|
|
20
|
+
layouts = [];
|
|
21
|
+
|
|
22
|
+
/** Total scrollable size along main axis */
|
|
23
|
+
contentSize = 0;
|
|
24
|
+
constructor(axis) {
|
|
25
|
+
this.isVertical = axis === 'vertical';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Computes layout synchronously from input.
|
|
30
|
+
*
|
|
31
|
+
* This method is intentionally parameter-object based
|
|
32
|
+
* to allow future extension without breaking API.
|
|
33
|
+
*
|
|
34
|
+
* Invariants:
|
|
35
|
+
* - Layouts are monotonic along main axis
|
|
36
|
+
* - No gaps except explicit spacing
|
|
37
|
+
* - Deterministic for identical inputs
|
|
38
|
+
*/
|
|
39
|
+
compute(input) {
|
|
40
|
+
const {
|
|
41
|
+
crossAxisSize,
|
|
42
|
+
itemMainAxisSizes,
|
|
43
|
+
padding,
|
|
44
|
+
itemSpacing = DEFAULT_ITEM_SPACING
|
|
45
|
+
} = input;
|
|
46
|
+
const itemCount = itemMainAxisSizes.length;
|
|
47
|
+
const layouts = new Array(itemCount);
|
|
48
|
+
let cursor = padding.start;
|
|
49
|
+
for (let i = 0; i < itemCount; i++) {
|
|
50
|
+
const mainAxisSize = itemMainAxisSizes[i];
|
|
51
|
+
layouts[i] = this.isVertical ? {
|
|
52
|
+
x: 0,
|
|
53
|
+
y: cursor,
|
|
54
|
+
width: crossAxisSize,
|
|
55
|
+
height: mainAxisSize
|
|
56
|
+
} : {
|
|
57
|
+
x: cursor,
|
|
58
|
+
y: 0,
|
|
59
|
+
width: mainAxisSize,
|
|
60
|
+
height: crossAxisSize
|
|
61
|
+
};
|
|
62
|
+
cursor += mainAxisSize;
|
|
63
|
+
|
|
64
|
+
// Space BETWEEN items, not after the last
|
|
65
|
+
if (i < itemCount - 1) {
|
|
66
|
+
cursor += itemSpacing;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this.layouts = layouts;
|
|
70
|
+
this.contentSize = cursor + padding.end;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns computed item layouts.
|
|
75
|
+
*
|
|
76
|
+
* Order is guaranteed monotonic along the main axis,
|
|
77
|
+
* which is required for binary-search-based windowing.
|
|
78
|
+
*/
|
|
79
|
+
getLayouts() {
|
|
80
|
+
return this.layouts;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns total scrollable size along the main axis,
|
|
85
|
+
* including padding and inter-item spacing.
|
|
86
|
+
*/
|
|
87
|
+
getContentSize() {
|
|
88
|
+
return this.contentSize;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Clears internal layout state.
|
|
93
|
+
* Call on severe invalidation or teardown.
|
|
94
|
+
*/
|
|
95
|
+
reset() {
|
|
96
|
+
this.layouts = [];
|
|
97
|
+
this.contentSize = 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=MutableLinearLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_ITEM_SPACING","MutableLinearLayout","layouts","contentSize","constructor","axis","isVertical","compute","input","crossAxisSize","itemMainAxisSizes","padding","itemSpacing","itemCount","length","Array","cursor","start","i","mainAxisSize","x","y","width","height","end","getLayouts","getContentSize","reset"],"sourceRoot":"../../../src","sources":["layout/MutableLinearLayout.ts"],"mappings":";;AAIA,SAASA,oBAAoB,QAAQ,4BAA4B;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAC;EAG/B;EACQC,OAAO,GAAiB,EAAE;;EAElC;EACQC,WAAW,GAAG,CAAC;EAEvBC,WAAWA,CAACC,IAAU,EAAE;IACtB,IAAI,CAACC,UAAU,GAAGD,IAAI,KAAK,UAAU;EACvC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,OAAOA,CAACC,KAAwB,EAAQ;IACtC,MAAM;MACJC,aAAa;MACbC,iBAAiB;MACjBC,OAAO;MACPC,WAAW,GAAGZ;IAChB,CAAC,GAAGQ,KAAK;IAET,MAAMK,SAAS,GAAGH,iBAAiB,CAACI,MAAM;IAC1C,MAAMZ,OAAqB,GAAG,IAAIa,KAAK,CAACF,SAAS,CAAC;IAElD,IAAIG,MAAM,GAAGL,OAAO,CAACM,KAAK;IAE1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,SAAS,EAAEK,CAAC,EAAE,EAAE;MAClC,MAAMC,YAAY,GAAGT,iBAAiB,CAACQ,CAAC,CAAE;MAE1ChB,OAAO,CAACgB,CAAC,CAAC,GAAG,IAAI,CAACZ,UAAU,GACxB;QACEc,CAAC,EAAE,CAAC;QACJC,CAAC,EAAEL,MAAM;QACTM,KAAK,EAAEb,aAAa;QACpBc,MAAM,EAAEJ;MACV,CAAC,GACD;QACEC,CAAC,EAAEJ,MAAM;QACTK,CAAC,EAAE,CAAC;QACJC,KAAK,EAAEH,YAAY;QACnBI,MAAM,EAAEd;MACV,CAAC;MAELO,MAAM,IAAIG,YAAY;;MAEtB;MACA,IAAID,CAAC,GAAGL,SAAS,GAAG,CAAC,EAAE;QACrBG,MAAM,IAAIJ,WAAW;MACvB;IACF;IAEA,IAAI,CAACV,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,WAAW,GAAGa,MAAM,GAAGL,OAAO,CAACa,GAAG;EACzC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,UAAUA,CAAA,EAA0B;IAClC,OAAO,IAAI,CAACvB,OAAO;EACrB;;EAEA;AACF;AACA;AACA;EACEwB,cAAcA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACvB,WAAW;EACzB;;EAEA;AACF;AACA;AACA;EACEwB,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACzB,OAAO,GAAG,EAAE;IACjB,IAAI,CAACC,WAAW,GAAG,CAAC;EACtB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default spacing between items along the main axis.
|
|
5
|
+
*
|
|
6
|
+
* This value is used by layout engines when no explicit
|
|
7
|
+
* itemSpacing is provided.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors:
|
|
10
|
+
* - Android RecyclerView ItemDecoration (typical 8–16dp)
|
|
11
|
+
* - iOS UICollectionViewFlowLayout minimumLineSpacing
|
|
12
|
+
* - Flutter SliverList spacing conventions
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_ITEM_SPACING = 12;
|
|
15
|
+
//# sourceMappingURL=layoutDefaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_ITEM_SPACING"],"sourceRoot":"../../../../src","sources":["layout/constants/layoutDefaults.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAG,EAAE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["layout/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extracts stable layout measurements from RN onLayout event.
|
|
5
|
+
*/
|
|
6
|
+
export function measureLayout(event) {
|
|
7
|
+
const {
|
|
8
|
+
width,
|
|
9
|
+
height
|
|
10
|
+
} = event.nativeEvent.layout;
|
|
11
|
+
return {
|
|
12
|
+
width,
|
|
13
|
+
height
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=MeasureLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["measureLayout","event","width","height","nativeEvent","layout"],"sourceRoot":"../../../src","sources":["measurement/MeasureLayout.ts"],"mappings":";;AAOA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAC3BC,KAAwB,EACR;EAChB,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGF,KAAK,CAACG,WAAW,CAACC,MAAM;EAElD,OAAO;IACLH,KAAK;IACLC;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Hook to measure a rendered item safely.
|
|
6
|
+
*
|
|
7
|
+
* Guarantees:
|
|
8
|
+
* - No duplicate height reports
|
|
9
|
+
* - No render loops
|
|
10
|
+
* - Stable callback identity
|
|
11
|
+
*/
|
|
12
|
+
export function useItemMeasurement(index, onMeasured) {
|
|
13
|
+
const lastHeightRef = useRef(null);
|
|
14
|
+
const onLayout = useCallback(e => {
|
|
15
|
+
const height = e.nativeEvent.layout.height;
|
|
16
|
+
|
|
17
|
+
// Ignore identical measurements
|
|
18
|
+
if (lastHeightRef.current === height) return;
|
|
19
|
+
lastHeightRef.current = height;
|
|
20
|
+
onMeasured(index, height);
|
|
21
|
+
}, [index, onMeasured]);
|
|
22
|
+
return onLayout;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=useItemMeasurement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useItemMeasurement","index","onMeasured","lastHeightRef","onLayout","e","height","nativeEvent","layout","current"],"sourceRoot":"../../../src","sources":["measurement/useItemMeasurement.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAG3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCC,KAAa,EACbC,UAAmD,EACnD;EACA,MAAMC,aAAa,GAAGJ,MAAM,CAAgB,IAAI,CAAC;EAEjD,MAAMK,QAAQ,GAAGN,WAAW,CACzBO,CAAoB,IAAK;IACxB,MAAMC,MAAM,GAAGD,CAAC,CAACE,WAAW,CAACC,MAAM,CAACF,MAAM;;IAE1C;IACA,IAAIH,aAAa,CAACM,OAAO,KAAKH,MAAM,EAAE;IAEtCH,aAAa,CAACM,OAAO,GAAGH,MAAM;IAC9BJ,UAAU,CAACD,KAAK,EAAEK,MAAM,CAAC;EAC3B,CAAC,EACD,CAACL,KAAK,EAAEC,UAAU,CACpB,CAAC;EAED,OAAOE,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","NitroLayoutEngine","createHybridObject"],"sourceRoot":"../../../src","sources":["native/NitroLayoutEngine.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,iBAAiB,GAC5BD,YAAY,CAACE,kBAAkB,CAC7B,mBACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["native/NitroList.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","NitroRecyclerView"],"sourceRoot":"../../../src","sources":["native/NitroRecyclerView.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAc;AAMrD,OAAO,MAAMC,iBAAiB,GAC5BD,sBAAsB,CAAyB,mBAAmB,CAAC","ignoreList":[]}
|