@onekeyfe/react-native-pager-view 6.7.0-alpha.359 → 6.7.0-alpha.363
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/README.md +0 -5
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerHost.kt +21 -76
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +7 -72
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +0 -27
- package/android/src/main/java/com/reactnativepagerview/NativeScrollerView.kt +6 -50
- package/docs/SPEC.md +1 -101
- package/ios/RNCCollapsiblePagerViewComponentView.mm +12 -124
- package/ios/tests/RNCCollapsiblePagerHitTestTests.mm +0 -178
- package/ios/tests/RNCCollapsiblePagerPressCancellationTests.mm +0 -65
- package/lib/module/CollapsiblePagerView.js +4 -20
- package/lib/module/CollapsiblePagerView.web.js +2 -11
- package/lib/module/CollapsiblePagerViewNativeComponent.ts +0 -13
- package/lib/typescript/src/CollapsiblePagerView.d.ts +1 -6
- package/lib/typescript/src/CollapsiblePagerView.web.d.ts +0 -2
- package/lib/typescript/src/CollapsiblePagerViewNativeComponent.d.ts +0 -5
- package/package.json +2 -2
- package/src/CollapsiblePagerView.tsx +4 -68
- package/src/CollapsiblePagerView.web.tsx +2 -19
- package/src/CollapsiblePagerViewNativeComponent.ts +0 -13
- package/android/src/androidTest/AndroidManifest.xml +0 -7
- package/android/src/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt +0 -247
package/docs/SPEC.md
CHANGED
|
@@ -74,7 +74,7 @@ the shared host before their old scroll-edge interaction is released.
|
|
|
74
74
|
The measured overlay height is excluded from the collapsible header distance:
|
|
75
75
|
`header` remains collapsible and `stickyHeader` pins immediately below the
|
|
76
76
|
overlay. Selection, cancellation, reuse and disposal rebind or release the
|
|
77
|
-
interaction and restore any prior scroll-edge style.
|
|
77
|
+
interaction and restore any prior scroll-edge style. Native scroll/refresh
|
|
78
78
|
coordination continues on the main thread without per-frame JavaScript work.
|
|
79
79
|
Refresh retains the pager-owned `overlay + header + sticky` top inset but offsets
|
|
80
80
|
the indicator by `header + sticky`, so its spinner begins below the fixed overlay.
|
|
@@ -171,24 +171,6 @@ intent. Real vertical consumption, a newer valid command, or owner detachment
|
|
|
171
171
|
releases the target. Existing NativeList and NativeScroller public coordinates
|
|
172
172
|
are unchanged. The same page-top/sticky-top destinations are available without smooth-header mode.
|
|
173
173
|
|
|
174
|
-
## Current-page partial header command
|
|
175
|
-
|
|
176
|
-
`scrollHeaderBy(delta: number)` moves the current page's shared collapsible
|
|
177
|
-
header from its displayed offset C to `clamp(C + delta, 0, D)`.
|
|
178
|
-
`scrollHeaderToOffset(offset: number)` moves it to `clamp(offset, 0, D)`
|
|
179
|
-
regardless of intervening native keyboard or user scrolling. D is the latest
|
|
180
|
-
measured collapsible height. Inputs use logical points on iOS and Android and
|
|
181
|
-
CSS pixels on Web. Non-finite values are ignored. The header and current body move immediately
|
|
182
|
-
so a focused input becomes visible before the next keyboard frame. A valid command
|
|
183
|
-
clears only the current page's body reading position B; it never changes
|
|
184
|
-
another page's memory or adds permanent content/insets. It requires the same
|
|
185
|
-
stable attached current owner as the page-top commands and is a safe no-op
|
|
186
|
-
during horizontal transitions, before mount, or after disposal. A newer
|
|
187
|
-
command or real user vertical consumption takes ownership from an older one.
|
|
188
|
-
Dynamic header measurements clamp any in-flight target to the latest D.
|
|
189
|
-
This command allows a focused input inside the shared header to move above a
|
|
190
|
-
keyboard without replacing the pager's sole vertical scroll owner.
|
|
191
|
-
|
|
192
174
|
## Independent NativeScroller migration
|
|
193
175
|
|
|
194
176
|
Status: implemented in source. Both native builds pass. Android focused emulator
|
|
@@ -351,32 +333,6 @@ warnings were observed. Keyboard, multi-touch, physical-device performance and
|
|
|
351
333
|
the full lifecycle/interaction matrix remain unverified. These are local source
|
|
352
334
|
builds; the currently installed npm version does not yet contain this migration.
|
|
353
335
|
|
|
354
|
-
## Android removal-transition geometry retention
|
|
355
|
-
|
|
356
|
-
Status: implemented locally; unreleased. On the Android UI thread, during a
|
|
357
|
-
screen removal transition,
|
|
358
|
-
NativeList and CollapsiblePager layout entry points respect the RecyclerView
|
|
359
|
-
suppression state established by the screen-transition owner. The owner restores
|
|
360
|
-
the original state when its last transition ownership ends. This adds no public
|
|
361
|
-
API and does not change Web or iOS behavior.
|
|
362
|
-
|
|
363
|
-
If Fabric removes the current NativeScroller React child while its origin-frame
|
|
364
|
-
transition remains active, Android retains the already displayed native extent
|
|
365
|
-
for drawing. The current child and raw content dimensions still clear normally;
|
|
366
|
-
only native content measurement and layout use the retained effective extent.
|
|
367
|
-
The matching transition end or detach clears the private child and extent state
|
|
368
|
-
idempotently. Adding a new child cancels prior retention, and a late end for the
|
|
369
|
-
old child cannot alter the new content. Ordinary removal, size events and scroll
|
|
370
|
-
commands keep their existing semantics.
|
|
371
|
-
|
|
372
|
-
Local arm64 DevShell acceptance covered Base, CXO and Overview exit content,
|
|
373
|
-
normal scrolling, RecyclerView ownership and suppression cleanup for the
|
|
374
|
-
observed CXO exit, and NativeScroller raw-zero content dimensions with a
|
|
375
|
-
nonzero displayed origin followed by detach cleanup. Nested-owner and cancel
|
|
376
|
-
paths, Overview rebound/cancel, natural resize and new-child runtime cases,
|
|
377
|
-
and the full performance matrix remain unverified. SDK publication and
|
|
378
|
-
consumer version alignment are separate steps.
|
|
379
|
-
|
|
380
336
|
## iOS vertical-scroll press cancellation
|
|
381
337
|
|
|
382
338
|
Status: implemented in source. A source-identical `node_modules` build was
|
|
@@ -496,40 +452,6 @@ The attached UIKit regression intentionally constrains the real pager pan to two
|
|
|
496
452
|
required touches to prove the no-pan path; it is distinct from natural Home OS
|
|
497
453
|
input, coalesced-event delivery, and physical-device acceptance.
|
|
498
454
|
|
|
499
|
-
## Native segmented tab bar
|
|
500
|
-
|
|
501
|
-
Status: implemented locally. Focused production-class iOS XCTest and Android
|
|
502
|
-
instrumentation checks pass; consuming App interaction acceptance is separate.
|
|
503
|
-
`nativeTabBar.style.variant` accepts `"underline"` (the default) or
|
|
504
|
-
`"segmented"` on iOS and Android. The optional
|
|
505
|
-
`nativeTabBar.style.contentPaddingVertical` is a nonnegative logical inset,
|
|
506
|
-
defaulting to zero. Omitting both fields preserves the existing content-width,
|
|
507
|
-
horizontally scrollable underline bar. Web ignores `nativeTabBar` and retains
|
|
508
|
-
its caller-rendered sticky header.
|
|
509
|
-
|
|
510
|
-
In segmented mode, the existing `height` is the entire tab slot. The track
|
|
511
|
-
fills the space inside `contentPaddingHorizontal` and
|
|
512
|
-
`contentPaddingVertical`, uses `backgroundColor`, and has a fully rounded
|
|
513
|
-
outline. Its visible items divide the track into equal-width segments in their
|
|
514
|
-
current order, including after item insertion, removal, relabeling, or resize.
|
|
515
|
-
The thumb uses `indicatorColor`, is inset two logical points from its segment,
|
|
516
|
-
and is fully rounded. Segment titles use the existing font and active/inactive
|
|
517
|
-
text colors, remain single-line with truncation, and retain their existing
|
|
518
|
-
accessibility labels, test IDs, and native press event keys. The segmented bar
|
|
519
|
-
does not scroll horizontally; `itemSpacing`, `indicatorHeight`, and
|
|
520
|
-
`indicatorBottom` apply only to underline mode. The pager's native fractional
|
|
521
|
-
page progress moves the thumb continuously between equal-width segments and
|
|
522
|
-
interpolates text emphasis without per-frame JavaScript updates. It settles at
|
|
523
|
-
the actual selected page after a completed or cancelled gesture. RTL reverses
|
|
524
|
-
physical segment order without changing logical page keys or indices.
|
|
525
|
-
|
|
526
|
-
Switching variants or removing the native tab bar clears the previous visual
|
|
527
|
-
state. The existing native press command, page callbacks, retention, vertical
|
|
528
|
-
header geometry, and Web behavior remain unchanged. Acceptance requires
|
|
529
|
-
focused native geometry/progress/press checks on iOS and Android, including
|
|
530
|
-
two or three segments, dynamic labels/items, RTL, narrow widths, and variant
|
|
531
|
-
switching. Type forwarding alone does not prove rendered behavior.
|
|
532
|
-
|
|
533
455
|
## Native tab-press animation default
|
|
534
456
|
|
|
535
457
|
Behavior change: previously an omitted `nativeTabPressAnimationEnabled` animated
|
|
@@ -550,28 +472,6 @@ Status: implemented; focused native-wrapper tests cover both directions,
|
|
|
550
472
|
explicit overrides and in-flight/superseded command targets. Home applies this policy to its JS tab bar, with iOS and
|
|
551
473
|
Android simulator recordings verifying distant jumps and adjacent transitions.
|
|
552
474
|
|
|
553
|
-
## Native tab trailing control reservation
|
|
554
|
-
|
|
555
|
-
Status: implemented locally, unreleased. The focused Android host test passed
|
|
556
|
-
(1/1); iOS hit tests had 8 passes and 1 existing skip. iOS companion-app UI
|
|
557
|
-
acceptance remains unverified.
|
|
558
|
-
`nativeTabBar.style.trailingReservedWidth` is an optional logical trailing
|
|
559
|
-
reservation for a sibling React control in the full-width sticky header. It
|
|
560
|
-
defaults to zero. JavaScript normalizes non-finite or negative input to zero;
|
|
561
|
-
native also clamps the reservation to the actual tab viewport width. On Android
|
|
562
|
-
and iOS, only the native tab viewport shrinks from `W` to `W - R`: its frame
|
|
563
|
-
begins at zero in LTR and at `R` in RTL. The sticky React header, its height,
|
|
564
|
-
and page content keep their original full-width geometry. Touches in the
|
|
565
|
-
reserved region reach the sibling control, while native tab hit testing and
|
|
566
|
-
last-tab visibility use the reduced viewport. Changing the reservation updates
|
|
567
|
-
that viewport; removing it or recycling the pager restores the default zero.
|
|
568
|
-
Web does not render the native tab and ignores this style field. For a positive
|
|
569
|
-
reservation, the box-none sticky React control draws above the native tab so
|
|
570
|
-
its inward fade and toolbar hit area remain visible; zero preserves the old
|
|
571
|
-
native-tab foreground order. Acceptance requires focused native layout and hit
|
|
572
|
-
testing for zero, nonzero, reset, and RTL reservations; type forwarding alone
|
|
573
|
-
is insufficient.
|
|
574
|
-
|
|
575
475
|
## Android refresh foreground coordination
|
|
576
476
|
|
|
577
477
|
Status: implemented; Android Home simulator placement verified on 2026-09-28.
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
// OneKey patch: deduplicate structural mutation parents before scanning the page.
|
|
20
20
|
#include <unordered_set>
|
|
21
|
-
#include <cmath>
|
|
22
21
|
|
|
23
22
|
using namespace facebook::react;
|
|
24
23
|
|
|
@@ -369,9 +368,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
369
368
|
@property (nonatomic, copy) RNCCollapsiblePagerNativeTabPressHandler onTabPress;
|
|
370
369
|
- (void)updateItemsJSON:(NSString *)itemsJSON;
|
|
371
370
|
- (void)updateStyleWithHeight:(CGFloat)height
|
|
372
|
-
variant:(NSString *)variant
|
|
373
371
|
contentPaddingHorizontal:(CGFloat)contentPaddingHorizontal
|
|
374
|
-
contentPaddingVertical:(CGFloat)contentPaddingVertical
|
|
375
372
|
itemSpacing:(CGFloat)itemSpacing
|
|
376
373
|
fontSize:(CGFloat)fontSize
|
|
377
374
|
fontFamily:(NSString *)fontFamily
|
|
@@ -388,15 +385,12 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
388
385
|
|
|
389
386
|
@implementation RNCCollapsiblePagerNativeTabBarView {
|
|
390
387
|
RNCCollapsiblePagerHorizontalScrollView *_scrollView;
|
|
391
|
-
UIView *_trackView;
|
|
392
388
|
UIView *_indicatorView;
|
|
393
389
|
NSArray<NSDictionary *> *_items;
|
|
394
390
|
NSMutableArray<UIButton *> *_buttons;
|
|
395
391
|
NSMutableArray<NSValue *> *_indicatorFrames;
|
|
396
392
|
CGFloat _barHeight;
|
|
397
393
|
CGFloat _contentPaddingHorizontal;
|
|
398
|
-
CGFloat _contentPaddingVertical;
|
|
399
|
-
BOOL _segmented;
|
|
400
394
|
CGFloat _itemSpacing;
|
|
401
395
|
CGFloat _fontSize;
|
|
402
396
|
NSString *_fontFamily;
|
|
@@ -419,8 +413,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
419
413
|
_indicatorFrames = [NSMutableArray new];
|
|
420
414
|
_barHeight = 44;
|
|
421
415
|
_contentPaddingHorizontal = 20;
|
|
422
|
-
_contentPaddingVertical = 0;
|
|
423
|
-
_segmented = NO;
|
|
424
416
|
_itemSpacing = 8;
|
|
425
417
|
_fontSize = 16;
|
|
426
418
|
_activeTextColor = UIColor.labelColor;
|
|
@@ -442,10 +434,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
442
434
|
_scrollView.delegate = self;
|
|
443
435
|
[self addSubview:_scrollView];
|
|
444
436
|
|
|
445
|
-
_trackView = [UIView new];
|
|
446
|
-
_trackView.userInteractionEnabled = NO;
|
|
447
|
-
[_scrollView addSubview:_trackView];
|
|
448
|
-
|
|
449
437
|
_indicatorView = [UIView new];
|
|
450
438
|
_indicatorView.userInteractionEnabled = NO;
|
|
451
439
|
[_scrollView addSubview:_indicatorView];
|
|
@@ -500,9 +488,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
500
488
|
}
|
|
501
489
|
|
|
502
490
|
- (void)updateStyleWithHeight:(CGFloat)height
|
|
503
|
-
variant:(NSString *)variant
|
|
504
491
|
contentPaddingHorizontal:(CGFloat)contentPaddingHorizontal
|
|
505
|
-
contentPaddingVertical:(CGFloat)contentPaddingVertical
|
|
506
492
|
itemSpacing:(CGFloat)itemSpacing
|
|
507
493
|
fontSize:(CGFloat)fontSize
|
|
508
494
|
fontFamily:(NSString *)fontFamily
|
|
@@ -514,26 +500,19 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
514
500
|
indicatorBottom:(CGFloat)indicatorBottom
|
|
515
501
|
{
|
|
516
502
|
_barHeight = MAX(1, height);
|
|
517
|
-
BOOL wasSegmented = _segmented;
|
|
518
|
-
_segmented = [variant isEqualToString:@"segmented"];
|
|
519
503
|
_contentPaddingHorizontal = MAX(0, contentPaddingHorizontal);
|
|
520
|
-
_contentPaddingVertical = MAX(0, contentPaddingVertical);
|
|
521
504
|
_itemSpacing = MAX(0, itemSpacing);
|
|
522
505
|
_fontSize = MAX(1, fontSize);
|
|
523
506
|
_fontFamily = [fontFamily copy];
|
|
524
|
-
self.backgroundColor =
|
|
507
|
+
self.backgroundColor = backgroundColor ?: UIColor.clearColor;
|
|
525
508
|
_scrollView.backgroundColor = self.backgroundColor;
|
|
526
|
-
_scrollView.scrollEnabled = !_segmented;
|
|
527
|
-
if (_segmented && !wasSegmented) [_scrollView setContentOffset:CGPointZero animated:NO];
|
|
528
|
-
_trackView.hidden = !_segmented;
|
|
529
|
-
_trackView.backgroundColor = backgroundColor ?: UIColor.clearColor;
|
|
530
509
|
_activeTextColor = activeTextColor ?: UIColor.labelColor;
|
|
531
510
|
_inactiveTextColor = inactiveTextColor ?: UIColor.secondaryLabelColor;
|
|
532
511
|
_indicatorColor = indicatorColor ?: _activeTextColor;
|
|
533
512
|
_indicatorHeight = MAX(0, indicatorHeight);
|
|
534
513
|
_indicatorBottom = MAX(0, indicatorBottom);
|
|
535
514
|
_indicatorView.backgroundColor = _indicatorColor;
|
|
536
|
-
_indicatorView.layer.cornerRadius =
|
|
515
|
+
_indicatorView.layer.cornerRadius = _indicatorHeight / 2;
|
|
537
516
|
for (UIButton *button in _buttons) button.titleLabel.font = self.tabFont;
|
|
538
517
|
[self setNeedsLayout];
|
|
539
518
|
}
|
|
@@ -592,33 +571,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
592
571
|
{
|
|
593
572
|
[super layoutSubviews];
|
|
594
573
|
_scrollView.frame = self.bounds;
|
|
595
|
-
if (_segmented) {
|
|
596
|
-
CGFloat width = CGRectGetWidth(self.bounds);
|
|
597
|
-
CGFloat height = CGRectGetHeight(self.bounds);
|
|
598
|
-
CGFloat insetX = MIN(_contentPaddingHorizontal, width / 2);
|
|
599
|
-
CGFloat insetY = MIN(_contentPaddingVertical, height / 2);
|
|
600
|
-
CGRect trackFrame = CGRectMake(insetX, insetY,
|
|
601
|
-
MAX(0, width - 2 * insetX), MAX(0, height - 2 * insetY));
|
|
602
|
-
_trackView.frame = trackFrame;
|
|
603
|
-
_trackView.layer.cornerRadius = CGRectGetHeight(trackFrame) / 2;
|
|
604
|
-
_scrollView.contentSize = self.bounds.size;
|
|
605
|
-
[_indicatorFrames removeAllObjects];
|
|
606
|
-
NSUInteger count = _buttons.count;
|
|
607
|
-
[_buttons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger index, BOOL *stop) {
|
|
608
|
-
CGFloat first = CGRectGetMinX(trackFrame) + CGRectGetWidth(trackFrame) * index / count;
|
|
609
|
-
CGFloat last = CGRectGetMinX(trackFrame) + CGRectGetWidth(trackFrame) * (index + 1) / count;
|
|
610
|
-
CGFloat x = self->_leftToRight ? first : CGRectGetMaxX(trackFrame) - (last - CGRectGetMinX(trackFrame));
|
|
611
|
-
CGFloat end = self->_leftToRight ? last : CGRectGetMaxX(trackFrame) - (first - CGRectGetMinX(trackFrame));
|
|
612
|
-
button.frame = CGRectMake(x, CGRectGetMinY(trackFrame), MAX(0, end - x), CGRectGetHeight(trackFrame));
|
|
613
|
-
CGRect thumbFrame = CGRectMake(x + 2, CGRectGetMinY(trackFrame) + 2,
|
|
614
|
-
MAX(0, CGRectGetWidth(button.frame) - 4), MAX(0, CGRectGetHeight(trackFrame) - 4));
|
|
615
|
-
[self->_indicatorFrames addObject:[NSValue valueWithCGRect:thumbFrame]];
|
|
616
|
-
}];
|
|
617
|
-
_indicatorView.layer.cornerRadius = MAX(0, CGRectGetHeight(trackFrame) - 4) / 2;
|
|
618
|
-
[self updatePresentation];
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
_trackView.frame = CGRectZero;
|
|
622
574
|
UIFont *font = self.tabFont;
|
|
623
575
|
NSMutableArray<NSNumber *> *widths = [NSMutableArray arrayWithCapacity:_buttons.count];
|
|
624
576
|
CGFloat itemsWidth = 0;
|
|
@@ -682,10 +634,10 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
682
634
|
CGRectGetMinX(fromFrame) + (CGRectGetMinX(toFrame) - CGRectGetMinX(fromFrame)) * fraction,
|
|
683
635
|
CGRectGetMinY(fromFrame),
|
|
684
636
|
CGRectGetWidth(fromFrame) + (CGRectGetWidth(toFrame) - CGRectGetWidth(fromFrame)) * fraction,
|
|
685
|
-
|
|
637
|
+
_indicatorHeight
|
|
686
638
|
);
|
|
687
639
|
_indicatorView.frame = indicatorFrame;
|
|
688
|
-
_indicatorView.hidden =
|
|
640
|
+
_indicatorView.hidden = _indicatorHeight <= 0;
|
|
689
641
|
|
|
690
642
|
NSInteger selectedIndex = (NSInteger)round(progress);
|
|
691
643
|
[_buttons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger index, BOOL *stop) {
|
|
@@ -702,7 +654,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
702
654
|
: UIAccessibilityTraitButton;
|
|
703
655
|
}];
|
|
704
656
|
|
|
705
|
-
if (_shouldCenterSelectedItem && !
|
|
657
|
+
if (_shouldCenterSelectedItem && !_scrollView.tracking && !_scrollView.dragging &&
|
|
706
658
|
!_scrollView.decelerating && CGRectGetWidth(_scrollView.bounds) > 0) {
|
|
707
659
|
CGFloat maximumOffset = MAX(0, _scrollView.contentSize.width - CGRectGetWidth(_scrollView.bounds));
|
|
708
660
|
CGFloat desiredOffset = RNCClamp(
|
|
@@ -1519,7 +1471,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
1519
1471
|
- (void)liftSharedHeadersForPagerTransition:(NSString *)reason;
|
|
1520
1472
|
- (void)restoreSharedHeadersToContainer;
|
|
1521
1473
|
- (void)layoutSharedHeaders;
|
|
1522
|
-
- (void)bringReservedStickyControlToFront;
|
|
1523
1474
|
- (void)restorePinnedStickyHeader;
|
|
1524
1475
|
- (void)updatePinnedStickyHeader;
|
|
1525
1476
|
- (UIScrollView *)currentVerticalScrollViewForParentPager;
|
|
@@ -1607,7 +1558,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
1607
1558
|
NSUInteger _pendingTopInsetReboundGeneration;
|
|
1608
1559
|
NSTimer *_topInsetReboundTimer;
|
|
1609
1560
|
CGFloat _nativeTabBarHeight;
|
|
1610
|
-
CGFloat _nativeTabBarTrailingReservedWidth;
|
|
1611
1561
|
CGFloat _nativeSubHeaderHeight;
|
|
1612
1562
|
CGFloat _headerOffset;
|
|
1613
1563
|
BOOL _scrollEnabled;
|
|
@@ -2529,7 +2479,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
2529
2479
|
}
|
|
2530
2480
|
[_nativeTabBarView updateAncestorGesturePrecedence];
|
|
2531
2481
|
[_nativeSubHeaderView updateAncestorGesturePrecedence];
|
|
2532
|
-
[self bringReservedStickyControlToFront];
|
|
2533
2482
|
}
|
|
2534
2483
|
|
|
2535
2484
|
- (void)restoreSharedHeadersToContainer
|
|
@@ -2635,11 +2584,10 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
2635
2584
|
CGFloat nativeTabBarVisibleHeight = _nativeTabBarView.hidden
|
|
2636
2585
|
? 0
|
|
2637
2586
|
: MIN(_stickyHeaderHeight, _nativeTabBarHeight);
|
|
2638
|
-
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
2639
2587
|
_nativeTabBarView.frame = CGRectMake(
|
|
2640
|
-
|
|
2588
|
+
0,
|
|
2641
2589
|
stickyChildY,
|
|
2642
|
-
width
|
|
2590
|
+
width,
|
|
2643
2591
|
nativeTabBarVisibleHeight
|
|
2644
2592
|
);
|
|
2645
2593
|
_nativeSubHeaderView.frame = CGRectMake(
|
|
@@ -2653,26 +2601,9 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
2653
2601
|
);
|
|
2654
2602
|
_topOverlayHostView.frame = CGRectMake(0, 0, width, self.effectiveTopOverlayHeight);
|
|
2655
2603
|
_topOverlayView.frame = _topOverlayHostView.bounds;
|
|
2656
|
-
[self bringReservedStickyControlToFront];
|
|
2657
2604
|
[self applyHeaderOffset];
|
|
2658
2605
|
}
|
|
2659
2606
|
|
|
2660
|
-
- (void)bringReservedStickyControlToFront
|
|
2661
|
-
{
|
|
2662
|
-
if (_stickyHeaderView != nil &&
|
|
2663
|
-
_stickyHeaderView.superview == _nativeTabBarView.superview) {
|
|
2664
|
-
if (_nativeTabBarTrailingReservedWidth > 0) {
|
|
2665
|
-
[_stickyHeaderView.superview bringSubviewToFront:_stickyHeaderView];
|
|
2666
|
-
} else {
|
|
2667
|
-
[_nativeTabBarView.superview bringSubviewToFront:_nativeTabBarView];
|
|
2668
|
-
if (!_nativeSubHeaderView.hidden &&
|
|
2669
|
-
_nativeSubHeaderView.superview == _nativeTabBarView.superview) {
|
|
2670
|
-
[_nativeSubHeaderView.superview bringSubviewToFront:_nativeSubHeaderView];
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
2607
|
- (void)updatePinnedStickyHeader
|
|
2677
2608
|
{
|
|
2678
2609
|
BOOL attachedToList = _nativeSmoothHeaderScrollEnabled &&
|
|
@@ -2719,10 +2650,8 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
2719
2650
|
CGFloat childY = shouldPin ? 0 : _headerHeight;
|
|
2720
2651
|
CGFloat width = CGRectGetWidth(self.bounds);
|
|
2721
2652
|
CGFloat tabHeight = _nativeTabBarView.hidden ? 0 : MIN(_stickyHeaderHeight, _nativeTabBarHeight);
|
|
2722
|
-
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
2723
2653
|
_stickyHeaderView.frame = CGRectMake(0, childY, width, _stickyHeaderHeight);
|
|
2724
|
-
_nativeTabBarView.frame = CGRectMake(
|
|
2725
|
-
childY, width - tabReservedWidth, tabHeight);
|
|
2654
|
+
_nativeTabBarView.frame = CGRectMake(0, childY, width, tabHeight);
|
|
2726
2655
|
_nativeSubHeaderView.frame = CGRectMake(0, childY + tabHeight, width,
|
|
2727
2656
|
MIN(MAX(0, _stickyHeaderHeight - tabHeight), _nativeSubHeaderHeight));
|
|
2728
2657
|
_pinnedStickyHostView.hidden = !shouldPin;
|
|
@@ -2742,7 +2671,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
2742
2671
|
}
|
|
2743
2672
|
[_nativeTabBarView updateAncestorGesturePrecedence];
|
|
2744
2673
|
[_nativeSubHeaderView updateAncestorGesturePrecedence];
|
|
2745
|
-
[self bringReservedStickyControlToFront];
|
|
2746
2674
|
[self updateTopScrollEdgeForScrollView:_observedScrollView];
|
|
2747
2675
|
[self logHomeVisualGeometry:shouldPin ? @"pin" : @"unpin"
|
|
2748
2676
|
scrollView:_observedScrollView];
|
|
@@ -3122,7 +3050,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3122
3050
|
if (_stickyHeaderView != nil) [_sharedHeaderHostView bringSubviewToFront:_stickyHeaderView];
|
|
3123
3051
|
if (!_nativeTabBarView.hidden) [_sharedHeaderHostView bringSubviewToFront:_nativeTabBarView];
|
|
3124
3052
|
if (!_nativeSubHeaderView.hidden) [_sharedHeaderHostView bringSubviewToFront:_nativeSubHeaderView];
|
|
3125
|
-
[self bringReservedStickyControlToFront];
|
|
3126
3053
|
[_containerView bringSubviewToFront:_sharedHeaderHostView];
|
|
3127
3054
|
if (_stickyHeaderIsPinned) {
|
|
3128
3055
|
[_pinnedStickyHostView.superview bringSubviewToFront:_pinnedStickyHostView];
|
|
@@ -3335,7 +3262,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3335
3262
|
_homeVisualLastLayoutLog = 0;
|
|
3336
3263
|
_homeVisualLastGeometrySignature = nil;
|
|
3337
3264
|
_nativeTabBarHeight = 44;
|
|
3338
|
-
_nativeTabBarTrailingReservedWidth = 0;
|
|
3339
3265
|
_nativeSubHeaderHeight = 74;
|
|
3340
3266
|
_headerOffset = 0;
|
|
3341
3267
|
_currentLogicalOffset = 0;
|
|
@@ -3417,13 +3343,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3417
3343
|
_layoutDirection = RCTNSStringFromString(toString(newViewProps.layoutDirection));
|
|
3418
3344
|
[_nativeTabBarView setLeftToRight:self.isLtrLayout];
|
|
3419
3345
|
[_nativeSubHeaderView setLeftToRight:self.isLtrLayout];
|
|
3420
|
-
[self setNeedsLayout];
|
|
3421
|
-
}
|
|
3422
|
-
if (_needsPropsReapply ||
|
|
3423
|
-
oldViewProps.nativeTabBarTrailingReservedWidth != newViewProps.nativeTabBarTrailingReservedWidth) {
|
|
3424
|
-
double reserved = newViewProps.nativeTabBarTrailingReservedWidth;
|
|
3425
|
-
_nativeTabBarTrailingReservedWidth = std::isfinite(reserved) && reserved >= 0 ? reserved : 0;
|
|
3426
|
-
[self setNeedsLayout];
|
|
3427
3346
|
}
|
|
3428
3347
|
BOOL insetsChanged = NO;
|
|
3429
3348
|
if (_needsPropsReapply || oldViewProps.headerHeight != newViewProps.headerHeight) {
|
|
@@ -3504,9 +3423,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3504
3423
|
}
|
|
3505
3424
|
if (_needsPropsReapply ||
|
|
3506
3425
|
oldViewProps.nativeTabBarHeight != newViewProps.nativeTabBarHeight ||
|
|
3507
|
-
oldViewProps.nativeTabBarVariant != newViewProps.nativeTabBarVariant ||
|
|
3508
3426
|
oldViewProps.nativeTabBarContentPaddingHorizontal != newViewProps.nativeTabBarContentPaddingHorizontal ||
|
|
3509
|
-
oldViewProps.nativeTabBarContentPaddingVertical != newViewProps.nativeTabBarContentPaddingVertical ||
|
|
3510
3427
|
oldViewProps.nativeTabBarItemSpacing != newViewProps.nativeTabBarItemSpacing ||
|
|
3511
3428
|
oldViewProps.nativeTabBarFontSize != newViewProps.nativeTabBarFontSize ||
|
|
3512
3429
|
oldViewProps.nativeTabBarFontFamily != newViewProps.nativeTabBarFontFamily ||
|
|
@@ -3523,9 +3440,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3523
3440
|
NSString *fontFamily = RCTNSStringFromString(newViewProps.nativeTabBarFontFamily);
|
|
3524
3441
|
[_nativeTabBarView
|
|
3525
3442
|
updateStyleWithHeight:_nativeTabBarHeight
|
|
3526
|
-
variant:RCTNSStringFromString(newViewProps.nativeTabBarVariant)
|
|
3527
3443
|
contentPaddingHorizontal:MAX(0, newViewProps.nativeTabBarContentPaddingHorizontal)
|
|
3528
|
-
contentPaddingVertical:MAX(0, newViewProps.nativeTabBarContentPaddingVertical)
|
|
3529
3444
|
itemSpacing:MAX(0, newViewProps.nativeTabBarItemSpacing)
|
|
3530
3445
|
fontSize:newViewProps.nativeTabBarFontSize > 0 ? newViewProps.nativeTabBarFontSize : 16
|
|
3531
3446
|
fontFamily:fontFamily
|
|
@@ -3559,7 +3474,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
3559
3474
|
if (!_nativeSubHeaderView.hidden) {
|
|
3560
3475
|
[_nativeSubHeaderView.superview bringSubviewToFront:_nativeSubHeaderView];
|
|
3561
3476
|
}
|
|
3562
|
-
[self bringReservedStickyControlToFront];
|
|
3563
3477
|
[_sharedHeaderHostView.superview bringSubviewToFront:_sharedHeaderHostView];
|
|
3564
3478
|
if (_stickyHeaderIsPinned) {
|
|
3565
3479
|
[_pinnedStickyHostView.superview bringSubviewToFront:_pinnedStickyHostView];
|
|
@@ -4524,9 +4438,8 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
4524
4438
|
|
|
4525
4439
|
- (void)updateNativeScrollerViewport:(UIScrollView *)scrollView stickyHeight:(CGFloat)height
|
|
4526
4440
|
{
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
[host setPagerStickyHeight:height forOwner:self];
|
|
4441
|
+
if ([scrollView.superview isKindOfClass:RNCNativeScrollerComponentView.class]) {
|
|
4442
|
+
[(RNCNativeScrollerComponentView *)scrollView.superview setPagerStickyHeight:height forOwner:self];
|
|
4530
4443
|
}
|
|
4531
4444
|
}
|
|
4532
4445
|
|
|
@@ -5320,13 +5233,6 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
5320
5233
|
{
|
|
5321
5234
|
UIScrollView *scrollView = _pagerTopScrollView;
|
|
5322
5235
|
if (_dispatchingPagerTop || ![self matchesPagerTop:scrollView]) return;
|
|
5323
|
-
CGFloat clampedTarget = MIN(MAX(_pagerTopLogicalTarget, 0), _headerHeight);
|
|
5324
|
-
if (clampedTarget != _pagerTopLogicalTarget) {
|
|
5325
|
-
_pagerTopLogicalTarget = clampedTarget;
|
|
5326
|
-
CGFloat physicalTarget = RNCLimitRestoredScrollOffset(clampedTarget - scrollView.contentInset.top,
|
|
5327
|
-
scrollView.contentSize.height, scrollView.bounds.size.height, scrollView.contentInset.top, scrollView.contentInset.bottom);
|
|
5328
|
-
[scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x, physicalTarget) animated:NO];
|
|
5329
|
-
}
|
|
5330
5236
|
CGFloat logical = scrollView.contentOffset.y + scrollView.contentInset.top;
|
|
5331
5237
|
if (fabs(logical - _pagerTopLogicalTarget) > 0.5) return;
|
|
5332
5238
|
_pageOffsets[_pagerTopPageKey] = @(_nativeSmoothHeaderScrollEnabled ? 0 : _pagerTopLogicalTarget);
|
|
@@ -5338,29 +5244,11 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
5338
5244
|
}
|
|
5339
5245
|
|
|
5340
5246
|
- (void)scrollToTop:(NSInteger)target animated:(BOOL)animated
|
|
5341
|
-
{
|
|
5342
|
-
if (target != 0 && target != 1) return;
|
|
5343
|
-
[self scrollHeaderToOffset:(target == 1 ? _headerHeight : 0) animated:animated];
|
|
5344
|
-
}
|
|
5345
|
-
|
|
5346
|
-
- (void)scrollHeaderBy:(double)delta
|
|
5347
|
-
{
|
|
5348
|
-
if (!std::isfinite(delta)) return;
|
|
5349
|
-
[self scrollHeaderToOffset:MIN(MAX(_headerOffset + delta, 0), _headerHeight) animated:NO];
|
|
5350
|
-
}
|
|
5351
|
-
|
|
5352
|
-
- (void)scrollHeaderToOffset:(double)offset
|
|
5353
|
-
{
|
|
5354
|
-
if (!std::isfinite(offset)) return;
|
|
5355
|
-
[self scrollHeaderToOffset:MIN(MAX(offset, 0), _headerHeight) animated:NO];
|
|
5356
|
-
}
|
|
5357
|
-
|
|
5358
|
-
- (void)scrollHeaderToOffset:(CGFloat)logicalTarget animated:(BOOL)animated
|
|
5359
5247
|
{
|
|
5360
5248
|
[self cancelTopInsetReboundCheck];
|
|
5361
5249
|
UIScrollView *scrollView = _observedScrollView;
|
|
5362
5250
|
NSString *key = _observedPageKey;
|
|
5363
|
-
if (_isBeingRecycled || _transitioning || _isPagerDragging ||
|
|
5251
|
+
if ((target != 0 && target != 1) || _isBeingRecycled || _transitioning || _isPagerDragging ||
|
|
5364
5252
|
_transitionPageOffsets != nil || _syntheticPageRestore || scrollView == nil || scrollView.window == nil ||
|
|
5365
5253
|
key == nil || ![key isEqualToString:self.currentPageKey] || _observedPageIndex != _currentIndex ||
|
|
5366
5254
|
_observedPageGeneration != _generation || self.window == nil) return;
|
|
@@ -5376,7 +5264,7 @@ static void RNCLogNativeTabScrollBoundary(NSString *owner,
|
|
|
5376
5264
|
[_alignedBodyKeys removeObject:key];
|
|
5377
5265
|
[_suspendedBodyKeys removeObject:key];
|
|
5378
5266
|
[_displayBodyOverrides removeObjectForKey:key];
|
|
5379
|
-
logicalTarget =
|
|
5267
|
+
CGFloat logicalTarget = target == 1 ? _headerHeight : 0;
|
|
5380
5268
|
_pageOffsets[key] = @(_nativeSmoothHeaderScrollEnabled ? 0 : logicalTarget);
|
|
5381
5269
|
_pagerTopScrollView = scrollView;
|
|
5382
5270
|
_pagerTopPageKey = [key copy];
|