@onekeyfe/react-native-native-list 3.0.179-alpha.302 → 3.0.179-alpha.304

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +2 -0
  2. package/docs/SPEC.md +19 -0
  3. package/ios/HybridNativeList.swift +18 -0
  4. package/ios/RNCNativeListView.swift +87 -0
  5. package/lib/module/NativeList.js +24 -5
  6. package/lib/module/NativeList.web.js +2 -0
  7. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -0
  8. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  9. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  10. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
  11. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -0
  12. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  13. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  14. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
  15. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  16. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  17. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  18. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  19. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  20. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  21. package/lib/typescript/src/NativeList.types.d.ts +4 -0
  22. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -0
  23. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  24. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +12 -0
  26. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -0
  27. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  28. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  29. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +22 -0
  30. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  31. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  32. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  33. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  34. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  35. package/package.json +3 -3
  36. package/src/NativeList.nitro.ts +2 -0
  37. package/src/NativeList.tsx +25 -1
  38. package/src/NativeList.types.ts +4 -0
  39. package/src/NativeList.web.tsx +2 -0
@@ -52,6 +52,8 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
52
52
  snapshot?.let { hostView.applySnapshot(it) }
53
53
  }
54
54
  }
55
+ override var topScrollEdgeHard: Boolean = false
56
+ override var topOverlayHeight: Double = 0.0
55
57
 
56
58
  override var snapshotJson: String = ""
57
59
  get() = field
package/docs/SPEC.md CHANGED
@@ -26,6 +26,25 @@ prevention; there is no automatic fitting or shrinking pass.
26
26
 
27
27
  ## Public API and defaults
28
28
 
29
+ ### iOS 26 fixed top scroll-edge overlay
30
+
31
+ Standalone `NativeList` accepts optional `topScrollEdgeEffect="hard"` and
32
+ `topOverlay` React content. Both are disabled by default. On iOS 26 or newer,
33
+ the fixed overlay is a fourth native container slot, outside the row stream and
34
+ outside the existing scrolling `listHeader`/`listEmpty`/`listFooter` slots.
35
+ Fabric measures its height; the list owns an equal top inset on its collection
36
+ view and binds UIKit's `UIScrollEdgeElementContainerInteraction` to that view,
37
+ using the hard top edge style. The list restores its original inset and effect
38
+ on removal, disposal and reuse. The UI thread owns all view and UIKit state;
39
+ there is no persistence, background-runtime state or per-frame JS callback.
40
+ An invisible, noninteractive native label fills the overlay host so UIKit
41
+ recognizes React-drawn content as a scroll-edge element.
42
+ Inside a CollapsiblePagerView, the pager owns this effect and inset, and child
43
+ lists do not opt in separately. iOS before 26, Android and Web retain their
44
+ existing layout and scrolling. Missing overlay or style changes nothing.
45
+ Acceptance requires actual iOS 26 initial layout, long/short/empty scrolling,
46
+ refresh and overlay replacement/removal, including dark mode.
47
+
29
48
  [README.md](../README.md) documents the snapshot, patch, selection, events and
30
49
  imperative API; [STYLE_SPEC.md](STYLE_SPEC.md) defines normalization, omitted
31
50
  style defaults and platform differences. Height precedence is
@@ -43,6 +43,24 @@ final class HybridNativeList: HybridNativeListSpec {
43
43
  didSet { if fontFamiliesJson != oldValue { fontsChanged = true } }
44
44
  }
45
45
 
46
+ var topScrollEdgeHard = false {
47
+ didSet {
48
+ runOnMain { [weak self] in
49
+ self?.hostView?.setTopScrollEdge(hard: self?.topScrollEdgeHard ?? false,
50
+ overlayHeight: CGFloat(self?.topOverlayHeight ?? 0))
51
+ }
52
+ }
53
+ }
54
+
55
+ var topOverlayHeight: Double = 0 {
56
+ didSet {
57
+ runOnMain { [weak self] in
58
+ self?.hostView?.setTopScrollEdge(hard: self?.topScrollEdgeHard ?? false,
59
+ overlayHeight: CGFloat(self?.topOverlayHeight ?? 0))
60
+ }
61
+ }
62
+ }
63
+
46
64
  var snapshotJson: String = "" {
47
65
  didSet { if snapshotJson != oldValue { snapshotChanged = true } }
48
66
  }
@@ -31,11 +31,27 @@ final class NativeListView: UIView {
31
31
  // Each root therefore lives in a list-owned host whose origin the list alone controls, so a
32
32
  // React layout update can never move a slot out of its native position, even for a frame.
33
33
  private var reactContainerSlots: [(content: UIView, host: UIView)] = []
34
+ private let topOverlayHost = UIView()
35
+ private weak var topOverlayContent: UIView?
36
+ private var topEdgeInteraction: UIInteraction?
37
+ private var topEdgeMarker: UILabel?
38
+ private var originalTopEdgeStyle: AnyObject?
39
+ private var topScrollEdgeHard = false
40
+ private var requestedTopOverlayHeight: CGFloat = 0
41
+ private var appliedTopOverlayInset: CGFloat = 0
42
+
34
43
  private var lastLaidOutContentHeight: CGFloat?
35
44
  private var needsContentShrinkCorrection = false
36
45
  private var contentShrinkCorrectionScheduled = false
37
46
 
38
47
  @objc func mountContainerSlot(_ view: UIView, atIndex index: Int) {
48
+ if index == 3 {
49
+ topOverlayContent?.removeFromSuperview()
50
+ topOverlayContent = view
51
+ topOverlayHost.addSubview(view)
52
+ updateTopScrollEdge()
53
+ return
54
+ }
39
55
  let host = UIView()
40
56
  // Clipping to the reported height keeps new content from overlapping rows until the list
41
57
  // has reserved space for it.
@@ -48,6 +64,12 @@ final class NativeListView: UIView {
48
64
  }
49
65
 
50
66
  @objc func unmountContainerSlot(_ view: UIView) {
67
+ if topOverlayContent === view {
68
+ view.removeFromSuperview()
69
+ topOverlayContent = nil
70
+ updateTopScrollEdge()
71
+ return
72
+ }
51
73
  reactContainerSlots.removeAll { slot in
52
74
  guard slot.content === view else { return false }
53
75
  view.removeFromSuperview()
@@ -56,6 +78,66 @@ final class NativeListView: UIView {
56
78
  }
57
79
  }
58
80
 
81
+ func setTopScrollEdge(hard: Bool, overlayHeight: CGFloat) {
82
+ topScrollEdgeHard = hard
83
+ requestedTopOverlayHeight = overlayHeight.isFinite ? max(0, overlayHeight) : 0
84
+ updateTopScrollEdge()
85
+ setNeedsLayout()
86
+ }
87
+
88
+ private func updateTopScrollEdge() {
89
+ if #available(iOS 26.0, *) {
90
+ let hasOverlay = topScrollEdgeHard && topOverlayContent != nil
91
+ let enabled = hasOverlay && window != nil
92
+ let nextInset = hasOverlay ? requestedTopOverlayHeight : 0
93
+ if nextInset != appliedTopOverlayInset {
94
+ // Do not interrupt UIKit's rebound after a refresh has ended.
95
+ let wasReturningFromPull =
96
+ collectionView.contentOffset.y < -collectionView.adjustedContentInset.top - 0.5
97
+ let logicalOffset = collectionView.contentOffset.y + collectionView.contentInset.top
98
+ var inset = collectionView.contentInset
99
+ inset.top += nextInset - appliedTopOverlayInset
100
+ collectionView.contentInset = inset
101
+ appliedTopOverlayInset = nextInset
102
+ if !wasReturningFromPull {
103
+ collectionView.setContentOffset(
104
+ CGPoint(x: collectionView.contentOffset.x, y: logicalOffset - inset.top),
105
+ animated: false)
106
+ }
107
+ }
108
+ if enabled && topEdgeInteraction == nil {
109
+ originalTopEdgeStyle = collectionView.topEdgeEffect.style
110
+ // UIKit needs a native element to shape the edge effect around React-drawn content.
111
+ let marker = UILabel(frame: topOverlayHost.bounds)
112
+ marker.autoresizingMask = [.flexibleWidth, .flexibleHeight]
113
+ marker.text = " "
114
+ marker.textColor = .clear
115
+ marker.backgroundColor = .clear
116
+ marker.isUserInteractionEnabled = false
117
+ marker.isAccessibilityElement = false
118
+ marker.accessibilityElementsHidden = true
119
+ topOverlayHost.addSubview(marker)
120
+ topEdgeMarker = marker
121
+ let interaction = UIScrollEdgeElementContainerInteraction()
122
+ interaction.edge = .top
123
+ interaction.scrollView = collectionView
124
+ topOverlayHost.addInteraction(interaction)
125
+ topEdgeInteraction = interaction
126
+ } else if !enabled, let interaction = topEdgeInteraction {
127
+ topOverlayHost.removeInteraction(interaction)
128
+ (interaction as? UIScrollEdgeElementContainerInteraction)?.scrollView = nil
129
+ topEdgeInteraction = nil
130
+ topEdgeMarker?.removeFromSuperview()
131
+ topEdgeMarker = nil
132
+ if let originalTopEdgeStyle = originalTopEdgeStyle as? UIScrollEdgeEffect.Style {
133
+ collectionView.topEdgeEffect.style = originalTopEdgeStyle
134
+ }
135
+ originalTopEdgeStyle = nil
136
+ }
137
+ if enabled { collectionView.topEdgeEffect.style = .hard }
138
+ }
139
+ }
140
+
59
141
  func setContainerSlotHeightsJson(_ json: String) {
60
142
  guard let data = json.data(using: .utf8),
61
143
  let heights = try? JSONSerialization.jsonObject(with: data) as? [Double],
@@ -291,6 +373,7 @@ final class NativeListView: UIView {
291
373
  addSubview(footerContainer)
292
374
  addSubview(sectionIndexView)
293
375
  addSubview(sectionIndexPreview)
376
+ addSubview(topOverlayHost)
294
377
  footerContainer.addSubview(footerCell)
295
378
  collectionView.translatesAutoresizingMaskIntoConstraints = false
296
379
  footerContainer.translatesAutoresizingMaskIntoConstraints = false
@@ -442,11 +525,14 @@ final class NativeListView: UIView {
442
525
 
443
526
  override func didMoveToWindow() {
444
527
  super.didMoveToWindow()
528
+ updateTopScrollEdge()
445
529
  updateSectionIndexAttachment()
446
530
  }
447
531
 
448
532
  override func layoutSubviews() {
449
533
  super.layoutSubviews()
534
+ topOverlayHost.frame = CGRect(x: 0, y: 0, width: collectionView.bounds.width,
535
+ height: requestedTopOverlayHeight)
450
536
  updateSectionIndexAttachment()
451
537
  let direction = effectiveUserInterfaceLayoutDirection
452
538
  if let lastLayoutSize,
@@ -2021,6 +2107,7 @@ final class NativeListView: UIView {
2021
2107
 
2022
2108
  func dispose() {
2023
2109
  guard !disposed else { return }
2110
+ setTopScrollEdge(hard: false, overlayHeight: 0)
2024
2111
  disposed = true
2025
2112
 
2026
2113
  disposeActionAnchor()
@@ -4,12 +4,12 @@ import { useNativeListFontFamiliesJson } from "./fonts.js";
4
4
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
5
  import { OneKeyImageCache, OneKeyImageCachePolicy } from '@onekeyfe/react-native-image';
6
6
  import { NativeAvatarPrefetchModel, NativeAvatarPrefetchQueue } from "./avatarPrefetch.js";
7
- import { View } from 'react-native';
7
+ import { Platform, View } from 'react-native';
8
8
  import { callback, getHostComponent } from 'react-native-nitro-modules';
9
9
  import { isSelectableRow } from "./selection.js";
10
10
  import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
11
11
  import { applyRowPatches, serializePatches, serializeSnapshot } from "./validation.js";
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const NativeListConfig = require('../nitrogen/generated/shared/json/NativeListConfig.json');
14
14
  const NativeListHost = getHostComponent('NativeList', () => NativeListConfig);
15
15
  export function preloadNativeListAvatarImages(sources) {
@@ -31,6 +31,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
31
31
  listHeader,
32
32
  listFooter,
33
33
  listEmpty,
34
+ topOverlay,
35
+ topScrollEdgeEffect,
34
36
  scrollPositionThresholds,
35
37
  webVirtualizationEnabled: _webVirtualizationEnabled,
36
38
  webSectionIndexContainerRef: _webSectionIndexContainerRef,
@@ -53,6 +55,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
53
55
  }, forwardedRef) {
54
56
  const fontFamiliesJson = useNativeListFontFamiliesJson();
55
57
  const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
58
+ const [topOverlayHeight, setTopOverlayHeight] = useState(0);
59
+ const hasTopOverlay = Platform?.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26 && topScrollEdgeEffect === 'hard' && topOverlay != null;
56
60
  const containerSlotHeightsJson = JSON.stringify(slotHeights);
57
61
  const slotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
58
62
  if (snapshot.layout.orientation === 'horizontal' && (listHeader || listEmpty || listFooter)) {
@@ -315,16 +319,18 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
315
319
  callbacksRef.current.onVisibleRangeChanged?.(payload);
316
320
  })
317
321
  }), []);
318
- return /*#__PURE__*/_jsx(NativeListHost, {
322
+ return /*#__PURE__*/_jsxs(NativeListHost, {
319
323
  ...viewProps,
320
324
  ...nativeCallbacks,
321
325
  fontFamiliesJson: fontFamiliesJson,
322
326
  snapshotJson: snapshotJson,
323
327
  containerSlotHeightsJson: containerSlotHeightsJson,
328
+ topScrollEdgeHard: hasTopOverlay,
329
+ topOverlayHeight: hasTopOverlay ? topOverlayHeight : 0,
324
330
  scrollPositionThresholdsJson: scrollPositionThresholdsJson,
325
331
  keyboardDismissMode: keyboardDismissMode,
326
332
  keyboardShouldPersistTaps: normalizedKeyboardShouldPersistTaps,
327
- children: slotContents.map((content, index) => /*#__PURE__*/_jsx(View, {
333
+ children: [slotContents.map((content, index) => /*#__PURE__*/_jsx(View, {
328
334
  collapsable: false,
329
335
  style: {
330
336
  position: 'absolute',
@@ -337,7 +343,20 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
337
343
  setSlotHeights(previous => previous[index] === height ? previous : previous.map((value, slot) => slot === index ? height : value));
338
344
  },
339
345
  children: content
340
- }, index))
346
+ }, index)), hasTopOverlay ? /*#__PURE__*/_jsx(View, {
347
+ collapsable: false,
348
+ style: {
349
+ position: 'absolute',
350
+ top: 0,
351
+ left: 0,
352
+ right: 0
353
+ },
354
+ onLayout: event => {
355
+ const height = Math.ceil(event.nativeEvent.layout.height);
356
+ setTopOverlayHeight(previous => previous === height ? previous : height);
357
+ },
358
+ children: topOverlay
359
+ }) : null]
341
360
  });
342
361
  });
343
362
  //# sourceMappingURL=NativeList.js.map
@@ -26,6 +26,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
26
26
  listHeader: _listHeader,
27
27
  listEmpty: _listEmpty,
28
28
  listFooter: _listFooter,
29
+ topOverlay: _topOverlay,
30
+ topScrollEdgeEffect: _topScrollEdgeEffect,
29
31
  scrollPositionThresholds: _scrollPositionThresholds,
30
32
  onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
31
33
  webVirtualizationEnabled = true,
@@ -84,6 +84,24 @@ namespace margelo::nitro::nativelist {
84
84
  static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* containerSlotHeightsJson */)>("setContainerSlotHeightsJson");
85
85
  method(_javaPart, jni::make_jstring(containerSlotHeightsJson));
86
86
  }
87
+ bool JHybridNativeListSpec::getTopScrollEdgeHard() {
88
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getTopScrollEdgeHard");
89
+ auto __result = method(_javaPart);
90
+ return static_cast<bool>(__result);
91
+ }
92
+ void JHybridNativeListSpec::setTopScrollEdgeHard(bool topScrollEdgeHard) {
93
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* topScrollEdgeHard */)>("setTopScrollEdgeHard");
94
+ method(_javaPart, topScrollEdgeHard);
95
+ }
96
+ double JHybridNativeListSpec::getTopOverlayHeight() {
97
+ static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getTopOverlayHeight");
98
+ auto __result = method(_javaPart);
99
+ return __result;
100
+ }
101
+ void JHybridNativeListSpec::setTopOverlayHeight(double topOverlayHeight) {
102
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* topOverlayHeight */)>("setTopOverlayHeight");
103
+ method(_javaPart, topOverlayHeight);
104
+ }
87
105
  std::string JHybridNativeListSpec::getScrollPositionThresholdsJson() {
88
106
  static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getScrollPositionThresholdsJson");
89
107
  auto __result = method(_javaPart);
@@ -56,6 +56,10 @@ namespace margelo::nitro::nativelist {
56
56
  void setFontFamiliesJson(const std::string& fontFamiliesJson) override;
57
57
  std::string getContainerSlotHeightsJson() override;
58
58
  void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) override;
59
+ bool getTopScrollEdgeHard() override;
60
+ void setTopScrollEdgeHard(bool topScrollEdgeHard) override;
61
+ double getTopOverlayHeight() override;
62
+ void setTopOverlayHeight(double topOverlayHeight) override;
59
63
  std::string getScrollPositionThresholdsJson() override;
60
64
  void setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) override;
61
65
  std::optional<std::function<void(bool /* isBeyondThreshold */)>> getOnScrollPositionThresholdChange() override;
@@ -68,6 +68,16 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
68
68
  : !newProps->containerSlotHeightsJson.hasSameValue(oldProps->containerSlotHeightsJson)) {
69
69
  hybridView->setContainerSlotHeightsJson(newProps->containerSlotHeightsJson.get());
70
70
  }
71
+ if (oldProps == nullptr
72
+ ? newProps->topScrollEdgeHard.isProvided()
73
+ : !newProps->topScrollEdgeHard.hasSameValue(oldProps->topScrollEdgeHard)) {
74
+ hybridView->setTopScrollEdgeHard(newProps->topScrollEdgeHard.get());
75
+ }
76
+ if (oldProps == nullptr
77
+ ? newProps->topOverlayHeight.isProvided()
78
+ : !newProps->topOverlayHeight.hasSameValue(oldProps->topOverlayHeight)) {
79
+ hybridView->setTopOverlayHeight(newProps->topOverlayHeight.get());
80
+ }
71
81
  if (oldProps == nullptr
72
82
  ? newProps->scrollPositionThresholdsJson.isProvided()
73
83
  : !newProps->scrollPositionThresholdsJson.hasSameValue(oldProps->scrollPositionThresholdsJson)) {
@@ -45,6 +45,18 @@ abstract class HybridNativeListSpec: HybridView() {
45
45
  @set:Keep
46
46
  abstract var containerSlotHeightsJson: String
47
47
 
48
+ @get:DoNotStrip
49
+ @get:Keep
50
+ @set:DoNotStrip
51
+ @set:Keep
52
+ abstract var topScrollEdgeHard: Boolean
53
+
54
+ @get:DoNotStrip
55
+ @get:Keep
56
+ @set:DoNotStrip
57
+ @set:Keep
58
+ abstract var topOverlayHeight: Double
59
+
48
60
  @get:DoNotStrip
49
61
  @get:Keep
50
62
  @set:DoNotStrip
@@ -93,6 +93,18 @@ namespace margelo::nitro::nativelist {
93
93
  inline void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) noexcept override {
94
94
  _swiftPart.setContainerSlotHeightsJson(containerSlotHeightsJson);
95
95
  }
96
+ inline bool getTopScrollEdgeHard() noexcept override {
97
+ return _swiftPart.getTopScrollEdgeHard();
98
+ }
99
+ inline void setTopScrollEdgeHard(bool topScrollEdgeHard) noexcept override {
100
+ _swiftPart.setTopScrollEdgeHard(std::forward<decltype(topScrollEdgeHard)>(topScrollEdgeHard));
101
+ }
102
+ inline double getTopOverlayHeight() noexcept override {
103
+ return _swiftPart.getTopOverlayHeight();
104
+ }
105
+ inline void setTopOverlayHeight(double topOverlayHeight) noexcept override {
106
+ _swiftPart.setTopOverlayHeight(std::forward<decltype(topOverlayHeight)>(topOverlayHeight));
107
+ }
96
108
  inline std::string getScrollPositionThresholdsJson() noexcept override {
97
109
  auto __result = _swiftPart.getScrollPositionThresholdsJson();
98
110
  return __result;
@@ -130,6 +130,18 @@ using namespace margelo::nitro::nativelist::views;
130
130
  : !newViewProps.containerSlotHeightsJson.hasSameValue(oldViewProps->containerSlotHeightsJson)) {
131
131
  swiftPart.setContainerSlotHeightsJson(newViewProps.containerSlotHeightsJson.get());
132
132
  }
133
+ // topScrollEdgeHard: boolean
134
+ if (oldViewProps == nullptr
135
+ ? newViewProps.topScrollEdgeHard.isProvided()
136
+ : !newViewProps.topScrollEdgeHard.hasSameValue(oldViewProps->topScrollEdgeHard)) {
137
+ swiftPart.setTopScrollEdgeHard(newViewProps.topScrollEdgeHard.get());
138
+ }
139
+ // topOverlayHeight: number
140
+ if (oldViewProps == nullptr
141
+ ? newViewProps.topOverlayHeight.isProvided()
142
+ : !newViewProps.topOverlayHeight.hasSameValue(oldViewProps->topOverlayHeight)) {
143
+ swiftPart.setTopOverlayHeight(newViewProps.topOverlayHeight.get());
144
+ }
133
145
  // scrollPositionThresholdsJson: string
134
146
  if (oldViewProps == nullptr
135
147
  ? newViewProps.scrollPositionThresholdsJson.isProvided()
@@ -13,6 +13,8 @@ public protocol HybridNativeListSpec_protocol: HybridObject, HybridView {
13
13
  var snapshotJson: String { get set }
14
14
  var fontFamiliesJson: String { get set }
15
15
  var containerSlotHeightsJson: String { get set }
16
+ var topScrollEdgeHard: Bool { get set }
17
+ var topOverlayHeight: Double { get set }
16
18
  var scrollPositionThresholdsJson: String { get set }
17
19
  var onScrollPositionThresholdChange: ((_ isBeyondThreshold: Bool) -> Void)? { get set }
18
20
  var keyboardDismissMode: NativeListKeyboardDismissMode { get set }
@@ -154,6 +154,28 @@ open class HybridNativeListSpec_cxx {
154
154
  }
155
155
  }
156
156
 
157
+ public final var topScrollEdgeHard: Bool {
158
+ @inline(__always)
159
+ get {
160
+ return self.__implementation.topScrollEdgeHard
161
+ }
162
+ @inline(__always)
163
+ set {
164
+ self.__implementation.topScrollEdgeHard = newValue
165
+ }
166
+ }
167
+
168
+ public final var topOverlayHeight: Double {
169
+ @inline(__always)
170
+ get {
171
+ return self.__implementation.topOverlayHeight
172
+ }
173
+ @inline(__always)
174
+ set {
175
+ self.__implementation.topOverlayHeight = newValue
176
+ }
177
+ }
178
+
157
179
  public final var scrollPositionThresholdsJson: std.string {
158
180
  @inline(__always)
159
181
  get {
@@ -20,6 +20,10 @@ namespace margelo::nitro::nativelist {
20
20
  prototype.registerHybridSetter("fontFamiliesJson", &HybridNativeListSpec::setFontFamiliesJson);
21
21
  prototype.registerHybridGetter("containerSlotHeightsJson", &HybridNativeListSpec::getContainerSlotHeightsJson);
22
22
  prototype.registerHybridSetter("containerSlotHeightsJson", &HybridNativeListSpec::setContainerSlotHeightsJson);
23
+ prototype.registerHybridGetter("topScrollEdgeHard", &HybridNativeListSpec::getTopScrollEdgeHard);
24
+ prototype.registerHybridSetter("topScrollEdgeHard", &HybridNativeListSpec::setTopScrollEdgeHard);
25
+ prototype.registerHybridGetter("topOverlayHeight", &HybridNativeListSpec::getTopOverlayHeight);
26
+ prototype.registerHybridSetter("topOverlayHeight", &HybridNativeListSpec::setTopOverlayHeight);
23
27
  prototype.registerHybridGetter("scrollPositionThresholdsJson", &HybridNativeListSpec::getScrollPositionThresholdsJson);
24
28
  prototype.registerHybridSetter("scrollPositionThresholdsJson", &HybridNativeListSpec::setScrollPositionThresholdsJson);
25
29
  prototype.registerHybridGetter("onScrollPositionThresholdChange", &HybridNativeListSpec::getOnScrollPositionThresholdChange);
@@ -60,6 +60,10 @@ namespace margelo::nitro::nativelist {
60
60
  virtual void setFontFamiliesJson(const std::string& fontFamiliesJson) = 0;
61
61
  virtual std::string getContainerSlotHeightsJson() = 0;
62
62
  virtual void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) = 0;
63
+ virtual bool getTopScrollEdgeHard() = 0;
64
+ virtual void setTopScrollEdgeHard(bool topScrollEdgeHard) = 0;
65
+ virtual double getTopOverlayHeight() = 0;
66
+ virtual void setTopOverlayHeight(double topOverlayHeight) = 0;
63
67
  virtual std::string getScrollPositionThresholdsJson() = 0;
64
68
  virtual void setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) = 0;
65
69
  virtual std::optional<std::function<void(bool /* isBeyondThreshold */)>> getOnScrollPositionThresholdChange() = 0;
@@ -23,6 +23,8 @@ namespace margelo::nitro::nativelist::views {
23
23
  snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
24
24
  fontFamiliesJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "fontFamiliesJson", rawProps, sourceProps.fontFamiliesJson)),
25
25
  containerSlotHeightsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "containerSlotHeightsJson", rawProps, sourceProps.containerSlotHeightsJson)),
26
+ topScrollEdgeHard(nitro::ReactProp<bool>::fromRawValue("NativeList", "topScrollEdgeHard", rawProps, sourceProps.topScrollEdgeHard)),
27
+ topOverlayHeight(nitro::ReactProp<double>::fromRawValue("NativeList", "topOverlayHeight", rawProps, sourceProps.topOverlayHeight)),
26
28
  scrollPositionThresholdsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "scrollPositionThresholdsJson", rawProps, sourceProps.scrollPositionThresholdsJson)),
27
29
  onScrollPositionThresholdChange(nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>>::fromRawValue("NativeList", "onScrollPositionThresholdChange", rawProps, sourceProps.onScrollPositionThresholdChange)),
28
30
  keyboardDismissMode(nitro::ReactProp<NativeListKeyboardDismissMode>::fromRawValue("NativeList", "keyboardDismissMode", rawProps, sourceProps.keyboardDismissMode)),
@@ -40,6 +42,8 @@ namespace margelo::nitro::nativelist::views {
40
42
  case hashString("snapshotJson"): return true;
41
43
  case hashString("fontFamiliesJson"): return true;
42
44
  case hashString("containerSlotHeightsJson"): return true;
45
+ case hashString("topScrollEdgeHard"): return true;
46
+ case hashString("topOverlayHeight"): return true;
43
47
  case hashString("scrollPositionThresholdsJson"): return true;
44
48
  case hashString("onScrollPositionThresholdChange"): return true;
45
49
  case hashString("keyboardDismissMode"): return true;
@@ -48,6 +48,8 @@ namespace margelo::nitro::nativelist::views {
48
48
  nitro::ReactProp<std::string> snapshotJson;
49
49
  nitro::ReactProp<std::string> fontFamiliesJson;
50
50
  nitro::ReactProp<std::string> containerSlotHeightsJson;
51
+ nitro::ReactProp<bool> topScrollEdgeHard;
52
+ nitro::ReactProp<double> topOverlayHeight;
51
53
  nitro::ReactProp<std::string> scrollPositionThresholdsJson;
52
54
  nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>> onScrollPositionThresholdChange;
53
55
  nitro::ReactProp<NativeListKeyboardDismissMode> keyboardDismissMode;
@@ -65,6 +67,8 @@ namespace margelo::nitro::nativelist::views {
65
67
  return snapshotJson.hasSameValue(other.snapshotJson) &&
66
68
  fontFamiliesJson.hasSameValue(other.fontFamiliesJson) &&
67
69
  containerSlotHeightsJson.hasSameValue(other.containerSlotHeightsJson) &&
70
+ topScrollEdgeHard.hasSameValue(other.topScrollEdgeHard) &&
71
+ topOverlayHeight.hasSameValue(other.topOverlayHeight) &&
68
72
  scrollPositionThresholdsJson.hasSameValue(other.scrollPositionThresholdsJson) &&
69
73
  onScrollPositionThresholdChange.hasSameValue(other.onScrollPositionThresholdChange) &&
70
74
  keyboardDismissMode.hasSameValue(other.keyboardDismissMode) &&
@@ -83,6 +87,8 @@ namespace margelo::nitro::nativelist::views {
83
87
  return snapshotJson.isProvided() ||
84
88
  fontFamiliesJson.isProvided() ||
85
89
  containerSlotHeightsJson.isProvided() ||
90
+ topScrollEdgeHard.isProvided() ||
91
+ topOverlayHeight.isProvided() ||
86
92
  scrollPositionThresholdsJson.isProvided() ||
87
93
  onScrollPositionThresholdChange.isProvided() ||
88
94
  keyboardDismissMode.isProvided() ||
@@ -7,6 +7,8 @@
7
7
  "snapshotJson": true,
8
8
  "fontFamiliesJson": true,
9
9
  "containerSlotHeightsJson": true,
10
+ "topScrollEdgeHard": true,
11
+ "topOverlayHeight": true,
10
12
  "scrollPositionThresholdsJson": true,
11
13
  "onScrollPositionThresholdChange": true,
12
14
  "keyboardDismissMode": true,
@@ -8,6 +8,8 @@ export interface NativeListNativeProps extends HybridViewProps {
8
8
  snapshotJson: string;
9
9
  fontFamiliesJson: string;
10
10
  containerSlotHeightsJson: string;
11
+ topScrollEdgeHard: boolean;
12
+ topOverlayHeight: number;
11
13
  scrollPositionThresholdsJson: string;
12
14
  onScrollPositionThresholdChange?: (isBeyondThreshold: boolean) => void;
13
15
  keyboardDismissMode: NativeListKeyboardDismissMode;
@@ -79,6 +79,10 @@ export type NativeListProps = Omit<ViewProps, 'children'> & Readonly<{
79
79
  listHeader?: ReactNode;
80
80
  listFooter?: ReactNode;
81
81
  listEmpty?: ReactNode;
82
+ /** Fixed overlay above scrolling rows on iOS 26 and newer. */
83
+ topOverlay?: ReactNode;
84
+ /** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
85
+ topScrollEdgeEffect?: 'hard';
82
86
  /** Web only. Defaults to true and is ignored by the native host. */
83
87
  webVirtualizationEnabled?: boolean;
84
88
  /** Web only. Hosts the section index inside this container. */
@@ -84,6 +84,24 @@ namespace margelo::nitro::nativelist {
84
84
  static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* containerSlotHeightsJson */)>("setContainerSlotHeightsJson");
85
85
  method(_javaPart, jni::make_jstring(containerSlotHeightsJson));
86
86
  }
87
+ bool JHybridNativeListSpec::getTopScrollEdgeHard() {
88
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getTopScrollEdgeHard");
89
+ auto __result = method(_javaPart);
90
+ return static_cast<bool>(__result);
91
+ }
92
+ void JHybridNativeListSpec::setTopScrollEdgeHard(bool topScrollEdgeHard) {
93
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* topScrollEdgeHard */)>("setTopScrollEdgeHard");
94
+ method(_javaPart, topScrollEdgeHard);
95
+ }
96
+ double JHybridNativeListSpec::getTopOverlayHeight() {
97
+ static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getTopOverlayHeight");
98
+ auto __result = method(_javaPart);
99
+ return __result;
100
+ }
101
+ void JHybridNativeListSpec::setTopOverlayHeight(double topOverlayHeight) {
102
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* topOverlayHeight */)>("setTopOverlayHeight");
103
+ method(_javaPart, topOverlayHeight);
104
+ }
87
105
  std::string JHybridNativeListSpec::getScrollPositionThresholdsJson() {
88
106
  static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getScrollPositionThresholdsJson");
89
107
  auto __result = method(_javaPart);
@@ -56,6 +56,10 @@ namespace margelo::nitro::nativelist {
56
56
  void setFontFamiliesJson(const std::string& fontFamiliesJson) override;
57
57
  std::string getContainerSlotHeightsJson() override;
58
58
  void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) override;
59
+ bool getTopScrollEdgeHard() override;
60
+ void setTopScrollEdgeHard(bool topScrollEdgeHard) override;
61
+ double getTopOverlayHeight() override;
62
+ void setTopOverlayHeight(double topOverlayHeight) override;
59
63
  std::string getScrollPositionThresholdsJson() override;
60
64
  void setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) override;
61
65
  std::optional<std::function<void(bool /* isBeyondThreshold */)>> getOnScrollPositionThresholdChange() override;
@@ -68,6 +68,16 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
68
68
  : !newProps->containerSlotHeightsJson.hasSameValue(oldProps->containerSlotHeightsJson)) {
69
69
  hybridView->setContainerSlotHeightsJson(newProps->containerSlotHeightsJson.get());
70
70
  }
71
+ if (oldProps == nullptr
72
+ ? newProps->topScrollEdgeHard.isProvided()
73
+ : !newProps->topScrollEdgeHard.hasSameValue(oldProps->topScrollEdgeHard)) {
74
+ hybridView->setTopScrollEdgeHard(newProps->topScrollEdgeHard.get());
75
+ }
76
+ if (oldProps == nullptr
77
+ ? newProps->topOverlayHeight.isProvided()
78
+ : !newProps->topOverlayHeight.hasSameValue(oldProps->topOverlayHeight)) {
79
+ hybridView->setTopOverlayHeight(newProps->topOverlayHeight.get());
80
+ }
71
81
  if (oldProps == nullptr
72
82
  ? newProps->scrollPositionThresholdsJson.isProvided()
73
83
  : !newProps->scrollPositionThresholdsJson.hasSameValue(oldProps->scrollPositionThresholdsJson)) {
@@ -45,6 +45,18 @@ abstract class HybridNativeListSpec: HybridView() {
45
45
  @set:Keep
46
46
  abstract var containerSlotHeightsJson: String
47
47
 
48
+ @get:DoNotStrip
49
+ @get:Keep
50
+ @set:DoNotStrip
51
+ @set:Keep
52
+ abstract var topScrollEdgeHard: Boolean
53
+
54
+ @get:DoNotStrip
55
+ @get:Keep
56
+ @set:DoNotStrip
57
+ @set:Keep
58
+ abstract var topOverlayHeight: Double
59
+
48
60
  @get:DoNotStrip
49
61
  @get:Keep
50
62
  @set:DoNotStrip
@@ -93,6 +93,18 @@ namespace margelo::nitro::nativelist {
93
93
  inline void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) noexcept override {
94
94
  _swiftPart.setContainerSlotHeightsJson(containerSlotHeightsJson);
95
95
  }
96
+ inline bool getTopScrollEdgeHard() noexcept override {
97
+ return _swiftPart.getTopScrollEdgeHard();
98
+ }
99
+ inline void setTopScrollEdgeHard(bool topScrollEdgeHard) noexcept override {
100
+ _swiftPart.setTopScrollEdgeHard(std::forward<decltype(topScrollEdgeHard)>(topScrollEdgeHard));
101
+ }
102
+ inline double getTopOverlayHeight() noexcept override {
103
+ return _swiftPart.getTopOverlayHeight();
104
+ }
105
+ inline void setTopOverlayHeight(double topOverlayHeight) noexcept override {
106
+ _swiftPart.setTopOverlayHeight(std::forward<decltype(topOverlayHeight)>(topOverlayHeight));
107
+ }
96
108
  inline std::string getScrollPositionThresholdsJson() noexcept override {
97
109
  auto __result = _swiftPart.getScrollPositionThresholdsJson();
98
110
  return __result;
@@ -130,6 +130,18 @@ using namespace margelo::nitro::nativelist::views;
130
130
  : !newViewProps.containerSlotHeightsJson.hasSameValue(oldViewProps->containerSlotHeightsJson)) {
131
131
  swiftPart.setContainerSlotHeightsJson(newViewProps.containerSlotHeightsJson.get());
132
132
  }
133
+ // topScrollEdgeHard: boolean
134
+ if (oldViewProps == nullptr
135
+ ? newViewProps.topScrollEdgeHard.isProvided()
136
+ : !newViewProps.topScrollEdgeHard.hasSameValue(oldViewProps->topScrollEdgeHard)) {
137
+ swiftPart.setTopScrollEdgeHard(newViewProps.topScrollEdgeHard.get());
138
+ }
139
+ // topOverlayHeight: number
140
+ if (oldViewProps == nullptr
141
+ ? newViewProps.topOverlayHeight.isProvided()
142
+ : !newViewProps.topOverlayHeight.hasSameValue(oldViewProps->topOverlayHeight)) {
143
+ swiftPart.setTopOverlayHeight(newViewProps.topOverlayHeight.get());
144
+ }
133
145
  // scrollPositionThresholdsJson: string
134
146
  if (oldViewProps == nullptr
135
147
  ? newViewProps.scrollPositionThresholdsJson.isProvided()
@@ -13,6 +13,8 @@ public protocol HybridNativeListSpec_protocol: HybridObject, HybridView {
13
13
  var snapshotJson: String { get set }
14
14
  var fontFamiliesJson: String { get set }
15
15
  var containerSlotHeightsJson: String { get set }
16
+ var topScrollEdgeHard: Bool { get set }
17
+ var topOverlayHeight: Double { get set }
16
18
  var scrollPositionThresholdsJson: String { get set }
17
19
  var onScrollPositionThresholdChange: ((_ isBeyondThreshold: Bool) -> Void)? { get set }
18
20
  var keyboardDismissMode: NativeListKeyboardDismissMode { get set }
@@ -154,6 +154,28 @@ open class HybridNativeListSpec_cxx {
154
154
  }
155
155
  }
156
156
 
157
+ public final var topScrollEdgeHard: Bool {
158
+ @inline(__always)
159
+ get {
160
+ return self.__implementation.topScrollEdgeHard
161
+ }
162
+ @inline(__always)
163
+ set {
164
+ self.__implementation.topScrollEdgeHard = newValue
165
+ }
166
+ }
167
+
168
+ public final var topOverlayHeight: Double {
169
+ @inline(__always)
170
+ get {
171
+ return self.__implementation.topOverlayHeight
172
+ }
173
+ @inline(__always)
174
+ set {
175
+ self.__implementation.topOverlayHeight = newValue
176
+ }
177
+ }
178
+
157
179
  public final var scrollPositionThresholdsJson: std.string {
158
180
  @inline(__always)
159
181
  get {
@@ -20,6 +20,10 @@ namespace margelo::nitro::nativelist {
20
20
  prototype.registerHybridSetter("fontFamiliesJson", &HybridNativeListSpec::setFontFamiliesJson);
21
21
  prototype.registerHybridGetter("containerSlotHeightsJson", &HybridNativeListSpec::getContainerSlotHeightsJson);
22
22
  prototype.registerHybridSetter("containerSlotHeightsJson", &HybridNativeListSpec::setContainerSlotHeightsJson);
23
+ prototype.registerHybridGetter("topScrollEdgeHard", &HybridNativeListSpec::getTopScrollEdgeHard);
24
+ prototype.registerHybridSetter("topScrollEdgeHard", &HybridNativeListSpec::setTopScrollEdgeHard);
25
+ prototype.registerHybridGetter("topOverlayHeight", &HybridNativeListSpec::getTopOverlayHeight);
26
+ prototype.registerHybridSetter("topOverlayHeight", &HybridNativeListSpec::setTopOverlayHeight);
23
27
  prototype.registerHybridGetter("scrollPositionThresholdsJson", &HybridNativeListSpec::getScrollPositionThresholdsJson);
24
28
  prototype.registerHybridSetter("scrollPositionThresholdsJson", &HybridNativeListSpec::setScrollPositionThresholdsJson);
25
29
  prototype.registerHybridGetter("onScrollPositionThresholdChange", &HybridNativeListSpec::getOnScrollPositionThresholdChange);
@@ -60,6 +60,10 @@ namespace margelo::nitro::nativelist {
60
60
  virtual void setFontFamiliesJson(const std::string& fontFamiliesJson) = 0;
61
61
  virtual std::string getContainerSlotHeightsJson() = 0;
62
62
  virtual void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) = 0;
63
+ virtual bool getTopScrollEdgeHard() = 0;
64
+ virtual void setTopScrollEdgeHard(bool topScrollEdgeHard) = 0;
65
+ virtual double getTopOverlayHeight() = 0;
66
+ virtual void setTopOverlayHeight(double topOverlayHeight) = 0;
63
67
  virtual std::string getScrollPositionThresholdsJson() = 0;
64
68
  virtual void setScrollPositionThresholdsJson(const std::string& scrollPositionThresholdsJson) = 0;
65
69
  virtual std::optional<std::function<void(bool /* isBeyondThreshold */)>> getOnScrollPositionThresholdChange() = 0;
@@ -23,6 +23,8 @@ namespace margelo::nitro::nativelist::views {
23
23
  snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
24
24
  fontFamiliesJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "fontFamiliesJson", rawProps, sourceProps.fontFamiliesJson)),
25
25
  containerSlotHeightsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "containerSlotHeightsJson", rawProps, sourceProps.containerSlotHeightsJson)),
26
+ topScrollEdgeHard(nitro::ReactProp<bool>::fromRawValue("NativeList", "topScrollEdgeHard", rawProps, sourceProps.topScrollEdgeHard)),
27
+ topOverlayHeight(nitro::ReactProp<double>::fromRawValue("NativeList", "topOverlayHeight", rawProps, sourceProps.topOverlayHeight)),
26
28
  scrollPositionThresholdsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "scrollPositionThresholdsJson", rawProps, sourceProps.scrollPositionThresholdsJson)),
27
29
  onScrollPositionThresholdChange(nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>>::fromRawValue("NativeList", "onScrollPositionThresholdChange", rawProps, sourceProps.onScrollPositionThresholdChange)),
28
30
  keyboardDismissMode(nitro::ReactProp<NativeListKeyboardDismissMode>::fromRawValue("NativeList", "keyboardDismissMode", rawProps, sourceProps.keyboardDismissMode)),
@@ -40,6 +42,8 @@ namespace margelo::nitro::nativelist::views {
40
42
  case hashString("snapshotJson"): return true;
41
43
  case hashString("fontFamiliesJson"): return true;
42
44
  case hashString("containerSlotHeightsJson"): return true;
45
+ case hashString("topScrollEdgeHard"): return true;
46
+ case hashString("topOverlayHeight"): return true;
43
47
  case hashString("scrollPositionThresholdsJson"): return true;
44
48
  case hashString("onScrollPositionThresholdChange"): return true;
45
49
  case hashString("keyboardDismissMode"): return true;
@@ -48,6 +48,8 @@ namespace margelo::nitro::nativelist::views {
48
48
  nitro::ReactProp<std::string> snapshotJson;
49
49
  nitro::ReactProp<std::string> fontFamiliesJson;
50
50
  nitro::ReactProp<std::string> containerSlotHeightsJson;
51
+ nitro::ReactProp<bool> topScrollEdgeHard;
52
+ nitro::ReactProp<double> topOverlayHeight;
51
53
  nitro::ReactProp<std::string> scrollPositionThresholdsJson;
52
54
  nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>> onScrollPositionThresholdChange;
53
55
  nitro::ReactProp<NativeListKeyboardDismissMode> keyboardDismissMode;
@@ -65,6 +67,8 @@ namespace margelo::nitro::nativelist::views {
65
67
  return snapshotJson.hasSameValue(other.snapshotJson) &&
66
68
  fontFamiliesJson.hasSameValue(other.fontFamiliesJson) &&
67
69
  containerSlotHeightsJson.hasSameValue(other.containerSlotHeightsJson) &&
70
+ topScrollEdgeHard.hasSameValue(other.topScrollEdgeHard) &&
71
+ topOverlayHeight.hasSameValue(other.topOverlayHeight) &&
68
72
  scrollPositionThresholdsJson.hasSameValue(other.scrollPositionThresholdsJson) &&
69
73
  onScrollPositionThresholdChange.hasSameValue(other.onScrollPositionThresholdChange) &&
70
74
  keyboardDismissMode.hasSameValue(other.keyboardDismissMode) &&
@@ -83,6 +87,8 @@ namespace margelo::nitro::nativelist::views {
83
87
  return snapshotJson.isProvided() ||
84
88
  fontFamiliesJson.isProvided() ||
85
89
  containerSlotHeightsJson.isProvided() ||
90
+ topScrollEdgeHard.isProvided() ||
91
+ topOverlayHeight.isProvided() ||
86
92
  scrollPositionThresholdsJson.isProvided() ||
87
93
  onScrollPositionThresholdChange.isProvided() ||
88
94
  keyboardDismissMode.isProvided() ||
@@ -7,6 +7,8 @@
7
7
  "snapshotJson": true,
8
8
  "fontFamiliesJson": true,
9
9
  "containerSlotHeightsJson": true,
10
+ "topScrollEdgeHard": true,
11
+ "topOverlayHeight": true,
10
12
  "scrollPositionThresholdsJson": true,
11
13
  "onScrollPositionThresholdChange": true,
12
14
  "keyboardDismissMode": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "3.0.179-alpha.302",
3
+ "version": "3.0.179-alpha.304",
4
4
  "description": "Template-driven native RecyclerView and UICollectionView for React Native",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
@@ -86,8 +86,8 @@
86
86
  "typescript": "^5.9.2"
87
87
  },
88
88
  "peerDependencies": {
89
- "@onekeyfe/react-native-image": "3.0.179-alpha.302",
90
- "@onekeyfe/react-native-native-logger": "3.0.179-alpha.302",
89
+ "@onekeyfe/react-native-image": "3.0.179-alpha.304",
90
+ "@onekeyfe/react-native-native-logger": "3.0.179-alpha.304",
91
91
  "react": "*",
92
92
  "react-native": "*",
93
93
  "react-native-nitro-modules": "0.37.0"
@@ -13,6 +13,8 @@ export interface NativeListNativeProps extends HybridViewProps {
13
13
  snapshotJson: string;
14
14
  fontFamiliesJson: string;
15
15
  containerSlotHeightsJson: string;
16
+ topScrollEdgeHard: boolean;
17
+ topOverlayHeight: number;
16
18
  scrollPositionThresholdsJson: string;
17
19
  onScrollPositionThresholdChange?: (isBeyondThreshold: boolean) => void;
18
20
  keyboardDismissMode: NativeListKeyboardDismissMode;
@@ -15,7 +15,7 @@ import {
15
15
  NativeAvatarPrefetchModel,
16
16
  NativeAvatarPrefetchQueue,
17
17
  } from './avatarPrefetch';
18
- import { View } from 'react-native';
18
+ import { Platform, View } from 'react-native';
19
19
  import { callback, getHostComponent } from 'react-native-nitro-modules';
20
20
  import type {
21
21
  NativeListMethods,
@@ -102,6 +102,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
102
102
  listHeader,
103
103
  listFooter,
104
104
  listEmpty,
105
+ topOverlay,
106
+ topScrollEdgeEffect,
105
107
  scrollPositionThresholds,
106
108
  webVirtualizationEnabled: _webVirtualizationEnabled,
107
109
  webSectionIndexContainerRef: _webSectionIndexContainerRef,
@@ -126,6 +128,12 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
126
128
  ) {
127
129
  const fontFamiliesJson = useNativeListFontFamiliesJson();
128
130
  const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
131
+ const [topOverlayHeight, setTopOverlayHeight] = useState(0);
132
+ const hasTopOverlay =
133
+ Platform?.OS === 'ios' &&
134
+ parseInt(String(Platform.Version), 10) >= 26 &&
135
+ topScrollEdgeEffect === 'hard' &&
136
+ topOverlay != null;
129
137
  const containerSlotHeightsJson = JSON.stringify(slotHeights);
130
138
  const slotInset =
131
139
  snapshot.layout.contentPaddingHorizontal ??
@@ -509,6 +517,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
509
517
  fontFamiliesJson={fontFamiliesJson}
510
518
  snapshotJson={snapshotJson}
511
519
  containerSlotHeightsJson={containerSlotHeightsJson}
520
+ topScrollEdgeHard={hasTopOverlay}
521
+ topOverlayHeight={hasTopOverlay ? topOverlayHeight : 0}
512
522
  scrollPositionThresholdsJson={scrollPositionThresholdsJson}
513
523
  keyboardDismissMode={keyboardDismissMode}
514
524
  keyboardShouldPersistTaps={normalizedKeyboardShouldPersistTaps}
@@ -537,6 +547,20 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
537
547
  {content}
538
548
  </View>
539
549
  ))}
550
+ {hasTopOverlay ? (
551
+ <View
552
+ collapsable={false}
553
+ style={{ position: 'absolute', top: 0, left: 0, right: 0 }}
554
+ onLayout={(event) => {
555
+ const height = Math.ceil(event.nativeEvent.layout.height);
556
+ setTopOverlayHeight((previous) =>
557
+ previous === height ? previous : height
558
+ );
559
+ }}
560
+ >
561
+ {topOverlay}
562
+ </View>
563
+ ) : null}
540
564
  </NativeListHost>
541
565
  );
542
566
  }
@@ -123,6 +123,10 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
123
123
  listHeader?: ReactNode;
124
124
  listFooter?: ReactNode;
125
125
  listEmpty?: ReactNode;
126
+ /** Fixed overlay above scrolling rows on iOS 26 and newer. */
127
+ topOverlay?: ReactNode;
128
+ /** Enables UIKit's hard top scroll-edge effect on iOS 26 and newer. */
129
+ topScrollEdgeEffect?: 'hard';
126
130
  /** Web only. Defaults to true and is ignored by the native host. */
127
131
  webVirtualizationEnabled?: boolean;
128
132
  /** Web only. Hosts the section index inside this container. */
@@ -86,6 +86,8 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
86
86
  listHeader: _listHeader,
87
87
  listEmpty: _listEmpty,
88
88
  listFooter: _listFooter,
89
+ topOverlay: _topOverlay,
90
+ topScrollEdgeEffect: _topScrollEdgeEffect,
89
91
  scrollPositionThresholds: _scrollPositionThresholds,
90
92
  onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
91
93
  webVirtualizationEnabled = true,