@onekeyfe/react-native-pager-view 6.7.0-41 → 6.7.0-44

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
@@ -227,6 +227,13 @@ When C = D, selection restores the destination's saved B. When C < D, effectiveB
227
227
  is zero while the previous saved B remains suspended. Horizontal selection by
228
228
  tap, swipe or an existing programmatic command MUST preserve C throughout.
229
229
 
230
+ On iOS, a fresh page with no saved body offset and fully expanded shared header
231
+ aligns its raw offset to the newly applied negative top inset even while viewport
232
+ or content size is zero. The full restore remains pending until geometry is ready.
233
+ Deferred identity release and pages with retained body/header offsets keep their
234
+ existing restoration path. This prevents painting a new list at raw offset zero
235
+ before its first content measurement; it does not gate business-data insertion.
236
+
230
237
  Alignment, prefetch, replacement, inset changes and pending restoration MUST NOT
231
238
  commit new B. Actual consumed vertical scrolling takes over the visible body
232
239
  position; reaching full collapse during that gesture MUST NOT resurrect the old
@@ -6078,6 +6078,10 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
6078
6078
  restoredLogicalOffset = _headerOffset + (_headerOffset >= _headerHeight ? body : 0);
6079
6079
  if (_transitionPageOffsets != nil) [_transitionCompensatedPages addIndex:pageIndex];
6080
6080
  if (deferredReleasedIdentity || scrollView.bounds.size.height <= 0 || scrollView.contentSize.height <= 0) {
6081
+ // Align a fresh page before content measurement while retaining its pending restore.
6082
+ if (!deferredReleasedIdentity && saved == nil && _headerOffset == 0) {
6083
+ [scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x, -next.top) animated:NO];
6084
+ }
6081
6085
  [_pendingPageRestoreKeys addObject:pageKey];
6082
6086
  _syntheticPageRestore = previousSyntheticRestore;
6083
6087
  return;
@@ -57,6 +57,30 @@ using namespace facebook::react;
57
57
 
58
58
  @implementation RNCCollapsiblePagerFirstFrameTests
59
59
 
60
+ - (void)testFreshZeroGeometryAlignsOffsetBeforePendingRestoreCompletes
61
+ {
62
+ RNCCollapsiblePagerViewComponentView *pager = [RNCCollapsiblePagerViewComponentView new];
63
+ auto props = std::make_shared<RNCCollapsiblePagerViewProps>();
64
+ props->nativeSmoothHeaderScrollEnabled = true;
65
+ props->headerHeight = 120;
66
+ props->stickyHeaderHeight = 44;
67
+ props->pageKeys = "[\"fresh\"]";
68
+ [pager updateProps:props oldProps:nullptr];
69
+ UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectZero];
70
+ [pager applyInsetsToScrollView:scroll pageIndex:0 restore:YES];
71
+ XCTAssertEqualWithAccuracy(scroll.contentInset.top, 164, 0.01);
72
+ XCTAssertEqualWithAccuracy(scroll.contentOffset.y, -164, 0.01);
73
+ XCTAssertEqualWithAccuracy(scroll.contentOffset.y + scroll.contentInset.top, 0, 0.01);
74
+ XCTAssertTrue([[pager valueForKey:@"pendingPageRestoreKeys"] containsObject:@"fresh"]);
75
+
76
+ scroll.frame = CGRectMake(0, 0, 320, 600);
77
+ scroll.contentSize = CGSizeMake(320, 900);
78
+ [pager applyInsetsToScrollView:scroll pageIndex:0 restore:YES];
79
+ XCTAssertEqualWithAccuracy(scroll.contentOffset.y, -164, 0.01);
80
+ XCTAssertFalse([[pager valueForKey:@"pendingPageRestoreKeys"] containsObject:@"fresh"]);
81
+ [pager prepareForRecycle];
82
+ }
83
+
60
84
  - (void)testInactivePagesPrepareTheirOwnStickyInsetsBeforeSelection
61
85
  {
62
86
  RNCCollapsiblePagerViewComponentView *pager = [RNCCollapsiblePagerViewComponentView new];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-pager-view",
3
- "version": "6.7.0-41",
3
+ "version": "6.7.0-44",
4
4
  "description": "React Native wrapper for Android and iOS ViewPager",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",