@onekeyfe/react-native-native-list 6.7.0-31 → 6.7.0-33

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/docs/SPEC.md CHANGED
@@ -632,6 +632,16 @@ An unrelated layout request MUST NOT indefinitely postpone command completion.
632
632
  Replacement, actual drag, detach and disposal invalidate old callbacks; a stale
633
633
  callback MUST NOT move the view or clear a newer command's barriers.
634
634
 
635
+ On iOS, the existing `scrollToOffset` implementation is also exposed to native
636
+ callers as `onekeyScrollToOffset:animated:`. BottomTabs discovers this selector
637
+ on the collection view's direct NativeList owner and requests offset zero for
638
+ standalone-list double-press scrolling. The call uses `requestScroll`, including
639
+ its explicit-scroll revision, structural-tail interruption, command notifications
640
+ and pending-layout ownership; external callers MUST NOT bypass it by writing
641
+ the internal collection view's offset. This adds no JavaScript/Nitro API.
642
+ BottomTabs and NativeList native sources must ship together. The native handoff
643
+ is source implemented; structural-transition runtime acceptance remains pending.
644
+
635
645
  A valid command can privately notify the owning Pager before execution, including
636
646
  a same-position no-op; this does not add a public NativeList API. A Pager-owned
637
647
  page-top or sticky-top command can privately cancel only its owned list's old
@@ -1653,6 +1653,7 @@ final class NativeListView: UIView {
1653
1653
  requestScroll(.index(index, animated, alignment, viewPosition, viewOffset))
1654
1654
  }
1655
1655
 
1656
+ @objc(onekeyScrollToOffset:animated:)
1656
1657
  func scrollToOffset(_ offset: Double, animated: Bool) {
1657
1658
  requestScroll(.offset(offset, animated))
1658
1659
  }
@@ -2559,8 +2559,10 @@ final class NativeListLifecycleTests: XCTestCase {
2559
2559
  view.setContainerSlotHeightsJson("[0,0,60,0]")
2560
2560
  let list = try XCTUnwrap(view.subviews.compactMap { $0 as? UICollectionView }.first)
2561
2561
  list.contentInsetAdjustmentBehavior = .never
2562
- view.applySnapshotJson(try structuralRowsSnapshot(count: 1000, generation: 1,
2563
- uniformHeight: 1))
2562
+ // Six retained rows plus 129 retiring rows still exceed the 128-host limit
2563
+ // inside three viewports, without materializing hundreds of 1-point cells.
2564
+ view.applySnapshotJson(try structuralRowsSnapshot(count: 135, generation: 1,
2565
+ uniformHeight: 10))
2564
2566
  view.layoutIfNeeded()
2565
2567
  list.layoutIfNeeded()
2566
2568
  drainMainQueue()
@@ -2573,7 +2575,7 @@ final class NativeListLifecycleTests: XCTestCase {
2573
2575
  }
2574
2576
  defer { NotificationCenter.default.removeObserver(observer) }
2575
2577
  view.applySnapshotJson(try structuralRowsSnapshot(count: 6, generation: 2,
2576
- transitionID: "tail-host-limit", durationMs: 400, uniformHeight: 1))
2578
+ transitionID: "tail-host-limit", durationMs: 400, uniformHeight: 10))
2577
2579
  list.layoutIfNeeded()
2578
2580
  let source = try XCTUnwrap(list.dataSource as? UICollectionViewDiffableDataSource<Int, String>)
2579
2581
  let flow = try XCTUnwrap(list.collectionViewLayout as? NativeListFlowLayout)
@@ -2610,22 +2612,41 @@ final class NativeListLifecycleTests: XCTestCase {
2610
2612
  list.layoutIfNeeded()
2611
2613
  view.applySnapshotJson(try structuralRowsSnapshot(count: 50, generation: 2,
2612
2614
  transitionID: "tail-6-to-50", durationMs: 400))
2613
- waitForStructuralFrames(0.16)
2614
2615
  list.layoutIfNeeded()
2615
2616
  let source = try XCTUnwrap(list.dataSource as? UICollectionViewDiffableDataSource<Int, String>)
2616
2617
  let flow = try XCTUnwrap(list.collectionViewLayout as? NativeListFlowLayout)
2617
2618
  XCTAssertEqual(source.snapshot().itemIdentifiers, (0..<50).map { "row-\($0)" })
2618
- XCTAssertGreaterThan(try XCTUnwrap(flow.tailClip).endY, 360)
2619
- XCTAssertLessThan(try XCTUnwrap(flow.tailClip).endY, 3000)
2620
- let suffixCells = list.visibleCells.filter {
2621
- (list.indexPath(for: $0)?.item ?? -1) >= 6
2622
- }
2623
- XCTAssertFalse(suffixCells.isEmpty)
2624
- XCTAssertTrue(suffixCells.allSatisfy {
2625
- !$0.isUserInteractionEnabled && $0.accessibilityElementsHidden
2626
- })
2627
- XCTAssertEqual(list.contentOffset.y, 1000, accuracy: 1)
2628
- waitForStructuralFrames(0.3)
2619
+ var checkedActiveTail = false
2620
+ func checkActiveTail() {
2621
+ guard let clip = flow.tailClip else { return }
2622
+ checkedActiveTail = true
2623
+ list.layoutIfNeeded()
2624
+ XCTAssertGreaterThanOrEqual(clip.endY, 360)
2625
+ XCTAssertLessThanOrEqual(clip.endY, 3000)
2626
+ let suffixCells = list.visibleCells.filter {
2627
+ (list.indexPath(for: $0)?.item ?? -1) >= 6
2628
+ }
2629
+ if clip.endY > list.contentOffset.y + 60 {
2630
+ XCTAssertFalse(suffixCells.isEmpty)
2631
+ }
2632
+ XCTAssertTrue(suffixCells.allSatisfy {
2633
+ !$0.isUserInteractionEnabled && $0.accessibilityElementsHidden
2634
+ })
2635
+ XCTAssertEqual(list.contentOffset.y, 1000, accuracy: 1)
2636
+ }
2637
+ // Inspect actual active frames instead of assuming a delayed callback lands
2638
+ // inside a 400 ms animation on a busy CI runner.
2639
+ checkActiveTail()
2640
+ let probe = Timer(timeInterval: 1.0 / 60, repeats: true) { _ in checkActiveTail() }
2641
+ RunLoop.main.add(probe, forMode: .common)
2642
+ defer { probe.invalidate() }
2643
+ let finished = XCTNSPredicateExpectation(predicate: NSPredicate { _, _ in
2644
+ flow.tailClip == nil &&
2645
+ Mirror(reflecting: view).descendant("structuralDisplayLink") as? CADisplayLink == nil
2646
+ }, object: nil)
2647
+ wait(for: [finished], timeout: 5)
2648
+ probe.invalidate()
2649
+ XCTAssertTrue(checkedActiveTail)
2629
2650
  list.layoutIfNeeded()
2630
2651
  XCTAssertEqual(source.snapshot().itemIdentifiers, (0..<50).map { "row-\($0)" })
2631
2652
  XCTAssertEqual(list.contentSize.height, 3060, accuracy: 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.7.0-31",
3
+ "version": "6.7.0-33",
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",