@onekeyfe/react-native-pager-view 6.7.0-alpha.445 → 6.7.0-alpha.464
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/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt +35 -0
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerNativeHeaders.kt +5 -0
- package/android/src/main/java/com/reactnativepagerview/CollapsiblePagerViewManager.kt +3 -0
- package/docs/SPEC.md +60 -0
- package/ios/RNCCollapsiblePagerViewComponentView.mm +58 -23
- package/ios/tests/RNCCollapsiblePagerFirstFrameTests.mm +76 -0
- package/lib/module/CollapsiblePagerView.js +2 -0
- package/lib/module/CollapsiblePagerView.web.js +5 -3
- 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 +6 -3
- package/src/CollapsiblePagerViewNativeComponent.ts +1 -0
package/android/src/androidTest/java/com/reactnativepagerview/CollapsiblePagerTabReservationTest.kt
CHANGED
|
@@ -6,6 +6,7 @@ import android.content.pm.ApplicationInfo
|
|
|
6
6
|
import android.graphics.Bitmap
|
|
7
7
|
import android.graphics.Canvas
|
|
8
8
|
import android.graphics.Color
|
|
9
|
+
import android.graphics.Typeface
|
|
9
10
|
import android.graphics.drawable.ColorDrawable
|
|
10
11
|
import android.graphics.drawable.GradientDrawable
|
|
11
12
|
import android.test.InstrumentationTestCase
|
|
@@ -438,4 +439,38 @@ class CollapsiblePagerTabReservationTest : InstrumentationTestCase() {
|
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
441
|
|
|
442
|
+
fun testTextActiveTypefaceInheritsNormalFamilyAndKeepsExplicitFace() {
|
|
443
|
+
instrumentation.runOnMainSync {
|
|
444
|
+
val tab = CollapsiblePagerNativeTabBarView(instrumentation.targetContext)
|
|
445
|
+
tab.updateItemsJSON("""[{"key":"a","title":"Wide glyphs pygy"}]""")
|
|
446
|
+
tab.updateStyle(44.0, "text", 0.0, 0.0, 0.0, 18.0, "serif", 0.0, 0.0)
|
|
447
|
+
val row = tab.getChildAt(0) as HorizontalScrollView
|
|
448
|
+
val content = row.getChildAt(0) as ViewGroup
|
|
449
|
+
val button = (0 until content.childCount).map(content::getChildAt).filterIsInstance<TextView>().single()
|
|
450
|
+
val normal = com.facebook.react.common.assets.ReactFontManager.getInstance()
|
|
451
|
+
.getTypeface("serif", Typeface.NORMAL, instrumentation.targetContext.assets)
|
|
452
|
+
val expected = if (android.os.Build.VERSION.SDK_INT >= 28) Typeface.create(normal, 600, normal.isItalic)
|
|
453
|
+
else Typeface.create(normal, Typeface.BOLD)
|
|
454
|
+
for (config in listOf("{}", """{"activeFontFamily":""}""")) {
|
|
455
|
+
tab.updateConfigJSON(config)
|
|
456
|
+
tab.measure(View.MeasureSpec.makeMeasureSpec(320, View.MeasureSpec.EXACTLY),
|
|
457
|
+
View.MeasureSpec.makeMeasureSpec(44, View.MeasureSpec.EXACTLY))
|
|
458
|
+
tab.layout(0, 0, 320, 44)
|
|
459
|
+
assertEquals(expected, button.typeface)
|
|
460
|
+
if (android.os.Build.VERSION.SDK_INT >= 28) assertEquals(600, button.typeface.weight)
|
|
461
|
+
}
|
|
462
|
+
tab.updateConfigJSON("""{"activeFontFamily":"monospace"}""")
|
|
463
|
+
tab.setProgress(0f)
|
|
464
|
+
val explicit = com.facebook.react.common.assets.ReactFontManager.getInstance()
|
|
465
|
+
.getTypeface("monospace", Typeface.NORMAL, instrumentation.targetContext.assets)
|
|
466
|
+
assertEquals(explicit, button.typeface)
|
|
467
|
+
tab.updateStyle(44.0, "text", 0.0, 0.0, 0.0, 18.0, null, 0.0, 0.0)
|
|
468
|
+
tab.updateConfigJSON("{}")
|
|
469
|
+
tab.setProgress(0f)
|
|
470
|
+
val system = if (android.os.Build.VERSION.SDK_INT >= 28) Typeface.create(Typeface.create("sans-serif", Typeface.NORMAL), 600, false)
|
|
471
|
+
else Typeface.create("sans-serif", Typeface.BOLD)
|
|
472
|
+
assertEquals(system, button.typeface)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
441
476
|
}
|
|
@@ -231,6 +231,11 @@ private class CollapsiblePagerHorizontalItemsView(
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
private fun selectedTypeface(): Typeface = activeFontFamily?.takeIf(String::isNotEmpty)?.let { resolveHeaderTypeface(context, it) }
|
|
234
|
+
?: fontFamily?.takeIf(String::isNotEmpty)?.let { family ->
|
|
235
|
+
val normal = resolveHeaderTypeface(context, family)
|
|
236
|
+
if (android.os.Build.VERSION.SDK_INT >= 28) Typeface.create(normal, 600, normal.isItalic)
|
|
237
|
+
else Typeface.create(normal, Typeface.BOLD)
|
|
238
|
+
}
|
|
234
239
|
?: if (android.os.Build.VERSION.SDK_INT >= 28) Typeface.create(Typeface.create("sans-serif", Typeface.NORMAL), 600, false)
|
|
235
240
|
else Typeface.create("sans-serif", Typeface.BOLD)
|
|
236
241
|
|
|
@@ -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
|
|
@@ -1249,6 +1274,16 @@ handoff does not resize the button or move its neighboring tabs. Hidden copies
|
|
|
1249
1274
|
are AX-hidden, noninteractive and unselectable; there remains one named button
|
|
1250
1275
|
and one visible label. The normal face keeps its inherited family when
|
|
1251
1276
|
fontFamily is omitted, and the active face falls back to that normal family.
|
|
1277
|
+
On native text tabs, an omitted or empty `activeFontFamily` derives the active
|
|
1278
|
+
semibold weight (600, or Android legacy bold) from the resolved normal face,
|
|
1279
|
+
using the nearest available family weight on iOS.
|
|
1280
|
+
A nonempty explicit active face takes precedence and retains its named weight;
|
|
1281
|
+
an unavailable explicit iOS face retains the existing system-semibold fallback.
|
|
1282
|
+
Invalid normal iOS faces resolve to system medium before deriving active weight;
|
|
1283
|
+
Android family resolution retains ReactFontManager fallback behavior. Native
|
|
1284
|
+
measurement and rendering use the same resolved active face. On iOS text bars,
|
|
1285
|
+
the parent paints the full row background once and the inner scroll view is
|
|
1286
|
+
transparent, including fractional-alpha colors and the fixed toolbar slot.
|
|
1252
1287
|
Other modes retain their existing structure and behavior. Existing underline and
|
|
1253
1288
|
segmented defaults remain unchanged.
|
|
1254
1289
|
|
|
@@ -1296,6 +1331,8 @@ inputs. Colors are normalized at the native wrapper boundary: iconColor uses
|
|
|
1296
1331
|
OneKeyImage's rgba representation and native background colors use ARGB.
|
|
1297
1332
|
This does not add a second toolbar configuration or a JavaScript feedback loop. Default background is transparent;
|
|
1298
1333
|
selected background remains the base color after hover, press or cancellation.
|
|
1334
|
+
Omitted hover and pressed colors inherit that resolved base on every platform;
|
|
1335
|
+
explicit colors, including transparent, override it.
|
|
1299
1336
|
iOS UIKit and Android drawable state own feedback without JavaScript roundtrips
|
|
1300
1337
|
or default Android ripples. No menus or business capability checks live here.
|
|
1301
1338
|
|
|
@@ -1423,3 +1460,26 @@ schemas relative to the pre-integration PR. Native source and erased JavaScript
|
|
|
1423
1460
|
for the native wrapper/codegen files remain unchanged; the Web boolean forwarding
|
|
1424
1461
|
above is a separate main-branch runtime change. These checks do not prove a new
|
|
1425
1462
|
RN 0.88 SDK native example build or extend the scoped consumer UI acceptance.
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
### Registry consumer integration (2026-11-05)
|
|
1466
|
+
|
|
1467
|
+
Preview `6.7.0-alpha.449` was published from production source `76834daf9`.
|
|
1468
|
+
The consumer normally installed only Pager and NativeList, with exact package
|
|
1469
|
+
file/tarball parity; Image/logger/skeleton/bottom-tabs remain alpha.422.
|
|
1470
|
+
New official iOS/Android shell and vendor builds exercised Home tab/body/toolbar,
|
|
1471
|
+
Market primary tabs and sticky scrolling. Web exercised the actual narrow App
|
|
1472
|
+
Home and the installed public wrapper keyboard/ref/scroll contract. These are
|
|
1473
|
+
scoped consumer checks, not exact-frame/glyph/performance or rapid/CANCEL/resize
|
|
1474
|
+
acceptance. Earlier source-matched evidence and its limits above remain.
|
|
1475
|
+
|
|
1476
|
+
The publish workflow's Image registry poll timed out; later all 45 exact versions
|
|
1477
|
+
were verified without republishing. Official launch notices record shell and
|
|
1478
|
+
vendor HTTP-404 local-build fallbacks, a shared-preparation wait, and the initial
|
|
1479
|
+
iOS deployment-lock failure (`[nativeDevShell] Command failed (1): node`). Normal
|
|
1480
|
+
App Pod installation refreshed the two selected versions before the successful
|
|
1481
|
+
official launch. Neither platform is described as a clean cache hit. Consumer
|
|
1482
|
+
commit checks passed 9/9; unrelated postinstall noble patch and Web notification/
|
|
1483
|
+
external-image warnings remain separately recorded. Alpha.445 failed Pod
|
|
1484
|
+
integration and was not reused. SDK iOS CI ran on iOS 26.5: iOS-27-only incoming
|
|
1485
|
+
lifecycle cases remained skipped; no local SDK UIKit execution is claimed.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#import "React/RCTTouchHandler.h"
|
|
16
16
|
#import <objc/runtime.h>
|
|
17
17
|
#import <React/RCTConvert.h>
|
|
18
|
+
#import <React/RCTFont.h>
|
|
18
19
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
19
20
|
|
|
20
21
|
// OneKey patch: deduplicate structural mutation parents before scanning the page.
|
|
@@ -604,6 +605,18 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
604
605
|
return [UIFont systemFontOfSize:_fontSize weight:UIFontWeightMedium];
|
|
605
606
|
}
|
|
606
607
|
|
|
608
|
+
- (UIFont *)activeTabFont
|
|
609
|
+
{
|
|
610
|
+
NSString *activeFamily = _config[@"activeFontFamily"];
|
|
611
|
+
if (activeFamily.length > 0) {
|
|
612
|
+
return [UIFont fontWithName:activeFamily size:_fontSize]
|
|
613
|
+
?: [UIFont systemFontOfSize:_fontSize weight:UIFontWeightSemibold];
|
|
614
|
+
}
|
|
615
|
+
UIFont *normalFont = _fontFamily.length > 0 ? [UIFont fontWithName:_fontFamily size:_fontSize] : nil;
|
|
616
|
+
return normalFont != nil ? [RCTFont updateFont:normalFont withWeight:@"600"]
|
|
617
|
+
: [UIFont systemFontOfSize:_fontSize weight:UIFontWeightSemibold];
|
|
618
|
+
}
|
|
619
|
+
|
|
607
620
|
- (void)updateItemsJSON:(NSString *)itemsJSON
|
|
608
621
|
{
|
|
609
622
|
NSData *data = [itemsJSON dataUsingEncoding:NSUTF8StringEncoding];
|
|
@@ -670,7 +683,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
670
683
|
_fontSize = MAX(1, fontSize);
|
|
671
684
|
_fontFamily = [fontFamily copy];
|
|
672
685
|
self.backgroundColor = _segmented ? UIColor.clearColor : (backgroundColor ?: UIColor.clearColor);
|
|
673
|
-
_scrollView.backgroundColor = self.backgroundColor;
|
|
686
|
+
_scrollView.backgroundColor = _textVariant ? UIColor.clearColor : self.backgroundColor;
|
|
674
687
|
_scrollView.scrollEnabled = !_segmented;
|
|
675
688
|
if (_segmented && !wasSegmented) [_scrollView setContentOffset:CGPointZero animated:NO];
|
|
676
689
|
_trackView.hidden = !_segmented;
|
|
@@ -780,8 +793,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
780
793
|
NSString *title = [button titleForState:UIControlStateNormal] ?: @"";
|
|
781
794
|
CGFloat textWidth = ceil([title sizeWithAttributes:@{NSFontAttributeName: font}].width);
|
|
782
795
|
if (_textVariant) {
|
|
783
|
-
UIFont *activeFont =
|
|
784
|
-
?: [UIFont systemFontOfSize:_fontSize weight:UIFontWeightSemibold];
|
|
796
|
+
UIFont *activeFont = self.activeTabFont;
|
|
785
797
|
textWidth = MAX(textWidth, ceil([title sizeWithAttributes:@{NSFontAttributeName: activeFont}].width));
|
|
786
798
|
}
|
|
787
799
|
CGFloat buttonWidth = MAX(44, textWidth + (_textVariant ? 20 : 16));
|
|
@@ -1348,7 +1360,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
1348
1360
|
[button setTitleColor:color forState:UIControlStateNormal];
|
|
1349
1361
|
if (self->_textVariant) {
|
|
1350
1362
|
button.titleLabel.font = index == fontOwnerIndex
|
|
1351
|
-
?
|
|
1363
|
+
? self.activeTabFont
|
|
1352
1364
|
: self.tabFont;
|
|
1353
1365
|
}
|
|
1354
1366
|
button.accessibilityTraits = index == selectedIndex
|
|
@@ -2195,6 +2207,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2195
2207
|
- (void)attachSharedHeadersToScrollView:(UIScrollView *)scrollView;
|
|
2196
2208
|
- (void)liftSharedHeadersForPagerTransition:(NSString *)reason;
|
|
2197
2209
|
- (void)restoreSharedHeadersToContainer;
|
|
2210
|
+
- (NSInteger)currentStickyHeaderHeight;
|
|
2198
2211
|
- (void)layoutSharedHeaders;
|
|
2199
2212
|
- (void)bringReservedStickyControlToFront;
|
|
2200
2213
|
- (void)restorePinnedStickyHeader;
|
|
@@ -2278,6 +2291,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2278
2291
|
NSInteger _pendingInitialPage;
|
|
2279
2292
|
NSInteger _headerHeight;
|
|
2280
2293
|
NSInteger _stickyHeaderHeight;
|
|
2294
|
+
NSArray *_stickyHeaderHeights;
|
|
2281
2295
|
CGFloat _topOverlayHeight;
|
|
2282
2296
|
NSInteger _externalTopOverlayTag;
|
|
2283
2297
|
__weak UIView *_externalTopOverlayView;
|
|
@@ -2625,7 +2639,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2625
2639
|
[self updateHeaderSettledStateForceBusy:NO];
|
|
2626
2640
|
[self logHomeVisualGeometry:@"window" scrollView:_observedScrollView];
|
|
2627
2641
|
for (UIScrollView *scrollView in _originalInsets.keyEnumerator) {
|
|
2628
|
-
[self updateNativeScrollerViewport:scrollView stickyHeight:self.window == nil ? 0 :
|
|
2642
|
+
[self updateNativeScrollerViewport:scrollView stickyHeight:self.window == nil ? 0 : self.currentStickyHeaderHeight + self.effectiveTopOverlayHeight];
|
|
2629
2643
|
}
|
|
2630
2644
|
if (externalHeightChanged) [self reapplyInsetsToObservedScrollView];
|
|
2631
2645
|
// OneKey patch: removing a decelerating page from its window can suppress
|
|
@@ -2969,7 +2983,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
2969
2983
|
(long)self.tag, (unsigned long)_generation, (long)_currentIndex,
|
|
2970
2984
|
opacity, collapse, (CGFloat)_headerHeight, overlayBottom,
|
|
2971
2985
|
CGRectGetMinY(headerWindow), overlayBottom + _headerHeight +
|
|
2972
|
-
|
|
2986
|
+
self.currentStickyHeaderHeight - collapse, _topEdgeInteraction.scrollView == scrollView,
|
|
2973
2987
|
red, green, blue, alpha]);
|
|
2974
2988
|
}
|
|
2975
2989
|
#endif
|
|
@@ -3633,10 +3647,22 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3633
3647
|
reason ?: @"unknown"]);
|
|
3634
3648
|
}
|
|
3635
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
|
+
|
|
3636
3662
|
- (void)layoutSharedHeaders
|
|
3637
3663
|
{
|
|
3638
3664
|
CGFloat width = CGRectGetWidth(self.bounds);
|
|
3639
|
-
CGFloat totalHeight = _headerHeight +
|
|
3665
|
+
CGFloat totalHeight = _headerHeight + self.currentStickyHeaderHeight;
|
|
3640
3666
|
BOOL attachedToList = _nativeSmoothHeaderScrollEnabled &&
|
|
3641
3667
|
_sharedHeaderScrollView != nil && !_sharedHeadersLiftedForPagerTransition;
|
|
3642
3668
|
|
|
@@ -3661,12 +3687,12 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3661
3687
|
fromView:_containerView]
|
|
3662
3688
|
: CGPointMake(0, self.effectiveTopOverlayHeight);
|
|
3663
3689
|
_pinnedStickyHostView.frame = CGRectMake(
|
|
3664
|
-
pinnedOrigin.x, pinnedOrigin.y, width,
|
|
3690
|
+
pinnedOrigin.x, pinnedOrigin.y, width, self.currentStickyHeaderHeight);
|
|
3665
3691
|
CGFloat stickyChildY = _stickyHeaderIsPinned ? 0 : stickyY;
|
|
3666
|
-
_stickyHeaderView.frame = CGRectMake(0, stickyChildY, width,
|
|
3692
|
+
_stickyHeaderView.frame = CGRectMake(0, stickyChildY, width, self.currentStickyHeaderHeight);
|
|
3667
3693
|
CGFloat nativeTabBarVisibleHeight = _nativeTabBarView.hidden
|
|
3668
3694
|
? 0
|
|
3669
|
-
: MIN(
|
|
3695
|
+
: MIN(self.currentStickyHeaderHeight, _nativeTabBarHeight);
|
|
3670
3696
|
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
3671
3697
|
_nativeTabBarView.frame = CGRectMake(
|
|
3672
3698
|
self.isLtrLayout ? 0 : tabReservedWidth,
|
|
@@ -3679,7 +3705,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3679
3705
|
stickyChildY + nativeTabBarVisibleHeight,
|
|
3680
3706
|
width,
|
|
3681
3707
|
MIN(
|
|
3682
|
-
MAX(0,
|
|
3708
|
+
MAX(0, self.currentStickyHeaderHeight - nativeTabBarVisibleHeight),
|
|
3683
3709
|
_nativeSubHeaderHeight
|
|
3684
3710
|
)
|
|
3685
3711
|
);
|
|
@@ -3732,7 +3758,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3732
3758
|
CGPoint origin = [scrollView convertPoint:CGPointMake(0, self.effectiveTopOverlayHeight)
|
|
3733
3759
|
fromView:_containerView];
|
|
3734
3760
|
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y,
|
|
3735
|
-
CGRectGetWidth(self.bounds),
|
|
3761
|
+
CGRectGetWidth(self.bounds), self.currentStickyHeaderHeight);
|
|
3736
3762
|
}
|
|
3737
3763
|
return;
|
|
3738
3764
|
}
|
|
@@ -3750,13 +3776,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3750
3776
|
[host addSubview:_nativeSubHeaderView];
|
|
3751
3777
|
CGFloat childY = shouldPin ? 0 : _headerHeight;
|
|
3752
3778
|
CGFloat width = CGRectGetWidth(self.bounds);
|
|
3753
|
-
CGFloat tabHeight = _nativeTabBarView.hidden ? 0 : MIN(
|
|
3779
|
+
CGFloat tabHeight = _nativeTabBarView.hidden ? 0 : MIN(self.currentStickyHeaderHeight, _nativeTabBarHeight);
|
|
3754
3780
|
CGFloat tabReservedWidth = MIN(width, MAX(0, _nativeTabBarTrailingReservedWidth));
|
|
3755
|
-
_stickyHeaderView.frame = CGRectMake(0, childY, width,
|
|
3781
|
+
_stickyHeaderView.frame = CGRectMake(0, childY, width, self.currentStickyHeaderHeight);
|
|
3756
3782
|
_nativeTabBarView.frame = CGRectMake(self.isLtrLayout ? 0 : tabReservedWidth,
|
|
3757
3783
|
childY, width - tabReservedWidth, tabHeight);
|
|
3758
3784
|
_nativeSubHeaderView.frame = CGRectMake(0, childY + tabHeight, width,
|
|
3759
|
-
MIN(MAX(0,
|
|
3785
|
+
MIN(MAX(0, self.currentStickyHeaderHeight - tabHeight), _nativeSubHeaderHeight));
|
|
3760
3786
|
_pinnedStickyHostView.hidden = !shouldPin;
|
|
3761
3787
|
if ([_pagerScrollView isKindOfClass:RNCCollapsiblePagerDirectScrollView.class]) {
|
|
3762
3788
|
((RNCCollapsiblePagerDirectScrollView *)_pagerScrollView).excludedHeaderView =
|
|
@@ -3767,7 +3793,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
3767
3793
|
_pinnedStickyHostView.layer.zPosition = 1000;
|
|
3768
3794
|
CGPoint origin = [scrollView convertPoint:CGPointMake(0, self.effectiveTopOverlayHeight)
|
|
3769
3795
|
fromView:_containerView];
|
|
3770
|
-
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y, width,
|
|
3796
|
+
_pinnedStickyHostView.frame = CGRectMake(origin.x, origin.y, width, self.currentStickyHeaderHeight);
|
|
3771
3797
|
} else {
|
|
3772
3798
|
_pinnedStickyHostView.layer.zPosition = 0;
|
|
3773
3799
|
[_containerView addSubview:_pinnedStickyHostView];
|
|
@@ -4466,6 +4492,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
4466
4492
|
_pendingInitialPage = 0;
|
|
4467
4493
|
_headerHeight = 0;
|
|
4468
4494
|
_stickyHeaderHeight = 0;
|
|
4495
|
+
_stickyHeaderHeights = nil;
|
|
4469
4496
|
_topOverlayHeight = 0;
|
|
4470
4497
|
_externalTopOverlayTag = 0;
|
|
4471
4498
|
_externalTopOverlayView = nil;
|
|
@@ -4580,6 +4607,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
4580
4607
|
_stickyHeaderHeight = MAX(0, newViewProps.stickyHeaderHeight);
|
|
4581
4608
|
insetsChanged = YES;
|
|
4582
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
|
+
}
|
|
4583
4617
|
if (_needsPropsReapply || oldViewProps.topScrollEdgeEffect != newViewProps.topScrollEdgeEffect) {
|
|
4584
4618
|
BOOL enabled = newViewProps.topScrollEdgeEffect != RNCCollapsiblePagerViewTopScrollEdgeEffect::None;
|
|
4585
4619
|
BOOL enabledChanged = _topScrollEdgeEnabled != enabled;
|
|
@@ -5400,7 +5434,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5400
5434
|
[_managedRefreshControls removeObjectForKey:scrollView];
|
|
5401
5435
|
if (current != nil) [_managedRefreshControls setObject:current forKey:scrollView];
|
|
5402
5436
|
}
|
|
5403
|
-
[RNCRefreshControlOffsetState setOffset:_headerHeight +
|
|
5437
|
+
[RNCRefreshControlOffsetState setOffset:_headerHeight + self.currentStickyHeaderHeight
|
|
5404
5438
|
forControl:current owner:self];
|
|
5405
5439
|
if (previous != current) [self logHomeVisualGeometry:@"refresh-bind" scrollView:scrollView];
|
|
5406
5440
|
}
|
|
@@ -5430,7 +5464,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5430
5464
|
NSString *signature = [NSString stringWithFormat:
|
|
5431
5465
|
@"%.1f:%ld:%ld:%.1f:%d:%.1f:%.1f:%.1f:%d:%d",
|
|
5432
5466
|
self.effectiveTopOverlayHeight, (long)_headerHeight,
|
|
5433
|
-
(long)
|
|
5467
|
+
(long)self.currentStickyHeaderHeight, scrollView.contentInset.top, control != nil,
|
|
5434
5468
|
CGRectGetMinY(maskWindow), CGRectGetHeight(maskWindow), _pageMaskBoundary,
|
|
5435
5469
|
_stickyHeaderIsPinned, _topScrollEdgeEnabled];
|
|
5436
5470
|
if (layoutPhase && now - _homeVisualStartMono >= 2.0 &&
|
|
@@ -5455,7 +5489,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5455
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",
|
|
5456
5490
|
epochMs, monoMs, phase, (long)self.tag, (unsigned long)_generation,
|
|
5457
5491
|
(long)_currentIndex, self.window != nil, _topScrollEdgeEnabled,
|
|
5458
|
-
self.effectiveTopOverlayHeight, (long)_headerHeight, (long)
|
|
5492
|
+
self.effectiveTopOverlayHeight, (long)_headerHeight, (long)self.currentStickyHeaderHeight,
|
|
5459
5493
|
_headerOffset, scrollView.contentOffset.y, scrollView.contentInset.top,
|
|
5460
5494
|
overscroll, control != nil, control.isRefreshing,
|
|
5461
5495
|
CGRectGetMinY(controlWindow), CGRectGetHeight(controlWindow),
|
|
@@ -5690,7 +5724,8 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5690
5724
|
// suppress its later vertical movement while the pager is still pending.
|
|
5691
5725
|
scrollView.directionalLockEnabled = _nativeSmoothHeaderScrollEnabled
|
|
5692
5726
|
? NO : [_originalDirectionalLockEnabled objectForKey:scrollView].boolValue;
|
|
5693
|
-
|
|
5727
|
+
CGFloat stickyHeight = [self stickyHeaderHeightForPageIndex:pageIndex];
|
|
5728
|
+
[self updateNativeScrollerViewport:scrollView stickyHeight:stickyHeight + self.effectiveTopOverlayHeight];
|
|
5694
5729
|
[self updateRefreshControlForScrollView:scrollView];
|
|
5695
5730
|
CGFloat previousTopInset = scrollView.contentInset.top;
|
|
5696
5731
|
CGFloat previousLogicalOffset = scrollView.contentOffset.y + previousTopInset;
|
|
@@ -5701,13 +5736,13 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
5701
5736
|
CGFloat refreshInset = appliedTop != nil && scrollView.refreshControl != nil
|
|
5702
5737
|
? MAX(0, previousTopInset - appliedTop.doubleValue) : 0;
|
|
5703
5738
|
UIEdgeInsets next = original;
|
|
5704
|
-
next.top += self.effectiveTopOverlayHeight + _headerHeight +
|
|
5739
|
+
next.top += self.effectiveTopOverlayHeight + _headerHeight + stickyHeight;
|
|
5705
5740
|
CGFloat pagerTopInset = next.top;
|
|
5706
5741
|
next.top += refreshInset;
|
|
5707
5742
|
[_appliedTopInsets setObject:@(pagerTopInset) forKey:scrollView];
|
|
5708
5743
|
// Short pages still need enough range to collapse the header; long pages
|
|
5709
5744
|
// must end at the last row rather than leave a header-sized blank footer.
|
|
5710
|
-
next.bottom += MAX(0, scrollView.bounds.size.height -
|
|
5745
|
+
next.bottom += MAX(0, scrollView.bounds.size.height - stickyHeight - self.effectiveTopOverlayHeight
|
|
5711
5746
|
- original.top - original.bottom - scrollView.contentSize.height);
|
|
5712
5747
|
if (UIEdgeInsetsEqualToEdgeInsets(scrollView.contentInset, next) && !restore) {
|
|
5713
5748
|
// UICollectionView may report contentSize during a bounce without changing
|
|
@@ -6647,7 +6682,7 @@ static CGFloat RNCPagerToolbarDimension(NSDictionary *entry, NSString *key, CGFl
|
|
|
6647
6682
|
UIEdgeInsets adjustedInset = owner.adjustedContentInset;
|
|
6648
6683
|
NSString *geometry = [NSString stringWithFormat:
|
|
6649
6684
|
@"%.4f:%ld:%ld:%@:%@:%@:%@:%@:%@:%@",
|
|
6650
|
-
_headerOffset, (long)_headerHeight, (long)
|
|
6685
|
+
_headerOffset, (long)_headerHeight, (long)self.currentStickyHeaderHeight,
|
|
6651
6686
|
NSStringFromCGPoint(owner.contentOffset), NSStringFromCGSize(owner.contentSize),
|
|
6652
6687
|
NSStringFromCGRect(owner.bounds), NSStringFromUIEdgeInsets(inset),
|
|
6653
6688
|
NSStringFromUIEdgeInsets(adjustedInset), NSStringFromCGRect(headerRect), NSStringFromCGRect(ownerRect)];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#import "RNCCollapsiblePagerViewComponentView.h"
|
|
3
3
|
#import "RNCNativeScrollerComponentView.h"
|
|
4
4
|
#import <React/RCTScrollViewComponentView.h>
|
|
5
|
+
#import <React/RCTFont.h>
|
|
5
6
|
#import <react/renderer/components/pagerview/Props.h>
|
|
6
7
|
#import <react/renderer/mounting/MountingTransaction.h>
|
|
7
8
|
|
|
@@ -41,6 +42,14 @@ using namespace facebook::react;
|
|
|
41
42
|
- (void)updateConfigJSON:(NSString *)json;
|
|
42
43
|
- (void)updateToolbarPagerIndex:(NSInteger)index busy:(BOOL)busy;
|
|
43
44
|
- (BOOL)toolbarCanCommit;
|
|
45
|
+
- (UIFont *)tabFont;
|
|
46
|
+
- (UIFont *)activeTabFont;
|
|
47
|
+
- (void)updateStyleWithHeight:(CGFloat)height variant:(NSString *)variant
|
|
48
|
+
contentPaddingHorizontal:(CGFloat)horizontal contentPaddingVertical:(CGFloat)vertical
|
|
49
|
+
itemSpacing:(CGFloat)spacing fontSize:(CGFloat)size fontFamily:(NSString *)family
|
|
50
|
+
backgroundColor:(UIColor *)background activeTextColor:(UIColor *)active
|
|
51
|
+
inactiveTextColor:(UIColor *)inactive indicatorColor:(UIColor *)indicator
|
|
52
|
+
indicatorHeight:(CGFloat)indicatorHeight indicatorBottom:(CGFloat)bottom;
|
|
44
53
|
@end
|
|
45
54
|
|
|
46
55
|
@interface RNCCollapsiblePagerFirstFrameTests : XCTestCase
|
|
@@ -48,6 +57,27 @@ using namespace facebook::react;
|
|
|
48
57
|
|
|
49
58
|
@implementation RNCCollapsiblePagerFirstFrameTests
|
|
50
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
|
+
|
|
51
81
|
- (void)testPendingLocalOverlayReservesManagedScrollerInsetBeforeSlotRebuild
|
|
52
82
|
{
|
|
53
83
|
RNCCollapsiblePagerViewComponentView *pager =
|
|
@@ -964,4 +994,50 @@ using namespace facebook::react;
|
|
|
964
994
|
XCTAssertFalse(button.enabled);
|
|
965
995
|
}
|
|
966
996
|
|
|
997
|
+
- (void)testTextActiveFontInheritsNormalFamilyAndReservesItsRenderedFace
|
|
998
|
+
{
|
|
999
|
+
RNCCollapsiblePagerNativeTabBarView *bar = [[RNCCollapsiblePagerNativeTabBarView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
|
|
1000
|
+
[bar updateItemsJSON:@"[{\"key\":\"a\",\"title\":\"Wide glyphs pygy\"}]"];
|
|
1001
|
+
[bar setValue:@18 forKey:@"fontSize"];
|
|
1002
|
+
[bar setValue:@YES forKey:@"textVariant"];
|
|
1003
|
+
[bar setValue:@"AvenirNext-Medium" forKey:@"fontFamily"];
|
|
1004
|
+
UIFont *expected = [RCTFont updateFont:bar.tabFont withWeight:@"600"];
|
|
1005
|
+
for (NSString *config in @[@"{}", @"{\"activeFontFamily\":\"\"}"]) {
|
|
1006
|
+
[bar updateConfigJSON:config];
|
|
1007
|
+
[bar setNeedsLayout];
|
|
1008
|
+
[bar layoutIfNeeded];
|
|
1009
|
+
XCTAssertEqualObjects(bar.activeTabFont, expected);
|
|
1010
|
+
XCTAssertEqualObjects(bar.activeTabFont.familyName, bar.tabFont.familyName);
|
|
1011
|
+
XCTAssertGreaterThan(RCTGetFontWeight(bar.activeTabFont), RCTGetFontWeight(bar.tabFont));
|
|
1012
|
+
UIButton *button = [bar valueForKey:@"buttons"][0];
|
|
1013
|
+
XCTAssertEqualObjects(button.titleLabel.font, bar.activeTabFont);
|
|
1014
|
+
CGFloat reserved = MAX(44, MAX(ceil([button.currentTitle sizeWithAttributes:@{NSFontAttributeName: bar.tabFont}].width),
|
|
1015
|
+
ceil([button.currentTitle sizeWithAttributes:@{NSFontAttributeName: expected}].width)) + 20);
|
|
1016
|
+
XCTAssertEqualWithAccuracy(CGRectGetWidth(button.frame), reserved, 0.01);
|
|
1017
|
+
}
|
|
1018
|
+
[bar updateConfigJSON:@"{\"activeFontFamily\":\"Courier-Bold\"}"];
|
|
1019
|
+
XCTAssertEqualObjects(bar.activeTabFont.fontName, @"Courier-Bold");
|
|
1020
|
+
[bar updateConfigJSON:@"{\"activeFontFamily\":\"MissingReviewFont\"}"];
|
|
1021
|
+
XCTAssertEqualObjects(bar.activeTabFont, [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]);
|
|
1022
|
+
[bar setValue:@"MissingReviewFont" forKey:@"fontFamily"];
|
|
1023
|
+
[bar updateConfigJSON:@"{}"];
|
|
1024
|
+
XCTAssertEqualObjects(bar.activeTabFont, [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
- (void)testTextBackgroundPaintsOnlyTheParentAndRestoresOtherVariants
|
|
1028
|
+
{
|
|
1029
|
+
RNCCollapsiblePagerNativeTabBarView *bar = [RNCCollapsiblePagerNativeTabBarView new];
|
|
1030
|
+
UIColor *background = [UIColor colorWithRed:0.2 green:0.4 blue:0.6 alpha:0.5];
|
|
1031
|
+
for (NSString *variant in @[@"text", @"underline", @"segmented", @"text"]) {
|
|
1032
|
+
[bar updateStyleWithHeight:44 variant:variant contentPaddingHorizontal:0 contentPaddingVertical:0
|
|
1033
|
+
itemSpacing:0 fontSize:18 fontFamily:nil backgroundColor:background activeTextColor:nil
|
|
1034
|
+
inactiveTextColor:nil indicatorColor:nil indicatorHeight:2 indicatorBottom:0];
|
|
1035
|
+
UIScrollView *scroll = [bar valueForKey:@"scrollView"];
|
|
1036
|
+
XCTAssertEqualObjects(bar.backgroundColor, [variant isEqualToString:@"segmented"] ? UIColor.clearColor : background);
|
|
1037
|
+
XCTAssertEqualObjects(scroll.backgroundColor, [variant isEqualToString:@"text"] ? UIColor.clearColor : bar.backgroundColor);
|
|
1038
|
+
UIView *track = [bar valueForKey:@"trackView"];
|
|
1039
|
+
XCTAssertEqualObjects(track.backgroundColor, background);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
967
1043
|
@end
|
|
@@ -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,
|
|
@@ -1134,9 +1134,10 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
1134
1134
|
padding: `${(size - iconSize) / 2}px`,
|
|
1135
1135
|
color: entry.iconColor ?? "#000000"
|
|
1136
1136
|
});
|
|
1137
|
-
|
|
1138
|
-
button.style.setProperty("--pager-toolbar-
|
|
1139
|
-
button.style.setProperty("--pager-toolbar-
|
|
1137
|
+
const base = entry.selected ? entry.selectedBackgroundColor ?? "transparent" : "transparent";
|
|
1138
|
+
button.style.setProperty("--pager-toolbar-base", base);
|
|
1139
|
+
button.style.setProperty("--pager-toolbar-hover", entry.hoverBackgroundColor ?? base);
|
|
1140
|
+
button.style.setProperty("--pager-toolbar-pressed", entry.pressedBackgroundColor ?? base);
|
|
1140
1141
|
button.setAttribute("aria-label", entry.accessibilityLabel ?? "");
|
|
1141
1142
|
if (entry.testID) button.setAttribute("data-testid", entry.testID);else button.removeAttribute("data-testid");
|
|
1142
1143
|
this.toolbarOwnerKey = key;
|
|
@@ -1378,6 +1379,7 @@ export class CollapsiblePagerView extends React.PureComponent {
|
|
|
1378
1379
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
1379
1380
|
headerHeight: _headerHeight,
|
|
1380
1381
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1382
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
1381
1383
|
isActive: _isActive,
|
|
1382
1384
|
pageRetentionDistance: _pageRetentionDistance,
|
|
1383
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}`;
|
|
@@ -1629,9 +1630,10 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1629
1630
|
if (button.firstChild !== icon) button.replaceChildren(icon);
|
|
1630
1631
|
Object.assign(button.style, { position: "absolute", width: `${size}px`, height: `${size}px`, borderRadius: "50%", top: "50%", transform: "translateY(-50%)",
|
|
1631
1632
|
insetInlineEnd: `${trailingInset - (size - contentWidth) / 2}px`, padding: `${(size - iconSize) / 2}px`, color: entry.iconColor ?? "#000000" });
|
|
1632
|
-
|
|
1633
|
-
button.style.setProperty("--pager-toolbar-
|
|
1634
|
-
button.style.setProperty("--pager-toolbar-
|
|
1633
|
+
const base = entry.selected ? entry.selectedBackgroundColor ?? "transparent" : "transparent";
|
|
1634
|
+
button.style.setProperty("--pager-toolbar-base", base);
|
|
1635
|
+
button.style.setProperty("--pager-toolbar-hover", entry.hoverBackgroundColor ?? base);
|
|
1636
|
+
button.style.setProperty("--pager-toolbar-pressed", entry.pressedBackgroundColor ?? base);
|
|
1635
1637
|
button.setAttribute("aria-label", entry.accessibilityLabel ?? "");
|
|
1636
1638
|
if (entry.testID) button.setAttribute("data-testid", entry.testID); else button.removeAttribute("data-testid");
|
|
1637
1639
|
this.toolbarOwnerKey = key;
|
|
@@ -1808,6 +1810,7 @@ export class CollapsiblePagerView extends React.PureComponent<
|
|
|
1808
1810
|
externalTopOverlayTag: _externalTopOverlayTag,
|
|
1809
1811
|
headerHeight: _headerHeight,
|
|
1810
1812
|
stickyHeaderHeight: _stickyHeaderHeight,
|
|
1813
|
+
stickyHeaderHeights: _stickyHeaderHeights,
|
|
1811
1814
|
isActive: _isActive,
|
|
1812
1815
|
pageRetentionDistance: _pageRetentionDistance,
|
|
1813
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>;
|