@onekeyfe/react-native-pager-view 6.7.0-38 → 6.7.0-39

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
@@ -164,6 +164,40 @@ diagnostic compilation and strict-input installation are separate build evidence
164
164
  Market's equal-height secondary display-owner change is an independent consumer
165
165
  companion, not a new SDK public guarantee or JS/native same-frame contract.
166
166
 
167
+ ### iOS 27 pinned stand-in transition edges
168
+
169
+ Status: Implemented; iOS 27 simulator runtime verified for Wallet Home Spot ↔ History.
170
+
171
+ While a local smooth Hard pager's sticky header is pinned (`headerOffset >= headerHeight`),
172
+ every page participating in a horizontal transition keeps the Hard material behind the
173
+ fixed overlay and sticky header. An incoming page whose vertical list cannot render that
174
+ material itself — not mounted yet, not in the pager's window, laid out below the bars, or
175
+ resting at its top edge — receives a stand-in: an empty, noninteractive `UIScrollView`
176
+ placed at the page's origin in the container, sized to the overlay + sticky boundary and
177
+ offset past its top edge, with owned transparent top/sticky element hosts bound to it.
178
+ The stand-in draws only UIKit's Hard material; it carries no snapshot of header or page
179
+ content, and the page itself stays masked above the boundary. A page whose own list is
180
+ scrolled past its top and covers the bars keeps using its own temporary interactions.
181
+ When the header is not pinned no stand-in is created and the page keeps the previous
182
+ temporary interaction on its own list. The stand-in and its hosts live in the pager
183
+ container, so every scroll-edge mask update recomputes their frames from the current page
184
+ origin, page width and overlay + sticky boundary; they are hidden while that geometry is
185
+ empty. Release, completion and recycle
186
+ remove the stand-in with its owned hosts.
187
+
188
+ The fixed boundary separator covers stay in place for the whole transition, falling back to
189
+ the shared overlay and sticky hosts while no settled owner exists, so the Hard dividing line
190
+ does not flash between detach and reattach. On completion the settled page's normal owner is
191
+ attached before the previous transition owner's interactions are removed on the next run
192
+ loop. When a drag returns to its source and the source's adopted interaction still targets
193
+ the settled list on the shared overlay host, that interaction becomes the settled owner
194
+ again instead of being replaced, so the source keeps its material after cancellation.
195
+
196
+ Verified on an iOS 27 simulator: repeated half-drag cancellations followed by a full
197
+ Spot → History → Spot swipe, with frame-by-frame checks showing no black band, no hairline
198
+ flash and no header content above the boundary. Perps/DeFi/NFT pages and non-pinned
199
+ horizontal drags were not exercised at runtime.
200
+
167
201
  ### iOS 27 external-overlay interactive ownership
168
202
 
169
203
  Status: Implemented in iOS source; runtime acceptance is reported separately.
@@ -201,6 +201,7 @@ struct RNCScrollCandidateResolution {
201
201
  @property (nonatomic, assign) BOOL ownsTransitionHosts;
202
202
  @property (nonatomic, strong) UIView *ownedTopHost;
203
203
  @property (nonatomic, strong) UIView *ownedStickyHost;
204
+ @property (nonatomic, strong) UIScrollView *standInScrollView;
204
205
  @end
205
206
 
206
207
  @implementation RNCCollapsiblePagerTransitionEdgeOwner
@@ -2298,6 +2299,9 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
2298
2299
  - (void)adoptCurrentScrollEdgeForProgrammaticTransition:(BOOL)allowExternalOverlay;
2299
2300
  - (RNCCollapsiblePagerTransitionEdgeOwner *)borrowedPinnedStickyOwner;
2300
2301
  - (void)releaseProgrammaticScrollEdge:(UIScrollView *)scrollView;
2302
+ - (BOOL)beginStandInScrollEdgeForPageAtIndex:(NSInteger)pageIndex;
2303
+ - (BOOL)layoutStandInScrollEdgeOwner:(RNCCollapsiblePagerTransitionEdgeOwner *)owner;
2304
+ - (void)layoutStandInScrollEdges;
2301
2305
  - (void)releaseProgrammaticScrollEdgeOwner:(RNCCollapsiblePagerTransitionEdgeOwner *)owner;
2302
2306
  - (void)clearProgrammaticScrollEdges;
2303
2307
  - (void)finishProgrammaticScrollEdges;
@@ -2869,6 +2873,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
2869
2873
 
2870
2874
  - (void)updateScrollEdgeContentMasks
2871
2875
  {
2876
+ [self layoutStandInScrollEdges];
2872
2877
  [self updateHardEdgeSeparatorCovers];
2873
2878
  BOOL enabled = _topScrollEdgeEnabled &&
2874
2879
  (self.hasFixedTopOverlay || _stickyHeaderView != nil) &&
@@ -3149,6 +3154,18 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3149
3154
  for (NSInteger pageIndex = first; pageIndex <= last; pageIndex++) {
3150
3155
  [self preparePageForHorizontalTransitionAtIndex:pageIndex];
3151
3156
  UIScrollView *scrollView = [self verticalScrollViewForPageAtIndex:pageIndex];
3157
+ // A list that is not mounted yet, not laid out under the bars, or not
3158
+ // scrolled past its top cannot render the edge effect behind the bars.
3159
+ BOOL coversBars = scrollView != nil && scrollView.window == self.window &&
3160
+ [scrollView convertPoint:CGPointZero toView:_containerView].y <=
3161
+ [_pageControllers[pageIndex].view convertPoint:CGPointZero toView:_containerView].y + 0.5 &&
3162
+ scrollView.contentOffset.y + scrollView.adjustedContentInset.top > 0.5;
3163
+ // The stand-in applies only while the sticky header is pinned; otherwise
3164
+ // keep the temporary interaction on the page's own list.
3165
+ if (!coversBars && pageIndex != _currentIndex &&
3166
+ [self beginStandInScrollEdgeForPageAtIndex:pageIndex]) {
3167
+ continue;
3168
+ }
3152
3169
  if (scrollView == nil || scrollView.window != self.window) continue;
3153
3170
  if ([_programmaticScrollEdges objectForKey:scrollView] != nil) continue;
3154
3171
  RNCCollapsiblePagerTransitionEdgeOwner *owner = [RNCCollapsiblePagerTransitionEdgeOwner new];
@@ -3229,6 +3246,8 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3229
3246
  owner.stickyInteraction.scrollView = nil;
3230
3247
  [owner.topMarker removeFromSuperview];
3231
3248
  [owner.stickyMarker removeFromSuperview];
3249
+ [owner.standInScrollView removeFromSuperview];
3250
+ owner.standInScrollView = nil;
3232
3251
  if (owner.ownsTransitionHosts) {
3233
3252
  [owner.ownedTopHost removeFromSuperview];
3234
3253
  [owner.ownedStickyHost removeFromSuperview];
@@ -3260,15 +3279,219 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3260
3279
  - (void)finishProgrammaticScrollEdges
3261
3280
  {
3262
3281
  if (_programmaticScrollEdgeOwners.count == 0) return;
3282
+ // OneKey patch: keep the destination's transitional edge alive until the
3283
+ // settled interaction exists, so UIKit does not fade the edge effect back in.
3284
+ UIScrollView *settled = _observedScrollView;
3285
+ RNCCollapsiblePagerTransitionEdgeOwner *handoff =
3286
+ settled != nil ? [_programmaticScrollEdges objectForKey:settled] : nil;
3287
+ if (handoff != nil) {
3288
+ [_programmaticScrollEdges removeObjectForKey:settled];
3289
+ [_programmaticScrollEdgeOwners removeObjectIdenticalTo:handoff];
3290
+ }
3263
3291
  [self clearProgrammaticScrollEdges];
3264
- [self updateTopScrollEdgeForScrollView:_observedScrollView];
3292
+ if (@available(iOS 26.0, *)) {
3293
+ // A cancelled drag settles on the page whose settled edge was adopted.
3294
+ // Return that interaction as-is: a second container interaction for the
3295
+ // same scroll view and host would be torn down together with the old one.
3296
+ if (handoff != nil && !handoff.ownsTransitionHosts && _topEdgeInteraction == nil &&
3297
+ handoff.topHost == _topOverlayHostView &&
3298
+ handoff.topInteraction.scrollView == settled) {
3299
+ _topEdgeInteraction = handoff.topInteraction;
3300
+ _topEdgeInteractionHost = handoff.topHost;
3301
+ _topEdgeMarker = handoff.topMarker;
3302
+ _topEdgeScrollView = settled;
3303
+ _originalTopEdgeStyle = handoff.originalStyle;
3304
+ if (handoff.stickyInteraction != nil && handoff.stickyHost != nil &&
3305
+ handoff.stickyInteraction.scrollView == settled) {
3306
+ _stickyEdgeInteraction = handoff.stickyInteraction;
3307
+ _stickyEdgeInteractionHost = handoff.stickyHost;
3308
+ _stickyEdgeMarker = handoff.stickyMarker;
3309
+ } else {
3310
+ [handoff.stickyHost removeInteraction:handoff.stickyInteraction];
3311
+ handoff.stickyInteraction.scrollView = nil;
3312
+ [handoff.stickyMarker removeFromSuperview];
3313
+ }
3314
+ if (handoff.borrowsPinnedStickyHost && !_stickyHeaderIsPinned &&
3315
+ (_pinnedStickyHostView.superview == settled ||
3316
+ _pinnedStickyHostView.superview == nil)) {
3317
+ _pinnedStickyHostView.hidden = YES;
3318
+ _pinnedStickyHostView.layer.zPosition = 0;
3319
+ [_containerView addSubview:_pinnedStickyHostView];
3320
+ }
3321
+ [self updateTopScrollEdgeForScrollView:settled];
3322
+ return;
3323
+ }
3324
+ }
3325
+ [self updateTopScrollEdgeForScrollView:settled];
3326
+ if (handoff == nil) return;
3327
+ if (@available(iOS 26.0, *)) {
3328
+ if (_topEdgeScrollView == settled && settled != nil) {
3329
+ _originalTopEdgeStyle = handoff.originalStyle;
3330
+ handoff.originalStyle = settled.topEdgeEffect.style;
3331
+ }
3332
+ }
3333
+ if (handoff.borrowsPinnedStickyHost && !_stickyHeaderIsPinned &&
3334
+ (_pinnedStickyHostView.superview == settled ||
3335
+ _pinnedStickyHostView.superview == nil)) {
3336
+ _pinnedStickyHostView.hidden = YES;
3337
+ _pinnedStickyHostView.layer.zPosition = 0;
3338
+ [_containerView addSubview:_pinnedStickyHostView];
3339
+ }
3340
+ handoff.borrowsPinnedStickyHost = NO;
3341
+ // The caller reattaches the shared header in this run loop turn; drop the
3342
+ // transitional resources on the next one, after the header is rendered.
3343
+ dispatch_async(dispatch_get_main_queue(), ^{
3344
+ if (@available(iOS 26.0, *)) {
3345
+ [handoff.topHost removeInteraction:handoff.topInteraction];
3346
+ [handoff.stickyHost removeInteraction:handoff.stickyInteraction];
3347
+ if (handoff.topInteraction.scrollView == handoff.scrollView) {
3348
+ handoff.topInteraction.scrollView = nil;
3349
+ }
3350
+ if (handoff.stickyInteraction.scrollView == handoff.scrollView) {
3351
+ handoff.stickyInteraction.scrollView = nil;
3352
+ }
3353
+ }
3354
+ [handoff.topMarker removeFromSuperview];
3355
+ [handoff.stickyMarker removeFromSuperview];
3356
+ if (handoff.ownsTransitionHosts) {
3357
+ [handoff.ownedTopHost removeFromSuperview];
3358
+ [handoff.ownedStickyHost removeFromSuperview];
3359
+ }
3360
+ });
3361
+ }
3362
+
3363
+ - (BOOL)beginStandInScrollEdgeForPageAtIndex:(NSInteger)pageIndex
3364
+ {
3365
+ // OneKey patch: a page whose list is not mounted yet has no scroll view to
3366
+ // own an edge effect, so its masked top shows the bare background. An empty
3367
+ // stand-in scroll view resting past its top edge renders the same Hard
3368
+ // material (the settled header is masked out under the overlay as well).
3369
+ if (@available(iOS 27.0, *)) {
3370
+ if (pageIndex == _currentIndex || pageIndex < 0 ||
3371
+ pageIndex >= (NSInteger)_pageControllers.count) return NO;
3372
+ UIView *page = _pageControllers[pageIndex].view;
3373
+ UIView *container = page.superview;
3374
+ if (page.window != self.window || container == nil ||
3375
+ _stickyHeaderView == nil || _headerHeight <= 0 ||
3376
+ _headerOffset < _headerHeight - 0.5) return NO;
3377
+ for (RNCCollapsiblePagerTransitionEdgeOwner *existing in _programmaticScrollEdgeOwners) {
3378
+ if (existing.page == page) return YES;
3379
+ }
3380
+ CGFloat boundary = self.effectiveTopOverlayHeight + self.currentStickyHeaderHeight;
3381
+ CGFloat pageTop = [page convertPoint:CGPointZero toView:_containerView].y;
3382
+ if (boundary - pageTop <= 0 || CGRectGetWidth(page.bounds) <= 0) return NO;
3383
+ UIScrollView *standIn = [UIScrollView new];
3384
+ standIn.userInteractionEnabled = NO;
3385
+ standIn.scrollsToTop = NO;
3386
+ standIn.showsVerticalScrollIndicator = NO;
3387
+ standIn.showsHorizontalScrollIndicator = NO;
3388
+ standIn.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
3389
+ standIn.backgroundColor = UIColor.clearColor;
3390
+ standIn.accessibilityElementsHidden = YES;
3391
+ standIn.topEdgeEffect.style = UIScrollEdgeEffectStyle.hardStyle;
3392
+ [container insertSubview:standIn aboveSubview:page];
3393
+
3394
+ RNCCollapsiblePagerTransitionEdgeOwner *owner = [RNCCollapsiblePagerTransitionEdgeOwner new];
3395
+ owner.scrollView = standIn;
3396
+ owner.page = page;
3397
+ owner.standInScrollView = standIn;
3398
+ owner.originalStyle = UIScrollEdgeEffectStyle.hardStyle;
3399
+ owner.ownsTransitionHosts = YES;
3400
+ UIView *(^host)(void) = ^UIView *(void) {
3401
+ UIView *view = [UIView new];
3402
+ view.userInteractionEnabled = NO;
3403
+ view.accessibilityElementsHidden = YES;
3404
+ [container insertSubview:view aboveSubview:standIn];
3405
+ UILabel *marker = [UILabel new];
3406
+ marker.frame = view.bounds;
3407
+ marker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
3408
+ marker.text = @" ";
3409
+ marker.textColor = UIColor.clearColor;
3410
+ marker.backgroundColor = UIColor.clearColor;
3411
+ marker.isAccessibilityElement = NO;
3412
+ [view addSubview:marker];
3413
+ return view;
3414
+ };
3415
+ owner.ownedTopHost = host();
3416
+ owner.topHost = owner.ownedTopHost;
3417
+ owner.topInteraction = [UIScrollEdgeElementContainerInteraction new];
3418
+ owner.topInteraction.edge = UIRectEdgeTop;
3419
+ owner.topInteraction.scrollView = standIn;
3420
+ [owner.topHost addInteraction:owner.topInteraction];
3421
+ owner.ownedStickyHost = host();
3422
+ owner.stickyHost = owner.ownedStickyHost;
3423
+ owner.stickyInteraction = [UIScrollEdgeElementContainerInteraction new];
3424
+ owner.stickyInteraction.edge = UIRectEdgeTop;
3425
+ owner.stickyInteraction.scrollView = standIn;
3426
+ [owner.stickyHost addInteraction:owner.stickyInteraction];
3427
+ if (_programmaticScrollEdges == nil) {
3428
+ _programmaticScrollEdges = [NSMapTable weakToStrongObjectsMapTable];
3429
+ _programmaticScrollEdgeOwners = [NSMutableArray new];
3430
+ }
3431
+ [self layoutStandInScrollEdgeOwner:owner];
3432
+ [_programmaticScrollEdges setObject:owner forKey:standIn];
3433
+ [_programmaticScrollEdgeOwners addObject:owner];
3434
+ return YES;
3435
+ }
3436
+ return NO;
3437
+ }
3438
+
3439
+ // Stand-ins live in the pager container rather than inside their page, so they
3440
+ // do not follow page or header geometry on their own. Recompute them from the
3441
+ // current page origin and overlay + sticky boundary on every layout pass.
3442
+ - (BOOL)layoutStandInScrollEdgeOwner:(RNCCollapsiblePagerTransitionEdgeOwner *)owner
3443
+ {
3444
+ UIScrollView *standIn = owner.standInScrollView;
3445
+ UIView *page = owner.page;
3446
+ UIView *container = standIn.superview;
3447
+ BOOL valid = standIn != nil && page != nil && container != nil &&
3448
+ page.superview == container && _containerView != nil;
3449
+ CGFloat width = valid ? CGRectGetWidth(page.bounds) : 0;
3450
+ CGFloat height = 0;
3451
+ CGPoint origin = CGPointZero;
3452
+ if (valid) {
3453
+ CGFloat boundary = self.effectiveTopOverlayHeight + self.currentStickyHeaderHeight;
3454
+ height = boundary - [page convertPoint:CGPointZero toView:_containerView].y;
3455
+ origin = [page convertPoint:CGPointZero toView:container];
3456
+ valid = width > 0 && height > 0;
3457
+ }
3458
+ standIn.hidden = !valid;
3459
+ owner.ownedTopHost.hidden = !valid;
3460
+ owner.ownedStickyHost.hidden = !valid;
3461
+ if (!valid) return NO;
3462
+ CGRect frame = CGRectMake(origin.x, origin.y, width, height);
3463
+ if (!CGRectEqualToRect(standIn.frame, frame)) standIn.frame = frame;
3464
+ // Rest past the top edge so UIKit draws the edge material.
3465
+ CGFloat scrolled = MAX(_headerHeight, 1);
3466
+ CGSize contentSize = CGSizeMake(width, scrolled + height + 1);
3467
+ if (!CGSizeEqualToSize(standIn.contentSize, contentSize)) standIn.contentSize = contentSize;
3468
+ if (standIn.contentOffset.y != scrolled) standIn.contentOffset = CGPointMake(0, scrolled);
3469
+ void (^place)(UIView *, UIView *) = ^(UIView *host, UIView *reference) {
3470
+ if (host == nil) return;
3471
+ CGRect hostFrame = reference != nil
3472
+ ? [reference convertRect:reference.bounds toView:container] : CGRectZero;
3473
+ hostFrame.origin.x = origin.x;
3474
+ hostFrame.size.width = width;
3475
+ if (!CGRectEqualToRect(host.frame, hostFrame)) host.frame = hostFrame;
3476
+ };
3477
+ place(owner.ownedTopHost, _topOverlayHostView);
3478
+ place(owner.ownedStickyHost, _stickyHeaderView);
3479
+ return YES;
3480
+ }
3481
+
3482
+ - (void)layoutStandInScrollEdges
3483
+ {
3484
+ for (RNCCollapsiblePagerTransitionEdgeOwner *owner in _programmaticScrollEdgeOwners) {
3485
+ if (owner.standInScrollView != nil) [self layoutStandInScrollEdgeOwner:owner];
3486
+ }
3265
3487
  }
3266
3488
 
3267
3489
  - (BOOL)hasProgrammaticScrollEdgeForPage:(UIView *)page
3268
3490
  {
3269
3491
  if (@available(iOS 26.0, *)) {
3270
3492
  for (RNCCollapsiblePagerTransitionEdgeOwner *owner in _programmaticScrollEdges.objectEnumerator) {
3271
- if (owner.page == page && owner.scrollView.window == self.window &&
3493
+ if (owner.page == page && owner.standInScrollView == nil &&
3494
+ owner.scrollView.window == self.window &&
3272
3495
  owner.topInteraction.scrollView == owner.scrollView) return YES;
3273
3496
  }
3274
3497
  }
@@ -3381,10 +3604,22 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3381
3604
 
3382
3605
  - (void)updateHardEdgeSeparatorCovers
3383
3606
  {
3607
+ // OneKey patch: transitional edge owners draw the same Hard hairline while
3608
+ // the settled interaction is detached, so keep the covers during transitions.
3609
+ BOOL transitional = _programmaticScrollEdgeOwners.count > 0;
3384
3610
  BOOL enabled = _topScrollEdgeEnabled &&
3385
3611
  _topScrollEdgeEffect == RNCCollapsiblePagerViewTopScrollEdgeEffect::Hard &&
3386
- _topEdgeScrollView != nil && self.window != nil && !_isBeingRecycled;
3612
+ (_topEdgeScrollView != nil || transitional) && self.window != nil && !_isBeingRecycled;
3387
3613
  if (!enabled && _topEdgeSeparatorCover == nil && _stickyEdgeSeparatorCover == nil) return;
3614
+ BOOL transitionalSticky = NO;
3615
+ if (transitional && _topEdgeScrollView == nil) {
3616
+ for (RNCCollapsiblePagerTransitionEdgeOwner *owner in _programmaticScrollEdgeOwners) {
3617
+ if (owner.stickyInteraction != nil) {
3618
+ transitionalSticky = YES;
3619
+ break;
3620
+ }
3621
+ }
3622
+ }
3388
3623
  UIColor *color = nil;
3389
3624
  for (UIView *view = self; view != nil; view = view.superview) {
3390
3625
  UIColor *candidate = [view.backgroundColor resolvedColorWithTraitCollection:
@@ -3398,7 +3633,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3398
3633
  _topOverlayHostView.traitCollection];
3399
3634
  CGFloat scale = self.window.screen.scale ?: self.traitCollection.displayScale;
3400
3635
  CGFloat pixel = 1.0 / MAX(1, scale);
3401
- UIView *hosts[] = {_topEdgeInteractionHost, _stickyEdgeInteractionHost};
3636
+ UIView *topHost = _topEdgeInteractionHost;
3637
+ UIView *stickyHost = _stickyEdgeInteractionHost;
3638
+ if (_topEdgeScrollView == nil && transitional) {
3639
+ topHost = _topOverlayHostView;
3640
+ stickyHost = transitionalSticky ? _stickyHeaderView : nil;
3641
+ }
3642
+ UIView *hosts[] = {topHost, stickyHost};
3402
3643
  CALayer *covers[] = {_topEdgeSeparatorCover, _stickyEdgeSeparatorCover};
3403
3644
  for (NSInteger index = 0; index < 2; index++) {
3404
3645
  UIView *host = hosts[index];
@@ -3421,7 +3662,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
3421
3662
  CGRectGetWidth(_containerView.bounds), pixel);
3422
3663
  cover.contentsScale = scale;
3423
3664
  cover.backgroundColor = color.CGColor;
3424
- cover.hidden = index == 0 && _stickyHeaderIsPinned;
3665
+ cover.hidden = index == 0 && (_stickyHeaderIsPinned || transitionalSticky);
3425
3666
  }
3426
3667
  if (index == 0) _topEdgeSeparatorCover = cover;
3427
3668
  else _stickyEdgeSeparatorCover = cover;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-pager-view",
3
- "version": "6.7.0-38",
3
+ "version": "6.7.0-39",
4
4
  "description": "React Native wrapper for Android and iOS ViewPager",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",