@onekeyfe/react-native-pager-view 6.7.0-58 → 6.7.0-59
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
|
@@ -1095,6 +1095,24 @@ Status: implemented and verified by production-native UIKit regressions on
|
|
|
1095
1095
|
iOS 27.1 for footer insertion, explicit-sibling priority and nested-pager
|
|
1096
1096
|
delegation. Full App and physical-device visual acceptance are reported separately.
|
|
1097
1097
|
|
|
1098
|
+
A NativeOverlay host is a discovery boundary on iOS as well. Overlay content
|
|
1099
|
+
(popover, sheet, dialog) stays mounted inside its host view until the overlay
|
|
1100
|
+
window presents it, and the host can sit anywhere in a page's subtree, including
|
|
1101
|
+
beside the page's NativeList. Scroll views inside a host belong to the overlay:
|
|
1102
|
+
they MUST NOT be resolved as the page's vertical scroll owner or receive its
|
|
1103
|
+
insets, logical offsets or shared header. Without this boundary a staged sheet's
|
|
1104
|
+
Fabric scroll view outranks a NativeList sibling, takes the collapsed-header
|
|
1105
|
+
offset, and the sheet opens scrolled past its content. The host is recognised by
|
|
1106
|
+
its component class; discovery is unchanged when the overlay package is absent,
|
|
1107
|
+
and a scroll view outside a host keeps its existing priority. Android owner
|
|
1108
|
+
discovery is not changed by this boundary.
|
|
1109
|
+
|
|
1110
|
+
Status: implemented on iOS. Verified in the OneKey app on an iPhone SE (3rd
|
|
1111
|
+
generation) simulator, iOS 26.5: with the Home header collapsed, a popover opened
|
|
1112
|
+
from the History list showed an empty body before this boundary and its content
|
|
1113
|
+
from the first frame after it. A UIKit regression covers the boundary; Android
|
|
1114
|
+
was not inspected beyond the absence of the symptom.
|
|
1115
|
+
|
|
1098
1116
|
When the active scroll owner is removed before its replacement becomes usable,
|
|
1099
1117
|
the pager MUST retain bounded recovery (at most 12 retries per recovery round,
|
|
1100
1118
|
spaced 100 ms apart). Clearing the completed mount's reattachment flag MUST NOT
|
|
@@ -207,6 +207,21 @@ struct RNCScrollCandidateResolution {
|
|
|
207
207
|
@implementation RNCCollapsiblePagerTransitionEdgeOwner
|
|
208
208
|
@end
|
|
209
209
|
|
|
210
|
+
// OneKey patch: overlay content (popover, sheet, dialog) stays mounted inside
|
|
211
|
+
// its host view until the overlay window presents it, so a host can sit in a
|
|
212
|
+
// page's subtree. That content is never the page's scroller: adopting its
|
|
213
|
+
// scroll view applies the collapsed-header offset to it, and the sheet then
|
|
214
|
+
// opens scrolled past its content.
|
|
215
|
+
static BOOL RNCIsNativeOverlayHost(UIView *view)
|
|
216
|
+
{
|
|
217
|
+
// Looked up by name: the overlay package is optional here. Main thread only.
|
|
218
|
+
static Class overlayHostClass = Nil;
|
|
219
|
+
if (overlayHostClass == Nil) {
|
|
220
|
+
overlayHostClass = NSClassFromString(@"RCTNativeOverlayComponentView");
|
|
221
|
+
}
|
|
222
|
+
return overlayHostClass != Nil && [view isKindOfClass:overlayHostClass];
|
|
223
|
+
}
|
|
224
|
+
|
|
210
225
|
static UIView *RNCScrollComponentView(UIScrollView *scrollView)
|
|
211
226
|
{
|
|
212
227
|
for (UIView *view = scrollView; view != nil; view = view.superview) {
|
|
@@ -5090,7 +5105,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5090
5105
|
- (RNCScrollCandidateResolution)resolveScrollCandidateInView:(UIView *)view
|
|
5091
5106
|
{
|
|
5092
5107
|
RNCScrollCandidateResolution resolution;
|
|
5093
|
-
if (view == nil || view == _sharedHeaderHostView) return resolution;
|
|
5108
|
+
if (view == nil || view == _sharedHeaderHostView || RNCIsNativeOverlayHost(view)) return resolution;
|
|
5094
5109
|
if (view != self &&
|
|
5095
5110
|
[view isKindOfClass:RNCCollapsiblePagerViewComponentView.class]) {
|
|
5096
5111
|
UIScrollView *nested = [(RNCCollapsiblePagerViewComponentView *)view
|
|
@@ -5181,7 +5196,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5181
5196
|
|
|
5182
5197
|
- (UIScrollView *)findExplicitNativeScrollerInView:(UIView *)view
|
|
5183
5198
|
{
|
|
5184
|
-
if (view == _sharedHeaderHostView) return nil;
|
|
5199
|
+
if (view == _sharedHeaderHostView || RNCIsNativeOverlayHost(view)) return nil;
|
|
5185
5200
|
if (view != self &&
|
|
5186
5201
|
[view isKindOfClass:RNCCollapsiblePagerViewComponentView.class]) {
|
|
5187
5202
|
return [(RNCCollapsiblePagerViewComponentView *)view
|
|
@@ -5208,7 +5223,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5208
5223
|
|
|
5209
5224
|
- (UIScrollView *)findFabricScrollViewInView:(UIView *)view
|
|
5210
5225
|
{
|
|
5211
|
-
if (view == _sharedHeaderHostView) return nil;
|
|
5226
|
+
if (view == _sharedHeaderHostView || RNCIsNativeOverlayHost(view)) return nil;
|
|
5212
5227
|
if (view != self &&
|
|
5213
5228
|
[view isKindOfClass:RNCCollapsiblePagerViewComponentView.class]) {
|
|
5214
5229
|
return [(RNCCollapsiblePagerViewComponentView *)view
|
|
@@ -5231,7 +5246,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5231
5246
|
|
|
5232
5247
|
- (UIScrollView *)findVerticalScrollViewInView:(UIView *)view
|
|
5233
5248
|
{
|
|
5234
|
-
if (view == _sharedHeaderHostView ||
|
|
5249
|
+
if (view == _sharedHeaderHostView || RNCIsNativeOverlayHost(view) ||
|
|
5235
5250
|
([view isKindOfClass:UIScrollView.class] &&
|
|
5236
5251
|
[_mountingRemovedScrollViews containsObject:(UIScrollView *)view])) return nil;
|
|
5237
5252
|
// A parent pager must follow the nested pager's active page instead of the
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import <XCTest/XCTest.h>
|
|
2
|
+
#import <objc/runtime.h>
|
|
2
3
|
#import "RNCCollapsiblePagerViewComponentView.h"
|
|
3
4
|
#import "RNCNativeScrollerComponentView.h"
|
|
4
5
|
#import <React/RCTScrollViewComponentView.h>
|
|
@@ -1035,6 +1036,53 @@ using namespace facebook::react;
|
|
|
1035
1036
|
XCTAssertEqualWithAccuracy(footerList.scrollView.contentInset.top, 0, 0.01);
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
1039
|
+
// Overlay content (popover, sheet) stays mounted inside its host view until
|
|
1040
|
+
// the overlay window presents it, and the host can sit beside the page's list.
|
|
1041
|
+
// As a Fabric scroll view its scroller outranks the native list, so the pager
|
|
1042
|
+
// used to adopt it and apply the collapsed-header offset to it: the sheet then
|
|
1043
|
+
// opened scrolled past its content (OK-67220).
|
|
1044
|
+
- (void)testStagedOverlayScrollViewCannotReplacePageOwner
|
|
1045
|
+
{
|
|
1046
|
+
RNCCollapsiblePagerViewComponentView *pager = [self pagerWithPageCount:1];
|
|
1047
|
+
RCTViewComponentView *component = [self addNativeListToPager:pager];
|
|
1048
|
+
UICollectionView *list = nil;
|
|
1049
|
+
for (UIView *child in component.contentView.subviews) {
|
|
1050
|
+
if ([child isKindOfClass:UICollectionView.class]) {
|
|
1051
|
+
list = (UICollectionView *)child;
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
XCTAssertNotNil(list);
|
|
1056
|
+
XCTAssertEqual([pager verticalScrollViewForPageAtIndex:0], list);
|
|
1057
|
+
|
|
1058
|
+
// The overlay package is not linked into this target; stand in for its host.
|
|
1059
|
+
Class overlayHostClass = NSClassFromString(@"RCTNativeOverlayComponentView");
|
|
1060
|
+
if (overlayHostClass == Nil) {
|
|
1061
|
+
overlayHostClass = objc_allocateClassPair(UIView.class, "RCTNativeOverlayComponentView", 0);
|
|
1062
|
+
objc_registerClassPair(overlayHostClass);
|
|
1063
|
+
}
|
|
1064
|
+
UIView *overlayHost = [overlayHostClass new];
|
|
1065
|
+
RCTScrollViewComponentView *sheetScroller = [RCTScrollViewComponentView new];
|
|
1066
|
+
sheetScroller.frame = CGRectMake(0, 0, 320, 60);
|
|
1067
|
+
sheetScroller.scrollView.frame = sheetScroller.bounds;
|
|
1068
|
+
sheetScroller.scrollView.contentSize = CGSizeMake(320, 60);
|
|
1069
|
+
sheetScroller.scrollView.alwaysBounceHorizontal = NO;
|
|
1070
|
+
[overlayHost addSubview:sheetScroller];
|
|
1071
|
+
UIViewController *page = [pager valueForKey:@"pageControllers"][0];
|
|
1072
|
+
[page.view addSubview:overlayHost];
|
|
1073
|
+
|
|
1074
|
+
XCTAssertEqual([pager verticalScrollViewForPageAtIndex:0], list);
|
|
1075
|
+
XCTAssertNil([pager findVerticalScrollViewInView:overlayHost]);
|
|
1076
|
+
[pager attachScrollObserverForCurrentPage];
|
|
1077
|
+
XCTAssertEqual([pager valueForKey:@"observedScrollView"], list);
|
|
1078
|
+
XCTAssertEqualWithAccuracy(sheetScroller.scrollView.contentOffset.y, 0, 0.01);
|
|
1079
|
+
|
|
1080
|
+
// The same scroll view outside an overlay host is still a page scroller.
|
|
1081
|
+
[sheetScroller removeFromSuperview];
|
|
1082
|
+
[page.view addSubview:sheetScroller];
|
|
1083
|
+
XCTAssertEqual([pager verticalScrollViewForPageAtIndex:0], sheetScroller.scrollView);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1038
1086
|
- (void)testExplicitScrollerSiblingStillPrecedesNativeList
|
|
1039
1087
|
{
|
|
1040
1088
|
RNCCollapsiblePagerViewComponentView *pager = [self pagerWithPageCount:1];
|