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,39 @@
|
|
|
1
|
+
import type { LayoutRect } from './layout/LayoutRect'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Input required to compute the visible item range.
|
|
5
|
+
*
|
|
6
|
+
* Pure contract:
|
|
7
|
+
* - No logic
|
|
8
|
+
* - No platform assumptions
|
|
9
|
+
* - Safe to share with native / tests
|
|
10
|
+
*/
|
|
11
|
+
export interface VisibleRangeInput {
|
|
12
|
+
/**
|
|
13
|
+
* Ordered, monotonic layouts along the main axis.
|
|
14
|
+
* Required for binary search correctness.
|
|
15
|
+
*/
|
|
16
|
+
readonly layouts: readonly LayoutRect[]
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Scroll offset along the main axis.
|
|
20
|
+
*/
|
|
21
|
+
readonly offset: number
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Viewport size along the main axis.
|
|
25
|
+
*/
|
|
26
|
+
readonly viewportSize: number
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Extra buffer before and after the viewport.
|
|
30
|
+
*/
|
|
31
|
+
readonly buffer: number
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Axis selector.
|
|
35
|
+
* true → vertical
|
|
36
|
+
* false → horizontal
|
|
37
|
+
*/
|
|
38
|
+
readonly isVertical: boolean
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { Axis } from './Axis'
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
MainAxisPadding,
|
|
5
|
+
} from './layout/MainAxisPadding'
|
|
6
|
+
export {
|
|
7
|
+
ZERO_MAIN_AXIS_PADDING,
|
|
8
|
+
} from './layout/MainAxisPadding'
|
|
9
|
+
|
|
10
|
+
export type { LayoutRect } from './layout/LayoutRect'
|
|
11
|
+
export type { VisibleRange } from './VisibleRange'
|
|
12
|
+
export type { CellKey } from './CellKey'
|
|
13
|
+
export type { CellType } from './CellType'
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute layout rectangle.
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform equivalent of:
|
|
5
|
+
* - Flutter: Rect
|
|
6
|
+
* - Android: Rect
|
|
7
|
+
* - iOS: CGRect
|
|
8
|
+
*/
|
|
9
|
+
export interface LayoutRect {
|
|
10
|
+
readonly x: number
|
|
11
|
+
readonly y: number
|
|
12
|
+
readonly width: number
|
|
13
|
+
readonly height: number
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MainAxisPadding } from './MainAxisPadding'
|
|
2
|
+
|
|
3
|
+
export interface LinearLayoutInput {
|
|
4
|
+
readonly crossAxisSize: number
|
|
5
|
+
readonly itemMainAxisSizes: readonly number[]
|
|
6
|
+
|
|
7
|
+
/** Padding before/after content (main axis) */
|
|
8
|
+
readonly padding: MainAxisPadding
|
|
9
|
+
|
|
10
|
+
/** Space BETWEEN items (main axis) */
|
|
11
|
+
readonly itemSpacing?: number
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Padding applied along the main scroll axis.
|
|
3
|
+
*
|
|
4
|
+
* This is a layout-level concept (not visual styling).
|
|
5
|
+
*
|
|
6
|
+
* - vertical → top / bottom
|
|
7
|
+
* - horizontal → left / right
|
|
8
|
+
*
|
|
9
|
+
* Uses start/end to remain RTL-safe and platform-neutral.
|
|
10
|
+
*/
|
|
11
|
+
export interface MainAxisPadding {
|
|
12
|
+
readonly start: number
|
|
13
|
+
readonly end: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shared zero-padding constant.
|
|
18
|
+
* Safe to reuse across layouts.
|
|
19
|
+
*/
|
|
20
|
+
export const ZERO_MAIN_AXIS_PADDING: MainAxisPadding = {
|
|
21
|
+
start: 0,
|
|
22
|
+
end: 0,
|
|
23
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CellKey } from "../CellKey"
|
|
2
|
+
import type { CellType } from "../CellType"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Physical reusable cell instance.
|
|
7
|
+
*
|
|
8
|
+
* Represents a single mounted view that can be rebound
|
|
9
|
+
* to different data items as scrolling occurs.
|
|
10
|
+
*
|
|
11
|
+
* Cross-platform equivalent:
|
|
12
|
+
* - Flutter: Element / RenderObject
|
|
13
|
+
* - Android: ViewHolder
|
|
14
|
+
* - iOS: UICollectionViewCell
|
|
15
|
+
*/
|
|
16
|
+
export interface RecyclerCellInstance {
|
|
17
|
+
/**
|
|
18
|
+
* Stable physical identity.
|
|
19
|
+
*
|
|
20
|
+
* Used as React key.
|
|
21
|
+
* MUST remain constant for the lifetime of the instance.
|
|
22
|
+
*/
|
|
23
|
+
readonly key: CellKey
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Logical data index currently bound to this instance.
|
|
27
|
+
*
|
|
28
|
+
* This value changes as the cell is recycled.
|
|
29
|
+
* - -1 may be used to indicate "unbound".
|
|
30
|
+
*/
|
|
31
|
+
index: number
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Logical compatibility type.
|
|
35
|
+
*
|
|
36
|
+
* Determines which instances can be reused together.
|
|
37
|
+
* Instances with different types MUST NOT be reused.
|
|
38
|
+
*/
|
|
39
|
+
readonly type: CellType
|
|
40
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Axis } from '../Axis'
|
|
2
|
+
import type { CellType } from '../CellType'
|
|
3
|
+
import type { MainAxisPadding } from '../layout'
|
|
4
|
+
import type { RecyclerItemRenderer } from './RecyclerItemRenderer'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Public props for RecyclerList.
|
|
8
|
+
*
|
|
9
|
+
* Generic, data-driven, layout-deterministic API.
|
|
10
|
+
* This surface is intentionally minimal and stable.
|
|
11
|
+
*/
|
|
12
|
+
export interface RecyclerListProps<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Scroll direction.
|
|
15
|
+
* Defaults to 'vertical'.
|
|
16
|
+
*/
|
|
17
|
+
readonly scrollDirection?: Axis
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Cross-axis size.
|
|
21
|
+
* - vertical → width
|
|
22
|
+
* - horizontal → height
|
|
23
|
+
*
|
|
24
|
+
* Required for deterministic layout.
|
|
25
|
+
*/
|
|
26
|
+
readonly containerCrossAxisSize: number
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Data source.
|
|
30
|
+
* Length is the single source of truth for item count.
|
|
31
|
+
*/
|
|
32
|
+
readonly data: readonly T[]
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Item sizes along the main axis.
|
|
36
|
+
* Must match data length.
|
|
37
|
+
*
|
|
38
|
+
* - vertical → heights
|
|
39
|
+
* - horizontal → widths
|
|
40
|
+
*/
|
|
41
|
+
readonly itemMainAxisSizes: readonly number[]
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Padding before and after content along the main axis.
|
|
45
|
+
*
|
|
46
|
+
* Defaults are applied internally by the layout engine.
|
|
47
|
+
*/
|
|
48
|
+
readonly padding?: MainAxisPadding
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Space BETWEEN items along the main axis.
|
|
52
|
+
*
|
|
53
|
+
* Defaults are applied internally by the layout engine.
|
|
54
|
+
*/
|
|
55
|
+
readonly itemSpacing?: number
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Extra render buffer as a ratio of viewport size.
|
|
59
|
+
* Used for overscan / pre-rendering.
|
|
60
|
+
*/
|
|
61
|
+
readonly bufferRatio?: number
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Logical cell type resolver.
|
|
65
|
+
* Determines recycling compatibility.
|
|
66
|
+
*/
|
|
67
|
+
readonly getCellType: (item: T, index: number) => CellType
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Item renderer.
|
|
71
|
+
* Receives stable cell identity and data.
|
|
72
|
+
*/
|
|
73
|
+
readonly renderItem: RecyclerItemRenderer<T>
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Axis } from "../Axis"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scroll state snapshot.
|
|
6
|
+
*
|
|
7
|
+
* Pure data — no platform or React coupling.
|
|
8
|
+
*/
|
|
9
|
+
export interface ScrollMetrics {
|
|
10
|
+
/** Scroll axis */
|
|
11
|
+
readonly axis: Axis
|
|
12
|
+
|
|
13
|
+
/** Offset along the main axis */
|
|
14
|
+
readonly offset: number
|
|
15
|
+
|
|
16
|
+
/** Viewport size along the main axis */
|
|
17
|
+
readonly viewportSize: number
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ScrollMetrics } from './ScrollMetrics'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function arrayEqual<T>(
|
|
2
|
+
a: readonly T[],
|
|
3
|
+
b: readonly T[]
|
|
4
|
+
): boolean {
|
|
5
|
+
if (a === b) return true
|
|
6
|
+
if (a.length !== b.length) return false
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < a.length; i++) {
|
|
9
|
+
if (!Object.is(a[i], b[i])) return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function shallowEqual(
|
|
2
|
+
a: unknown,
|
|
3
|
+
b: unknown
|
|
4
|
+
): boolean {
|
|
5
|
+
if (Object.is(a, b)) return true
|
|
6
|
+
|
|
7
|
+
if (
|
|
8
|
+
typeof a !== 'object' ||
|
|
9
|
+
typeof b !== 'object' ||
|
|
10
|
+
a === null ||
|
|
11
|
+
b === null
|
|
12
|
+
) {
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const aKeys = Object.keys(a as object)
|
|
17
|
+
const bKeys = Object.keys(b as object)
|
|
18
|
+
|
|
19
|
+
if (aKeys.length !== bKeys.length) return false
|
|
20
|
+
|
|
21
|
+
for (const key of aKeys) {
|
|
22
|
+
if (
|
|
23
|
+
!(key in (b as object)) ||
|
|
24
|
+
!Object.is(
|
|
25
|
+
(a as Record<string, unknown>)[key],
|
|
26
|
+
(b as Record<string, unknown>)[key]
|
|
27
|
+
)
|
|
28
|
+
) {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return true
|
|
34
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { VisibleRange } from '../types/VisibleRange'
|
|
2
|
+
import type { VisibleRangeInput } from '../types/VisibleRangeInput'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Computes the visible item index range using binary search.
|
|
6
|
+
*
|
|
7
|
+
* Responsibilities:
|
|
8
|
+
* - Determine which items intersect the visible window
|
|
9
|
+
* - Stay independent of rendering and recycling
|
|
10
|
+
*
|
|
11
|
+
* Performance:
|
|
12
|
+
* - O(log n) to locate the first visible item
|
|
13
|
+
* - O(k) to expand to the last visible item (k = visible count)
|
|
14
|
+
*/
|
|
15
|
+
export function computeVisibleItemRange(
|
|
16
|
+
input: VisibleRangeInput
|
|
17
|
+
): VisibleRange | null {
|
|
18
|
+
const {
|
|
19
|
+
layouts,
|
|
20
|
+
offset,
|
|
21
|
+
viewportSize,
|
|
22
|
+
buffer,
|
|
23
|
+
isVertical,
|
|
24
|
+
} = input
|
|
25
|
+
|
|
26
|
+
const itemCount = layouts.length
|
|
27
|
+
if (itemCount === 0) return null
|
|
28
|
+
|
|
29
|
+
const windowStart = Math.max(0, offset - buffer)
|
|
30
|
+
const windowEnd = offset + viewportSize + buffer
|
|
31
|
+
|
|
32
|
+
// --------------------------------------------------
|
|
33
|
+
// Binary search:
|
|
34
|
+
// First item whose END >= windowStart
|
|
35
|
+
// --------------------------------------------------
|
|
36
|
+
let low = 0
|
|
37
|
+
let high = itemCount - 1
|
|
38
|
+
let firstVisibleIndex = itemCount
|
|
39
|
+
|
|
40
|
+
while (low <= high) {
|
|
41
|
+
const mid = (low + high) >>> 1
|
|
42
|
+
const rect = layouts[mid]!
|
|
43
|
+
|
|
44
|
+
const start = isVertical ? rect.y : rect.x
|
|
45
|
+
const size = isVertical ? rect.height : rect.width
|
|
46
|
+
const end = start + size
|
|
47
|
+
|
|
48
|
+
if (end >= windowStart) {
|
|
49
|
+
firstVisibleIndex = mid
|
|
50
|
+
high = mid - 1
|
|
51
|
+
} else {
|
|
52
|
+
low = mid + 1
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (firstVisibleIndex === itemCount) {
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --------------------------------------------------
|
|
61
|
+
// Linear scan forward:
|
|
62
|
+
// Last item whose START <= windowEnd
|
|
63
|
+
// --------------------------------------------------
|
|
64
|
+
let lastVisibleIndex = firstVisibleIndex
|
|
65
|
+
|
|
66
|
+
for (let i = firstVisibleIndex + 1; i < itemCount; i++) {
|
|
67
|
+
const rect = layouts[i]!
|
|
68
|
+
const start = isVertical ? rect.y : rect.x
|
|
69
|
+
|
|
70
|
+
if (start > windowEnd) break
|
|
71
|
+
lastVisibleIndex = i
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
startIndex: firstVisibleIndex,
|
|
76
|
+
endIndex: lastVisibleIndex,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react'
|
|
2
|
+
import type {
|
|
3
|
+
LayoutChangeEvent,
|
|
4
|
+
NativeScrollEvent,
|
|
5
|
+
NativeSyntheticEvent,
|
|
6
|
+
} from 'react-native'
|
|
7
|
+
import type { ScrollMetrics } from './ScrollMetrics'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Scroll metrics hook.
|
|
11
|
+
* Provides stable scroll snapshot + handlers.
|
|
12
|
+
*
|
|
13
|
+
* FlashList equivalent: useScrollMetrics
|
|
14
|
+
*/
|
|
15
|
+
export function useScrollMetrics(): {
|
|
16
|
+
metrics: ScrollMetrics
|
|
17
|
+
onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void
|
|
18
|
+
onLayout: (e: LayoutChangeEvent) => void
|
|
19
|
+
} {
|
|
20
|
+
const [metrics, setMetrics] = useState<ScrollMetrics>({
|
|
21
|
+
offsetY: 0,
|
|
22
|
+
height: 0,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const onScroll = useCallback(
|
|
26
|
+
(e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
27
|
+
const offsetY = e.nativeEvent.contentOffset.y
|
|
28
|
+
|
|
29
|
+
setMetrics(prev =>
|
|
30
|
+
prev.offsetY === offsetY
|
|
31
|
+
? prev
|
|
32
|
+
: { ...prev, offsetY }
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
[]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const onLayout = useCallback(
|
|
39
|
+
(e: LayoutChangeEvent) => {
|
|
40
|
+
const height = e.nativeEvent.layout.height
|
|
41
|
+
|
|
42
|
+
setMetrics(prev =>
|
|
43
|
+
prev.height === height
|
|
44
|
+
? prev
|
|
45
|
+
: { ...prev, height }
|
|
46
|
+
)
|
|
47
|
+
},
|
|
48
|
+
[]
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
metrics,
|
|
53
|
+
onScroll,
|
|
54
|
+
onLayout,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package com.nitrolist
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color
|
|
4
|
-
import android.view.View
|
|
5
|
-
import androidx.annotation.Keep
|
|
6
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
7
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
|
-
import com.margelo.nitro.nitrolist.HybridNitroListSpec
|
|
9
|
-
|
|
10
|
-
@Keep
|
|
11
|
-
@DoNotStrip
|
|
12
|
-
class HybridNitroList(val context: ThemedReactContext): HybridNitroListSpec() {
|
|
13
|
-
// View
|
|
14
|
-
override val view: View = View(context)
|
|
15
|
-
|
|
16
|
-
// Props
|
|
17
|
-
private var _isRed = false
|
|
18
|
-
override var isRed: Boolean
|
|
19
|
-
get() = _isRed
|
|
20
|
-
set(value) {
|
|
21
|
-
_isRed = value
|
|
22
|
-
view.setBackgroundColor(
|
|
23
|
-
if (value) Color.RED
|
|
24
|
-
else Color.BLACK
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HybridView, HybridViewProps, HybridViewMethods } from 'react-native-nitro-modules';
|
|
2
|
-
export interface NitroListProps extends HybridViewProps {
|
|
3
|
-
isRed: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface NitroListMethods extends HybridViewMethods {
|
|
6
|
-
}
|
|
7
|
-
export type NitroList = HybridView<NitroListProps, NitroListMethods, {
|
|
8
|
-
ios: 'swift';
|
|
9
|
-
android: 'kotlin';
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=nitro-list.nitro.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nitro-list.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/nitro-list.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,4BAA4B,CAAA;AAEnC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACpD,KAAK,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;CAAG;AAE9D,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,cAAc,EAAE,gBAAgB,EAAE;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridNitroListSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "JHybridNitroListSpec.hpp"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
namespace margelo::nitro::nitrolist {
|
|
15
|
-
|
|
16
|
-
jni::local_ref<JHybridNitroListSpec::jhybriddata> JHybridNitroListSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
17
|
-
return makeCxxInstance(jThis);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
void JHybridNitroListSpec::registerNatives() {
|
|
21
|
-
registerHybrid({
|
|
22
|
-
makeNativeMethod("initHybrid", JHybridNitroListSpec::initHybrid),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
size_t JHybridNitroListSpec::getExternalMemorySize() noexcept {
|
|
27
|
-
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
28
|
-
return method(_javaPart);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
void JHybridNitroListSpec::dispose() noexcept {
|
|
32
|
-
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
33
|
-
method(_javaPart);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
std::string JHybridNitroListSpec::toString() {
|
|
37
|
-
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
38
|
-
auto javaString = method(_javaPart);
|
|
39
|
-
return javaString->toStdString();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Properties
|
|
43
|
-
bool JHybridNitroListSpec::getIsRed() {
|
|
44
|
-
static const auto method = javaClassStatic()->getMethod<jboolean()>("isRed");
|
|
45
|
-
auto __result = method(_javaPart);
|
|
46
|
-
return static_cast<bool>(__result);
|
|
47
|
-
}
|
|
48
|
-
void JHybridNitroListSpec::setIsRed(bool isRed) {
|
|
49
|
-
static const auto method = javaClassStatic()->getMethod<void(jboolean /* isRed */)>("setRed");
|
|
50
|
-
method(_javaPart, isRed);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Methods
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} // namespace margelo::nitro::nitrolist
|