@onekeyfe/react-native-pager-view 6.7.0-26 → 6.7.0-28
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/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +3 -0
- package/docs/SPEC.md +25 -0
- package/ios/RNCCollapsiblePagerViewComponentView.mm +42 -19
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +21 -0
- package/lib/module/CollapsiblePagerView.js +2 -0
- package/lib/module/CollapsiblePagerView.web.js +1 -0
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +1 -0
- package/lib/typescript/src/CollapsiblePagerView.d.ts +3 -1
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +1 -0
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +1 -0
- package/package.json +1 -1
- package/src/CollapsiblePagerView.tsx +13 -0
- package/src/CollapsiblePagerView.web.tsx +2 -0
- package/src/CollapsiblePagerViewNativeComponent.ts +1 -0
|
@@ -210,6 +210,9 @@ class CollapsiblePagerViewManager : ViewGroupManager<CollapsiblePagerHost>(),
|
|
|
210
210
|
view?.stickyHeaderHeightPx = PixelUtil.toPixelFromDIP(value.toDouble()).roundToInt()
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
@ReactProp(name = "stickyHeaderHeights")
|
|
214
|
+
override fun setStickyHeaderHeights(view: CollapsiblePagerHost?, value: String?) = Unit
|
|
215
|
+
|
|
213
216
|
// The scroll-edge effect and external overlay are UIKit-only.
|
|
214
217
|
@ReactProp(name = "topScrollEdgeEffect")
|
|
215
218
|
override fun setTopScrollEdgeEffect(view: CollapsiblePagerHost?, value: String?) = Unit
|
package/docs/SPEC.md
CHANGED
|
@@ -225,6 +225,31 @@ behavior. Vertical scrolling, refresh, snapping and repeated-current-tab behavio
|
|
|
225
225
|
are unchanged. This state belongs to native UI instances, with no new React prop
|
|
226
226
|
or per-frame JavaScript synchronization.
|
|
227
227
|
|
|
228
|
+
## Per-page sticky header geometry
|
|
229
|
+
|
|
230
|
+
Status: implemented in source. iOS 26.5 simulator recordings cover Market
|
|
231
|
+
home taps and swipes and stock detail taps, including expanded and collapsed
|
|
232
|
+
headers with empty destinations. Swipe cancellation and filled positions
|
|
233
|
+
remain outside that runtime evidence.
|
|
234
|
+
|
|
235
|
+
On iOS, an optional `stickyHeaderHeights` array supplies the sticky height in
|
|
236
|
+
points for each child, in the same order as the children. The shared
|
|
237
|
+
`stickyHeaderHeight` is the default for any missing or invalid value. The
|
|
238
|
+
JavaScript wrapper sends at most one nonnegative integer per child. Android
|
|
239
|
+
and Web continue to use the shared height.
|
|
240
|
+
|
|
241
|
+
The native pager applies the destination's inset when preparing it for
|
|
242
|
+
display. During a horizontal transition, each page keeps its own inset and
|
|
243
|
+
the shared sticky slot uses the current page's height. Selection switches the
|
|
244
|
+
slot to the destination's height without changing the shared collapse
|
|
245
|
+
distance or the remembered body position. Cancelling a swipe restores the
|
|
246
|
+
source geometry. Updating the height array refreshes owned insets. Recycling
|
|
247
|
+
clears the array along with page identity.
|
|
248
|
+
|
|
249
|
+
Acceptance covers adjacent and distant taps, horizontal swipe completion and
|
|
250
|
+
cancellation, different heights at the top and after collapse, and a return
|
|
251
|
+
to the prior page without vertical drift.
|
|
252
|
+
|
|
228
253
|
## Current-page top commands
|
|
229
254
|
|
|
230
255
|
`scrollToPageTop(options?: Readonly<{ animated?: boolean }>)` restores the current
|
|
@@ -2207,6 +2207,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2207
2207
|
- (void)attachSharedHeadersToScrollView:(UIScrollView *)scrollView;
|
|
2208
2208
|
- (void)liftSharedHeadersForPagerTransition:(NSString *)reason;
|
|
2209
2209
|
- (void)restoreSharedHeadersToContainer;
|
|
2210
|
+
- (NSInteger)currentStickyHeaderHeight;
|
|
2210
2211
|
- (void)layoutSharedHeaders;
|
|
2211
2212
|
- (void)bringReservedStickyControlToFront;
|
|
2212
2213
|
- (void)restorePinnedStickyHeader;
|
|
@@ -2290,6 +2291,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2290
2291
|
NSInteger _pendingInitialPage;
|
|
2291
2292
|
NSInteger _headerHeight;
|
|
2292
2293
|
NSInteger _stickyHeaderHeight;
|
|
2294
|
+
NSArray *_stickyHeaderHeights;
|
|
2293
2295
|
CGFloat _topOverlayHeight;
|
|
2294
2296
|
NSInteger _externalTopOverlayTag;
|
|
2295
2297
|
__weak UIView *_externalTopOverlayView;
|
|
@@ -2637,7 +2639,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2637
2639
|
[self updateHeaderSettledStateForceBusy:NO];
|
|
2638
2640
|
[self logHomeVisualGeometry:@"window" scrollView:_observedScrollView];
|
|
2639
2641
|
for (UIScrollView *scrollView in _originalInsets.keyEnumerator) {
|
|
2640
|
-
[self updateNativeScrollerViewport:scrollView stickyHeight:self.window == nil ? 0 :
|
|
2642
|
+
[self updateNativeScrollerViewport:scrollView stickyHeight:self.window == nil ? 0 : self.currentStickyHeaderHeight + self.effectiveTopOverlayHeight];
|
|
2641
2643
|
}
|
|
2642
2644
|
if (externalHeightChanged) [self reapplyInsetsToObservedScrollView];
|
|
2643
2645
|
// OneKey patch: removing a decelerating page from its window can suppress
|
|
@@ -2981,7 +2983,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2981
2983
|
(long)self.tag, (unsigned long)_generation, (long)_currentIndex,
|
|
2982
2984
|
opacity, collapse, (CGFloat)_headerHeight, overlayBottom,
|
|
2983
2985
|
CGRectGetMinY(headerWindow), overlayBottom + _headerHeight +
|
|
2984
|
-
|
|
2986
|
+
self.currentStickyHeaderHeight - collapse, _topEdgeInteraction.scrollView == scrollView,
|
|
2985
2987
|
red, green, blue, alpha]);
|
|
2986
2988
|
}
|
|
2987
2989
|
#endif
|
|
@@ -3645,10 +3647,22 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3645
3647
|
reason ?: @"unknown"]);
|
|
3646
3648
|
}
|
|
3647
3649
|
|
|
3650
|
+
- (NSInteger)stickyHeaderHeightForPageIndex:(NSInteger)index
|
|
3651
|
+
{
|
|
3652
|
+
if (index < 0 || index >= (NSInteger)_stickyHeaderHeights.count) return _stickyHeaderHeight;
|
|
3653
|
+
id value = _stickyHeaderHeights[index];
|
|
3654
|
+
return [value isKindOfClass:NSNumber.class] ? MAX(0, [value integerValue]) : _stickyHeaderHeight;
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
- (NSInteger)currentStickyHeaderHeight
|
|
3658
|
+
{
|
|
3659
|
+
return [self stickyHeaderHeightForPageIndex:_currentIndex];
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3648
3662
|
- (void)layoutSharedHeaders
|
|
3649
3663
|
{
|
|
3650
3664
|
CGFloat width = CGRectGetWidth(self.bounds);
|
|
3651
|
-
CGFloat totalHeight = _headerHeight +
|
|
3665
|
+
CGFloat totalHeight = _headerHeight + self.currentStickyHeaderHeight;
|
|
3652
3666
|
BOOL attachedToList = _nativeSmoothHeaderScrollEnabled &&
|
|
3653
3667
|
_sharedHeaderScrollView != nil && !_sharedHeadersLiftedForPagerTransition;
|
|
3654
3668
|
|
|
@@ -3673,12 +3687,12 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3673
3687
|
fromView:_containerView]
|
|
3674
3688
|
: CGPointMake(0, self.effectiveTopOverlayHeight);
|
|
3675
3689
|
_pinnedStickyHostView.frame = CGRectMake(
|
|
3676
|
-
pinnedOrigin.x, pinnedOrigin.y, width,
|
|
3690
|
+
pinnedOrigin.x, pinnedOrigin.y, width, self.currentStickyHeaderHeight);
|
|
3677
3691
|
CGFloat stickyChildY = _stickyHeaderIsPinned ? 0 : stickyY;
|
|
3678
|
-
_stickyHeaderView.frame = CGRectMake(0, stickyChildY, width,
|
|
3692
|
+
_stickyHeaderView.frame = CGRectMake(0, stickyChildY, width, self.currentStickyHeaderHeight);
|
|
3679
3693
|
CGFloat nativeTabBarVisibleHeight = _nativeTabBarView.hidden
|
|
3680
3694
|
? 0
|
|
3681
|
-
: MIN(
|
|
3695
|
+
: MIN(self.currentStickyHeaderHeight, _nativeTabBarHeight);
|
|
3682
3696
|
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
3683
3697
|
_nativeTabBarView.frame = CGRectMake(
|
|
3684
3698
|
self.isLtrLayout ? 0 : tabReservedWidth,
|
|
@@ -3691,7 +3705,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3691
3705
|
stickyChildY + nativeTabBarVisibleHeight,
|
|
3692
3706
|
width,
|
|
3693
3707
|
MIN(
|
|
3694
|
-
MAX(0,
|
|
3708
|
+
MAX(0, self.currentStickyHeaderHeight - nativeTabBarVisibleHeight),
|
|
3695
3709
|
_nativeSubHeaderHeight
|
|
3696
3710
|
)
|
|
3697
3711
|
);
|
|
@@ -3744,7 +3758,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3744
3758
|
CGPoint origin = [scrollView convertPoint:CGPointMake(0, self.effectiveTopOverlayHeight)
|
|
3745
3759
|
fromView:_containerView];
|
|
3746
3760
|
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y,
|
|
3747
|
-
CGRectGetWidth(self.bounds),
|
|
3761
|
+
CGRectGetWidth(self.bounds), self.currentStickyHeaderHeight);
|
|
3748
3762
|
}
|
|
3749
3763
|
return;
|
|
3750
3764
|
}
|
|
@@ -3762,13 +3776,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3762
3776
|
[host addSubview:_nativeSubHeaderView];
|
|
3763
3777
|
CGFloat childY = shouldPin ? 0 : _headerHeight;
|
|
3764
3778
|
CGFloat width = CGRectGetWidth(self.bounds);
|
|
3765
|
-
CGFloat tabHeight = _nativeTabBarView.hidden ? 0 : MIN(
|
|
3779
|
+
CGFloat tabHeight = _nativeTabBarView.hidden ? 0 : MIN(self.currentStickyHeaderHeight, _nativeTabBarHeight);
|
|
3766
3780
|
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
3767
|
-
_stickyHeaderView.frame = CGRectMake(0, childY, width,
|
|
3781
|
+
_stickyHeaderView.frame = CGRectMake(0, childY, width, self.currentStickyHeaderHeight);
|
|
3768
3782
|
_nativeTabBarView.frame = CGRectMake(self.isLtrLayout ? 0 : tabReservedWidth,
|
|
3769
3783
|
childY, width - tabReservedWidth, tabHeight);
|
|
3770
3784
|
_nativeSubHeaderView.frame = CGRectMake(0, childY + tabHeight, width,
|
|
3771
|
-
MIN(MAX(0,
|
|
3785
|
+
MIN(MAX(0, self.currentStickyHeaderHeight - tabHeight), _nativeSubHeaderHeight));
|
|
3772
3786
|
_pinnedStickyHostView.hidden = !shouldPin;
|
|
3773
3787
|
if ([_pagerScrollView isKindOfClass:RNCCollapsiblePagerDirectScrollView.class]) {
|
|
3774
3788
|
((RNCCollapsiblePagerDirectScrollView *)_pagerScrollView).excludedHeaderView =
|
|
@@ -3779,7 +3793,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3779
3793
|
_pinnedStickyHostView.layer.zPosition = 1000;
|
|
3780
3794
|
CGPoint origin = [scrollView convertPoint:CGPointMake(0, self.effectiveTopOverlayHeight)
|
|
3781
3795
|
fromView:_containerView];
|
|
3782
|
-
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y, width,
|
|
3796
|
+
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y, width, self.currentStickyHeaderHeight);
|
|
3783
3797
|
} else {
|
|
3784
3798
|
_pinnedStickyHostView.layer.zPosition = 0;
|
|
3785
3799
|
[_containerView addSubview:_pinnedStickyHostView];
|
|
@@ -4478,6 +4492,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
4478
4492
|
_pendingInitialPage = 0;
|
|
4479
4493
|
_headerHeight = 0;
|
|
4480
4494
|
_stickyHeaderHeight = 0;
|
|
4495
|
+
_stickyHeaderHeights = nil;
|
|
4481
4496
|
_topOverlayHeight = 0;
|
|
4482
4497
|
_externalTopOverlayTag = 0;
|
|
4483
4498
|
_externalTopOverlayView = nil;
|
|
@@ -4592,6 +4607,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
4592
4607
|
_stickyHeaderHeight = MAX(0, newViewProps.stickyHeaderHeight);
|
|
4593
4608
|
insetsChanged = YES;
|
|
4594
4609
|
}
|
|
4610
|
+
if (_needsPropsReapply || oldViewProps.stickyHeaderHeights != newViewProps.stickyHeaderHeights) {
|
|
4611
|
+
NSString *json = RCTNSStringFromString(newViewProps.stickyHeaderHeights);
|
|
4612
|
+
NSData *data = [json dataUsingEncoding:NSUTF8StringEncoding];
|
|
4613
|
+
id parsed = data.length == 0 ? nil : [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
4614
|
+
_stickyHeaderHeights = [parsed isKindOfClass:NSArray.class] ? parsed : nil;
|
|
4615
|
+
insetsChanged = YES;
|
|
4616
|
+
}
|
|
4595
4617
|
if (_needsPropsReapply || oldViewProps.topScrollEdgeEffect != newViewProps.topScrollEdgeEffect) {
|
|
4596
4618
|
BOOL enabled = newViewProps.topScrollEdgeEffect != RNCCollapsiblePagerViewTopScrollEdgeEffect::None;
|
|
4597
4619
|
BOOL enabledChanged = _topScrollEdgeEnabled != enabled;
|
|
@@ -5412,7 +5434,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5412
5434
|
[_managedRefreshControls removeObjectForKey:scrollView];
|
|
5413
5435
|
if (current != nil) [_managedRefreshControls setObject:current forKey:scrollView];
|
|
5414
5436
|
}
|
|
5415
|
-
[RNCRefreshControlOffsetState setOffset:_headerHeight +
|
|
5437
|
+
[RNCRefreshControlOffsetState setOffset:_headerHeight + self.currentStickyHeaderHeight
|
|
5416
5438
|
forControl:current owner:self];
|
|
5417
5439
|
if (previous != current) [self logHomeVisualGeometry:@"refresh-bind" scrollView:scrollView];
|
|
5418
5440
|
}
|
|
@@ -5442,7 +5464,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5442
5464
|
NSString *signature = [NSString stringWithFormat:
|
|
5443
5465
|
@"%.1f:%ld:%ld:%.1f:%d:%.1f:%.1f:%.1f:%d:%d",
|
|
5444
5466
|
self.effectiveTopOverlayHeight, (long)_headerHeight,
|
|
5445
|
-
(long)
|
|
5467
|
+
(long)self.currentStickyHeaderHeight, scrollView.contentInset.top, control != nil,
|
|
5446
5468
|
CGRectGetMinY(maskWindow), CGRectGetHeight(maskWindow), _pageMaskBoundary,
|
|
5447
5469
|
_stickyHeaderIsPinned, _topScrollEdgeEnabled];
|
|
5448
5470
|
if (layoutPhase && now - _homeVisualStartMono >= 2.0 &&
|
|
@@ -5467,7 +5489,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5467
5489
|
@"[IOS-HOME-VISUAL] epochMs=%.0f monoMs=%.0f phase=%@ pagerTag=%ld generation=%lu pageIndex=%ld window=%d edge=%d overlay=%.1f header=%ld sticky=%ld collapse=%.1f scrollY=%.1f insetTop=%.1f overscroll=%.1f refresh=%d refreshing=%d controlY=%.1f controlH=%.1f sublayerY=%.1f visualYEstimate=%.1f overlayY=%.1f overlayBottom=%.1f stickyY=%.1f stickyBottom=%.1f maskY=%.1f maskH=%.1f pageMaskWindowY=%.1f",
|
|
5468
5490
|
epochMs, monoMs, phase, (long)self.tag, (unsigned long)_generation,
|
|
5469
5491
|
(long)_currentIndex, self.window != nil, _topScrollEdgeEnabled,
|
|
5470
|
-
self.effectiveTopOverlayHeight, (long)_headerHeight, (long)
|
|
5492
|
+
self.effectiveTopOverlayHeight, (long)_headerHeight, (long)self.currentStickyHeaderHeight,
|
|
5471
5493
|
_headerOffset, scrollView.contentOffset.y, scrollView.contentInset.top,
|
|
5472
5494
|
overscroll, control != nil, control.isRefreshing,
|
|
5473
5495
|
CGRectGetMinY(controlWindow), CGRectGetHeight(controlWindow),
|
|
@@ -5702,7 +5724,8 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5702
5724
|
// suppress its later vertical movement while the pager is still pending.
|
|
5703
5725
|
scrollView.directionalLockEnabled = _nativeSmoothHeaderScrollEnabled
|
|
5704
5726
|
? NO : [_originalDirectionalLockEnabled objectForKey:scrollView].boolValue;
|
|
5705
|
-
|
|
5727
|
+
CGFloat stickyHeight = [self stickyHeaderHeightForPageIndex:pageIndex];
|
|
5728
|
+
[self updateNativeScrollerViewport:scrollView stickyHeight:stickyHeight + self.effectiveTopOverlayHeight];
|
|
5706
5729
|
[self updateRefreshControlForScrollView:scrollView];
|
|
5707
5730
|
CGFloat previousTopInset = scrollView.contentInset.top;
|
|
5708
5731
|
CGFloat previousLogicalOffset = scrollView.contentOffset.y + previousTopInset;
|
|
@@ -5713,13 +5736,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5713
5736
|
CGFloat refreshInset = appliedTop != nil && scrollView.refreshControl != nil
|
|
5714
5737
|
? MAX(0, previousTopInset - appliedTop.doubleValue) : 0;
|
|
5715
5738
|
UIEdgeInsets next = original;
|
|
5716
|
-
next.top += self.effectiveTopOverlayHeight + _headerHeight +
|
|
5739
|
+
next.top += self.effectiveTopOverlayHeight + _headerHeight + stickyHeight;
|
|
5717
5740
|
CGFloat pagerTopInset = next.top;
|
|
5718
5741
|
next.top += refreshInset;
|
|
5719
5742
|
[_appliedTopInsets setObject:@(pagerTopInset) forKey:scrollView];
|
|
5720
5743
|
// Short pages still need enough range to collapse the header; long pages
|
|
5721
5744
|
// must end at the last row rather than leave a header-sized blank footer.
|
|
5722
|
-
next.bottom += MAX(0, scrollView.bounds.size.height -
|
|
5745
|
+
next.bottom += MAX(0, scrollView.bounds.size.height - stickyHeight - self.effectiveTopOverlayHeight
|
|
5723
5746
|
- original.top - original.bottom - scrollView.contentSize.height);
|
|
5724
5747
|
if (UIEdgeInsetsEqualToEdgeInsets(scrollView.contentInset, next) && !restore) {
|
|
5725
5748
|
// UICollectionView may report contentSize during a bounce without changing
|
|
@@ -6659,7 +6682,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
6659
6682
|
UIEdgeInsets adjustedInset = owner.adjustedContentInset;
|
|
6660
6683
|
NSString *geometry = [NSString stringWithFormat:
|
|
6661
6684
|
@"%.4f:%ld:%ld:%@:%@:%@:%@:%@:%@:%@",
|
|
6662
|
-
_headerOffset, (long)_headerHeight, (long)
|
|
6685
|
+
_headerOffset, (long)_headerHeight, (long)self.currentStickyHeaderHeight,
|
|
6663
6686
|
NSStringFromCGPoint(owner.contentOffset), NSStringFromCGSize(owner.contentSize),
|
|
6664
6687
|
NSStringFromCGRect(owner.bounds), NSStringFromUIEdgeInsets(inset),
|
|
6665
6688
|
NSStringFromUIEdgeInsets(adjustedInset), NSStringFromCGRect(headerRect), NSStringFromCGRect(ownerRect)];
|
|
@@ -57,6 +57,27 @@ using namespace facebook::react;
|
|
|
57
57
|
|
|
58
58
|
@implementation RNCCollapsiblePagerFirstFrameTests
|
|
59
59
|
|
|
60
|
+
- (void)testInactivePagesPrepareTheirOwnStickyInsetsBeforeSelection
|
|
61
|
+
{
|
|
62
|
+
RNCCollapsiblePagerViewComponentView *pager = [RNCCollapsiblePagerViewComponentView new];
|
|
63
|
+
auto props = std::make_shared<RNCCollapsiblePagerViewProps>();
|
|
64
|
+
props->headerHeight = 64;
|
|
65
|
+
props->stickyHeaderHeight = 44;
|
|
66
|
+
props->stickyHeaderHeights = "[44,132]";
|
|
67
|
+
[pager updateProps:props oldProps:nullptr];
|
|
68
|
+
UIScrollView *source = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 600)];
|
|
69
|
+
UIScrollView *destination = [[UIScrollView alloc] initWithFrame:source.frame];
|
|
70
|
+
source.contentSize = CGSizeMake(320, 900);
|
|
71
|
+
destination.contentSize = source.contentSize;
|
|
72
|
+
|
|
73
|
+
[pager applyInsetsToScrollView:source pageIndex:0 restore:NO];
|
|
74
|
+
[pager applyInsetsToScrollView:destination pageIndex:1 restore:NO];
|
|
75
|
+
XCTAssertEqualWithAccuracy(source.contentInset.top, 108, 0.01);
|
|
76
|
+
XCTAssertEqualWithAccuracy(destination.contentInset.top, 196, 0.01);
|
|
77
|
+
XCTAssertEqualWithAccuracy(destination.contentOffset.y, -196, 0.01);
|
|
78
|
+
XCTAssertEqualWithAccuracy(source.contentOffset.y, -108, 0.01);
|
|
79
|
+
}
|
|
80
|
+
|
|
60
81
|
- (void)testPendingLocalOverlayReservesManagedScrollerInsetBeforeSlotRebuild
|
|
61
82
|
{
|
|
62
83
|
RNCCollapsiblePagerViewComponentView *pager =
|
|
@@ -230,6 +230,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
230
230
|
stickyHeader,
|
|
231
231
|
headerHeight,
|
|
232
232
|
stickyHeaderHeight,
|
|
233
|
+
stickyHeaderHeights,
|
|
233
234
|
topOverlay,
|
|
234
235
|
topOverlayHeightHint,
|
|
235
236
|
externalTopOverlayTag,
|
|
@@ -283,6 +284,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
283
284
|
offscreenPageLimit: Math.max(1, offscreenPageLimit ?? 1),
|
|
284
285
|
headerHeight: Math.max(0, Math.round(headerHeight)),
|
|
285
286
|
stickyHeaderHeight: Math.max(0, Math.round(stickyHeaderHeight)),
|
|
287
|
+
stickyHeaderHeights: Platform.OS === "ios" && stickyHeaderHeights ? JSON.stringify(stickyHeaderHeights.slice(0, pages.length).map(height => Number.isFinite(height) && height >= 0 ? Math.round(height) : null)) : undefined,
|
|
286
288
|
topScrollEdgeEffect: scrollEdgeEnabled ? topScrollEdgeEffect : "none",
|
|
287
289
|
topOverlayColorScheme: scrollEdgeEnabled ? topOverlayColorScheme : undefined,
|
|
288
290
|
topOverlayHeight: hasTopOverlay ? this.state.topOverlayHeight ?? initialTopOverlayHeight : 0,
|
|
@@ -1379,6 +1379,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
1379
1379
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
1380
1380
|
headerHeight: _headerHeight,
|
|
1381
1381
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1382
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
1382
1383
|
isActive: _isActive,
|
|
1383
1384
|
pageRetentionDistance: _pageRetentionDistance,
|
|
1384
1385
|
layoutDirection: _layoutDirection,
|
|
@@ -58,6 +58,7 @@ export interface NativeProps extends ViewProps {
|
|
|
58
58
|
nativeSmoothHeaderScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
59
59
|
headerHeight?: CodegenTypes.Int32;
|
|
60
60
|
stickyHeaderHeight?: CodegenTypes.Int32;
|
|
61
|
+
stickyHeaderHeights?: string;
|
|
61
62
|
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
62
63
|
topOverlayColorScheme?: string;
|
|
63
64
|
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
@@ -86,7 +86,7 @@ export type CollapsiblePagerNativeSubHeaderConfig = Readonly<{
|
|
|
86
86
|
}>;
|
|
87
87
|
export type CollapsiblePagerViewOnNativeTabPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
88
88
|
export type CollapsiblePagerViewOnNativeSubHeaderPressEvent = ReactNative.NativeSyntheticEvent<OnNativeTabPressEventData>;
|
|
89
|
-
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "topScrollEdgeEffect" | "topOverlayHeight" | "externalTopOverlayTag" | "pageKeys" | "retainedPages" | "nativeTabBarConfig" | "onNativeToolbarPress" | "nativeTabBarItems" | "nativeTabBarHeight" | "nativeTabBarVariant" | "nativeTabBarTrailingReservedWidth" | "nativeTabBarContentPaddingHorizontal" | "nativeTabBarContentPaddingVertical" | "nativeTabBarItemSpacing" | "nativeTabBarFontSize" | "nativeTabBarFontFamily" | "nativeTabBarBackgroundColor" | "nativeTabBarActiveTextColor" | "nativeTabBarInactiveTextColor" | "nativeTabBarIndicatorColor" | "nativeTabBarIndicatorHeight" | "nativeTabBarIndicatorBottom" | "nativeSubHeaderConfig" | "nativeSubHeaderSelectedBackgroundColor" | "onNativeTabPress" | "onNativeSubHeaderPress" | "layoutDirection"> {
|
|
89
|
+
export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children" | "headerHeight" | "stickyHeaderHeight" | "stickyHeaderHeights" | "topScrollEdgeEffect" | "topOverlayHeight" | "externalTopOverlayTag" | "pageKeys" | "retainedPages" | "nativeTabBarConfig" | "onNativeToolbarPress" | "nativeTabBarItems" | "nativeTabBarHeight" | "nativeTabBarVariant" | "nativeTabBarTrailingReservedWidth" | "nativeTabBarContentPaddingHorizontal" | "nativeTabBarContentPaddingVertical" | "nativeTabBarItemSpacing" | "nativeTabBarFontSize" | "nativeTabBarFontFamily" | "nativeTabBarBackgroundColor" | "nativeTabBarActiveTextColor" | "nativeTabBarInactiveTextColor" | "nativeTabBarIndicatorColor" | "nativeTabBarIndicatorHeight" | "nativeTabBarIndicatorBottom" | "nativeSubHeaderConfig" | "nativeSubHeaderSelectedBackgroundColor" | "onNativeTabPress" | "onNativeSubHeaderPress" | "layoutDirection"> {
|
|
90
90
|
/** Collapsible content rendered above the sticky bar. */
|
|
91
91
|
header: React.ReactNode;
|
|
92
92
|
/** Bar which remains pinned after the header has collapsed. */
|
|
@@ -95,6 +95,8 @@ export interface CollapsiblePagerViewProps extends Omit<NativeProps, "children"
|
|
|
95
95
|
headerHeight: number;
|
|
96
96
|
/** Measured sticky bar height. */
|
|
97
97
|
stickyHeaderHeight: number;
|
|
98
|
+
/** iOS only. Sticky heights in child order, applied before each page is displayed. */
|
|
99
|
+
stickyHeaderHeights?: readonly number[];
|
|
98
100
|
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
99
101
|
topOverlay?: React.ReactNode;
|
|
100
102
|
/** Known overlay height to reserve until its first layout measurement. */
|
|
@@ -46,6 +46,7 @@ export interface CollapsiblePagerViewProps extends Omit<WebCollapsiblePagerNativ
|
|
|
46
46
|
stickyHeader: React.ReactNode;
|
|
47
47
|
headerHeight?: number;
|
|
48
48
|
stickyHeaderHeight?: number;
|
|
49
|
+
stickyHeaderHeights?: readonly number[];
|
|
49
50
|
isActive?: boolean;
|
|
50
51
|
topOverlay?: React.ReactNode;
|
|
51
52
|
topScrollEdgeEffect?: `${ScrollEdgeEffect}`;
|
|
@@ -50,6 +50,7 @@ export interface NativeProps extends ViewProps {
|
|
|
50
50
|
nativeSmoothHeaderScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
51
51
|
headerHeight?: CodegenTypes.Int32;
|
|
52
52
|
stickyHeaderHeight?: CodegenTypes.Int32;
|
|
53
|
+
stickyHeaderHeights?: string;
|
|
53
54
|
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
54
55
|
topOverlayColorScheme?: string;
|
|
55
56
|
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
package/package.json
CHANGED
|
@@ -114,6 +114,7 @@ export interface CollapsiblePagerViewProps
|
|
|
114
114
|
| "children"
|
|
115
115
|
| "headerHeight"
|
|
116
116
|
| "stickyHeaderHeight"
|
|
117
|
+
| "stickyHeaderHeights"
|
|
117
118
|
| "topScrollEdgeEffect"
|
|
118
119
|
| "topOverlayHeight"
|
|
119
120
|
| "externalTopOverlayTag"
|
|
@@ -150,6 +151,8 @@ export interface CollapsiblePagerViewProps
|
|
|
150
151
|
headerHeight: number;
|
|
151
152
|
/** Measured sticky bar height. */
|
|
152
153
|
stickyHeaderHeight: number;
|
|
154
|
+
/** iOS only. Sticky heights in child order, applied before each page is displayed. */
|
|
155
|
+
stickyHeaderHeights?: readonly number[];
|
|
153
156
|
/** Fixed content above the collapsible header on iOS 26 and newer. */
|
|
154
157
|
topOverlay?: React.ReactNode;
|
|
155
158
|
/** Known overlay height to reserve until its first layout measurement. */
|
|
@@ -577,6 +580,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
577
580
|
stickyHeader,
|
|
578
581
|
headerHeight,
|
|
579
582
|
stickyHeaderHeight,
|
|
583
|
+
stickyHeaderHeights,
|
|
580
584
|
topOverlay,
|
|
581
585
|
topOverlayHeightHint,
|
|
582
586
|
externalTopOverlayTag,
|
|
@@ -665,6 +669,15 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
665
669
|
offscreenPageLimit={Math.max(1, offscreenPageLimit ?? 1)}
|
|
666
670
|
headerHeight={Math.max(0, Math.round(headerHeight))}
|
|
667
671
|
stickyHeaderHeight={Math.max(0, Math.round(stickyHeaderHeight))}
|
|
672
|
+
stickyHeaderHeights={
|
|
673
|
+
Platform.OS === "ios" && stickyHeaderHeights
|
|
674
|
+
? JSON.stringify(
|
|
675
|
+
stickyHeaderHeights.slice(0, pages.length).map((height) =>
|
|
676
|
+
Number.isFinite(height) && height >= 0 ? Math.round(height) : null
|
|
677
|
+
)
|
|
678
|
+
)
|
|
679
|
+
: undefined
|
|
680
|
+
}
|
|
668
681
|
topScrollEdgeEffect={scrollEdgeEnabled ? topScrollEdgeEffect : "none"}
|
|
669
682
|
topOverlayColorScheme={
|
|
670
683
|
scrollEdgeEnabled ? topOverlayColorScheme : undefined
|
|
@@ -77,6 +77,7 @@ export interface CollapsiblePagerViewProps
|
|
|
77
77
|
stickyHeader: React.ReactNode;
|
|
78
78
|
headerHeight?: number;
|
|
79
79
|
stickyHeaderHeight?: number;
|
|
80
|
+
stickyHeaderHeights?: readonly number[];
|
|
80
81
|
isActive?: boolean;
|
|
81
82
|
topOverlay?: React.ReactNode;
|
|
82
83
|
topScrollEdgeEffect?: `${ScrollEdgeEffect}`;
|
|
@@ -1809,6 +1810,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1809
1810
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
1810
1811
|
headerHeight: _headerHeight,
|
|
1811
1812
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1813
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
1812
1814
|
isActive: _isActive,
|
|
1813
1815
|
pageRetentionDistance: _pageRetentionDistance,
|
|
1814
1816
|
layoutDirection: _layoutDirection,
|
|
@@ -58,6 +58,7 @@ export interface NativeProps extends ViewProps {
|
|
|
58
58
|
nativeSmoothHeaderScrollEnabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
59
59
|
headerHeight?: CodegenTypes.Int32;
|
|
60
60
|
stickyHeaderHeight?: CodegenTypes.Int32;
|
|
61
|
+
stickyHeaderHeights?: string;
|
|
61
62
|
topScrollEdgeEffect?: CodegenTypes.WithDefault<"none" | "hard" | "soft", "none">;
|
|
62
63
|
topOverlayColorScheme?: string;
|
|
63
64
|
topOverlayHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|