@onekeyfe/react-native-pager-view 6.7.0-50 → 6.7.0-52
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
|
@@ -1111,7 +1111,11 @@ header attachment remain deferred until selection settles. Cancelling the drag
|
|
|
1111
1111
|
on the same page MUST retain the reopened recovery round. Empty transactions,
|
|
1112
1112
|
removals and inserts outside the current page MUST NOT reopen the budget. Owned
|
|
1113
1113
|
`NativeScroller` and `NativeList` hosts additionally emit push readiness
|
|
1114
|
-
notifications when their scroll views attach and obtain positive bounds
|
|
1114
|
+
notifications when their vertical scroll views attach and obtain positive bounds
|
|
1115
|
+
and resolve as the page's eligible vertical scroll owner so initial first-layout
|
|
1116
|
+
attachment (while a coalesced slot/layout reconcile is still pending on the main
|
|
1117
|
+
queue or a verified vertical `NativeList` becomes ready before the current page
|
|
1118
|
+
has an observed owner) and late
|
|
1115
1119
|
replacements recover immediately even without another Fabric insertion or after
|
|
1116
1120
|
the retry budget expires; static pages with neither an unready scroll host nor a
|
|
1117
1121
|
released scroll owner do not schedule retry timers.
|
|
@@ -6237,12 +6237,15 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
6237
6237
|
}
|
|
6238
6238
|
}
|
|
6239
6239
|
if (pageIndex == NSNotFound) return;
|
|
6240
|
+
if ([self verticalScrollViewForPageAtIndex:pageIndex] != scrollView) return;
|
|
6240
6241
|
|
|
6241
6242
|
NSString *pageKey = [self pageKeyForIndex:pageIndex];
|
|
6242
6243
|
BOOL hasReleasedStateForPage = _releasedPageScrollStates[pageKey] != nil;
|
|
6243
6244
|
BOOL currentPageNeedsOwner = pageIndex == _currentIndex &&
|
|
6244
6245
|
(_awaitingScrollOwnerForCurrentPage || _needsScrollObserverReattachAfterMount ||
|
|
6245
6246
|
hasReleasedStateForPage ||
|
|
6247
|
+
(_observedScrollView == nil &&
|
|
6248
|
+
(_scrollReconcileScheduled || RNCIsMountedNativeListScrollView(scrollView))) ||
|
|
6246
6249
|
(_observedScrollView != nil &&
|
|
6247
6250
|
[_observedScrollView isKindOfClass:UICollectionView.class] &&
|
|
6248
6251
|
!RNCIsMountedNativeListScrollView(_observedScrollView) &&
|
|
@@ -598,11 +598,19 @@ using namespace facebook::react;
|
|
|
598
598
|
[pager mountingTransactionWillMount:removal withSurfaceTelemetry:telemetry];
|
|
599
599
|
[source removeFromSuperview];
|
|
600
600
|
[self finishMount:pager];
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
[
|
|
601
|
+
if (finalRetryPending) {
|
|
602
|
+
NSUInteger staleToken = [[pager valueForKey:@"scrollResolveRetryToken"] unsignedIntegerValue];
|
|
603
|
+
[pager setValue:@(staleToken + 1) forKey:@"scrollResolveRetryToken"];
|
|
604
|
+
[pager setValue:@NO forKey:@"scrollResolveRetryScheduled"];
|
|
605
|
+
[pager setValue:@11 forKey:@"scrollResolveRetryAttempt"];
|
|
606
|
+
[pager attachScrollObserverForCurrentPage];
|
|
607
|
+
} else {
|
|
608
|
+
NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:6];
|
|
609
|
+
while (([[pager valueForKey:@"scrollResolveRetryAttempt"] integerValue] < 12 ||
|
|
610
|
+
[[pager valueForKey:@"scrollResolveRetryScheduled"] boolValue]) &&
|
|
611
|
+
deadline.timeIntervalSinceNow > 0) {
|
|
612
|
+
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
|
|
613
|
+
}
|
|
606
614
|
}
|
|
607
615
|
XCTAssertEqualObjects([pager valueForKey:@"scrollResolveRetryAttempt"], @12);
|
|
608
616
|
XCTAssertEqualObjects([pager valueForKey:@"scrollResolveRetryScheduled"], @(finalRetryPending));
|
|
@@ -897,6 +905,87 @@ using namespace facebook::react;
|
|
|
897
905
|
return component;
|
|
898
906
|
}
|
|
899
907
|
|
|
908
|
+
- (void)testUnmeasuredNativeListAttachesAndAlignsSynchronouslyOnFirstLayoutReadiness
|
|
909
|
+
{
|
|
910
|
+
RNCCollapsiblePagerViewComponentView *pager = [self pagerWithPageCount:1];
|
|
911
|
+
[pager setValue:@YES forKey:@"hasAppliedInitialPage"];
|
|
912
|
+
[pager setValue:@293 forKey:@"headerHeight"];
|
|
913
|
+
[pager setValue:@52 forKey:@"stickyHeaderHeight"];
|
|
914
|
+
Class nativeListClass = NSClassFromString(@"HybridNativeListComponent");
|
|
915
|
+
XCTAssertNotNil(nativeListClass, @"The real NativeList test dependency must be linked");
|
|
916
|
+
UIViewController *page = [pager valueForKey:@"pageControllers"][0];
|
|
917
|
+
|
|
918
|
+
RCTViewComponentView *horizontalComponent = [[nativeListClass alloc] init];
|
|
919
|
+
horizontalComponent.tag = 92002;
|
|
920
|
+
horizontalComponent.frame = CGRectZero;
|
|
921
|
+
horizontalComponent.contentView.frame = CGRectZero;
|
|
922
|
+
[page.view addSubview:horizontalComponent];
|
|
923
|
+
|
|
924
|
+
RCTViewComponentView *component = [[nativeListClass alloc] init];
|
|
925
|
+
component.tag = 92003;
|
|
926
|
+
component.frame = CGRectZero;
|
|
927
|
+
component.contentView.frame = CGRectZero;
|
|
928
|
+
[page.view addSubview:component];
|
|
929
|
+
[self addTeardownBlock:^{
|
|
930
|
+
[horizontalComponent prepareForRecycle];
|
|
931
|
+
[horizontalComponent removeFromSuperview];
|
|
932
|
+
[component prepareForRecycle];
|
|
933
|
+
[component removeFromSuperview];
|
|
934
|
+
}];
|
|
935
|
+
|
|
936
|
+
UICollectionView *horizontalList = nil;
|
|
937
|
+
for (UIView *child in horizontalComponent.contentView.subviews) {
|
|
938
|
+
if ([child isKindOfClass:UICollectionView.class]) {
|
|
939
|
+
horizontalList = (UICollectionView *)child;
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
XCTAssertNotNil(horizontalList);
|
|
944
|
+
UICollectionViewFlowLayout *horizontalLayout =
|
|
945
|
+
(UICollectionViewFlowLayout *)horizontalList.collectionViewLayout;
|
|
946
|
+
horizontalLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
|
947
|
+
horizontalList.alwaysBounceVertical = NO;
|
|
948
|
+
horizontalList.alwaysBounceHorizontal = YES;
|
|
949
|
+
|
|
950
|
+
[pager setNeedsLayout];
|
|
951
|
+
[pager layoutIfNeeded];
|
|
952
|
+
XCTAssertNil([pager valueForKey:@"observedScrollView"]);
|
|
953
|
+
XCTAssertFalse([[pager valueForKey:@"awaitingScrollOwnerForCurrentPage"] boolValue]);
|
|
954
|
+
XCTAssertTrue([[pager valueForKey:@"scrollReconcileScheduled"] boolValue]);
|
|
955
|
+
|
|
956
|
+
horizontalComponent.frame = CGRectMake(0, 0, 390, 120);
|
|
957
|
+
horizontalComponent.contentView.frame = horizontalComponent.bounds;
|
|
958
|
+
[horizontalComponent.contentView layoutIfNeeded];
|
|
959
|
+
[[NSNotificationCenter defaultCenter]
|
|
960
|
+
postNotificationName:@"OneKeyNativeScrollViewDidBecomeReady"
|
|
961
|
+
object:horizontalList];
|
|
962
|
+
XCTAssertNil([pager valueForKey:@"observedScrollView"]);
|
|
963
|
+
XCTAssertEqualWithAccuracy(horizontalList.contentInset.top, 0, 0.01);
|
|
964
|
+
XCTAssertEqualWithAccuracy(horizontalList.contentOffset.y, 0, 0.01);
|
|
965
|
+
XCTAssertFalse(horizontalList.alwaysBounceVertical);
|
|
966
|
+
|
|
967
|
+
UICollectionView *list = nil;
|
|
968
|
+
for (UIView *child in component.contentView.subviews) {
|
|
969
|
+
if ([child isKindOfClass:UICollectionView.class]) {
|
|
970
|
+
list = (UICollectionView *)child;
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
XCTAssertNotNil(list);
|
|
975
|
+
XCTAssertEqualWithAccuracy(list.contentInset.top, 0, 0.01);
|
|
976
|
+
XCTAssertEqualWithAccuracy(list.contentOffset.y, 0, 0.01);
|
|
977
|
+
|
|
978
|
+
component.frame = CGRectMake(0, 0, 390, 697);
|
|
979
|
+
component.contentView.frame = component.bounds;
|
|
980
|
+
[component.contentView layoutIfNeeded];
|
|
981
|
+
|
|
982
|
+
UIView *header = [pager valueForKey:@"sharedHeaderHostView"];
|
|
983
|
+
XCTAssertEqual([pager valueForKey:@"observedScrollView"], list);
|
|
984
|
+
XCTAssertEqual(header.superview, list);
|
|
985
|
+
XCTAssertEqualWithAccuracy(list.contentInset.top, 345, 0.01);
|
|
986
|
+
XCTAssertEqualWithAccuracy(list.contentOffset.y, -345, 0.01);
|
|
987
|
+
}
|
|
988
|
+
|
|
900
989
|
- (void)testNativeListFooterScrollViewCannotReplacePageOwner
|
|
901
990
|
{
|
|
902
991
|
RNCCollapsiblePagerViewComponentView *pager = [self pagerWithPageCount:1];
|